Skip to content

Commit

Permalink
Skip one useless iteration
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexProgrammerDE committed Nov 1, 2022
1 parent 02b91d4 commit 92d2268
Showing 1 changed file with 3 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -255,17 +255,12 @@ private void connectPlayer(QueueType type) {
freeSlots = Config.MAX_PLAYERS_PER_MOVE;

for (Map.Entry<UUID, String> entry : new LinkedHashMap<>(type.getQueueMap()).entrySet()) {
if (freeSlots <= 0)
break;

Optional<PlayerWrapper> optional = plugin.getPlayer(entry.getKey());
if (!optional.isPresent()) {
continue;
}
PlayerWrapper player = optional.get();

freeSlots--;

type.getQueueMap().remove(entry.getKey());

player.sendMessage(Config.JOINING_MAIN_SERVER);
Expand All @@ -291,6 +286,9 @@ private void connectPlayer(QueueType type) {
}

player.connect(entry.getValue());

if (--freeSlots <= 0)
break;
}

if (Config.SEND_XP_SOUND) {
Expand Down

0 comments on commit 92d2268

Please sign in to comment.