From b2ebfc68033b1713f4e45e667c921dbe87e734e0 Mon Sep 17 00:00:00 2001 From: Camotoy <20743703+Camotoy@users.noreply.github.com> Date: Sun, 6 Jun 2021 10:19:24 -0400 Subject: [PATCH] Fix reload command (fixes #2255) --- .../main/java/org/geysermc/connector/GeyserConnector.java | 4 +++- .../geysermc/connector/command/defaults/ReloadCommand.java | 6 ++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/connector/src/main/java/org/geysermc/connector/GeyserConnector.java b/connector/src/main/java/org/geysermc/connector/GeyserConnector.java index 34dd0b849..fc3aaaeb9 100644 --- a/connector/src/main/java/org/geysermc/connector/GeyserConnector.java +++ b/connector/src/main/java/org/geysermc/connector/GeyserConnector.java @@ -391,7 +391,9 @@ public class GeyserConnector { generalThreadPool.shutdown(); bedrockServer.close(); - timeSyncer.shutdown(); + if (timeSyncer != null) { + timeSyncer.shutdown(); + } newsHandler.shutdown(); players.clear(); defaultAuthType = null; diff --git a/connector/src/main/java/org/geysermc/connector/command/defaults/ReloadCommand.java b/connector/src/main/java/org/geysermc/connector/command/defaults/ReloadCommand.java index 2f1c7dc9b..d3f3d2f3f 100644 --- a/connector/src/main/java/org/geysermc/connector/command/defaults/ReloadCommand.java +++ b/connector/src/main/java/org/geysermc/connector/command/defaults/ReloadCommand.java @@ -32,6 +32,8 @@ import org.geysermc.connector.command.GeyserCommand; import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.connector.utils.LanguageUtils; +import java.util.ArrayList; + public class ReloadCommand extends GeyserCommand { private final GeyserConnector connector; @@ -51,8 +53,8 @@ public class ReloadCommand extends GeyserCommand { sender.sendMessage(message); - for (GeyserSession otherSession : connector.getPlayers()) { - otherSession.disconnect(LanguageUtils.getPlayerLocaleString("geyser.commands.reload.kick", session.getLocale())); + for (GeyserSession otherSession : new ArrayList<>(connector.getPlayers())) { + otherSession.disconnect(LanguageUtils.getPlayerLocaleString("geyser.commands.reload.kick", otherSession.getLocale())); } connector.reload(); }