mirror of
https://github.com/garbagemule/MobArena.git
synced 2024-11-23 02:55:46 +01:00
Return early from forceEnd() if there are no players in the arena.
This means that the cleanup code will only run if there are players in the lobby, arena, or spectator area. This fixes the first part of #435 where the cleanup code is taking too long for large/many arenas. Originally, the force end command was meant as a way to circumvent any condition keeping players from leaving the arena and cleaning it up. In retrospect, the main reason for using force end is to "get people out of there", but since there's plenty of stuff that can go wrong when a player leaves, this isn't really that helpful, as exceptions will just cause the command to break at the same point anyway.
This commit is contained in:
parent
a91c5e7a74
commit
b1634f9460
@ -642,10 +642,12 @@ public class ArenaImpl implements Arena
|
||||
|
||||
@Override
|
||||
public void forceEnd() {
|
||||
for (Player p : getAllPlayers()) {
|
||||
playerLeave(p);
|
||||
List<Player> players = getAllPlayers();
|
||||
if (players.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
players.forEach(this::playerLeave);
|
||||
cleanup();
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user