diff --git a/src/de/steamwar/bungeecore/comms/handlers/FightEndsHandler.java b/src/de/steamwar/bungeecore/comms/handlers/FightEndsHandler.java index 03fae60..b9a7492 100644 --- a/src/de/steamwar/bungeecore/comms/handlers/FightEndsHandler.java +++ b/src/de/steamwar/bungeecore/comms/handlers/FightEndsHandler.java @@ -129,9 +129,16 @@ public class FightEndsHandler implements SpigotHandler { if (!gameModeGames.containsKey(gameMode)) { return false; } - List games = gameModeGames.get(gameMode); + LinkedList games = gameModeGames.get(gameMode); long lifetime = fightRanges.getOrDefault(gameMode, defaultFightRange); - games.removeIf(game -> game.livedMillis() > lifetime); + while (!games.isEmpty()) { + Game game = games.getFirst(); + if (game.livedMillis() > lifetime) { + games.removeFirst(); + } else { + break; + } + } return games.stream().filter(game -> game.isSame(bluePlayers, redPlayers)).count() > fightCounts.getOrDefault(gameMode, defaultFightCount); }