Fix auto-leave-on-end: true error.
The ConcurrentModificationException happens because the player leave procedure alters the `specPlayers` set, and this is the set we iterate during the automatic spectator kicking procedure. By making a copy of the set and iterating the copy, we circumvent this problem. Java 101, really, but when the code is stateful and complex, it's "fair enough" that it slipped through the cracks. It's also impossible to reproduce without at least two players, so go figure... Fixes #802
This commit is contained in:
@@ -665,7 +665,8 @@ public class ArenaImpl implements Arena
|
||||
|
||||
// Auto-leave
|
||||
if (settings.getBoolean("auto-leave-on-end", false)) {
|
||||
specPlayers.forEach(this::playerLeave);
|
||||
List<Player> spectators = new ArrayList<>(specPlayers);
|
||||
spectators.forEach(this::playerLeave);
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
Reference in New Issue
Block a user