chathistoryplugin: combine nested if statements

This commit is contained in:
sdburns1998
2019-07-07 02:38:02 +02:00
parent 3b801ce0b0
commit 01bf7d7c4e

View File

@@ -143,13 +143,11 @@ public class ChatHistoryPlugin extends Plugin implements KeyListener
case MODPRIVATECHAT:
final String name = Text.removeTags(chatMessage.getName());
// Remove to ensure uniqueness & its place in history
if (!friends.remove(name))
{
if (!friends.remove(name) &&
// If the friend didn't previously exist ensure deque capacity doesn't increase by adding them
if (friends.size() >= FRIENDS_MAX_SIZE)
{
friends.remove();
}
friends.size() >= FRIENDS_MAX_SIZE)
{
friends.remove();
}
friends.add(name);
// intentional fall-through