forked from GeyserMC/Geyser
Make a copy of the players list when disconnecting them all on shutdown (#928)
This commit is contained in:
parent
67c2b37337
commit
225e2a9fb8
1 changed files with 4 additions and 1 deletions
|
@ -61,6 +61,7 @@ import org.geysermc.connector.utils.LocaleUtils;
|
|||
import java.net.InetSocketAddress;
|
||||
import java.text.DecimalFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
import java.util.concurrent.Executors;
|
||||
|
@ -189,7 +190,9 @@ public class GeyserConnector {
|
|||
if (players.size() >= 1) {
|
||||
bootstrap.getGeyserLogger().info(LanguageUtils.getLocaleStringLog("geyser.core.shutdown.kick.log", players.size()));
|
||||
|
||||
for (GeyserSession playerSession : players) {
|
||||
// Make a copy to prevent ConcurrentModificationException
|
||||
final List<GeyserSession> tmpPlayers = new ArrayList<>(players);
|
||||
for (GeyserSession playerSession : tmpPlayers) {
|
||||
playerSession.disconnect(LanguageUtils.getPlayerLocaleString("geyser.core.shutdown.kick.message", playerSession.getClientData().getLanguageCode()));
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue