From 169d26852c9b902193caa4f231af982fff114769 Mon Sep 17 00:00:00 2001 From: yoyosource Date: Wed, 6 Apr 2022 17:01:33 +0200 Subject: [PATCH] Update some stuff --- .../bungeecore/comms/handlers/FightEndsHandler.java | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/de/steamwar/bungeecore/comms/handlers/FightEndsHandler.java b/src/de/steamwar/bungeecore/comms/handlers/FightEndsHandler.java index 03fae605..b9a7492c 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); }