From 0960ab2365a1fd19b9426ff7459de6caf64065dd Mon Sep 17 00:00:00 2001 From: RednedEpic Date: Sat, 21 Dec 2019 11:38:45 -0600 Subject: [PATCH] Close bedrock server upon shutdown --- .../main/java/org/geysermc/connector/GeyserConnector.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/connector/src/main/java/org/geysermc/connector/GeyserConnector.java b/connector/src/main/java/org/geysermc/connector/GeyserConnector.java index 821c84a9..87337f63 100644 --- a/connector/src/main/java/org/geysermc/connector/GeyserConnector.java +++ b/connector/src/main/java/org/geysermc/connector/GeyserConnector.java @@ -76,6 +76,8 @@ public class GeyserConnector { private final ScheduledExecutorService generalThreadPool; private PingPassthroughThread passthroughThread; + private BedrockServer bedrockServer; + private Metrics metrics; private GeyserConnector(IGeyserConfiguration config, IGeyserLogger logger) { @@ -106,7 +108,7 @@ public class GeyserConnector { if (config.isPingPassthrough()) generalThreadPool.scheduleAtFixedRate(passthroughThread, 1, 1, TimeUnit.SECONDS); - BedrockServer bedrockServer = new BedrockServer(new InetSocketAddress(config.getBedrock().getAddress(), config.getBedrock().getPort())); + bedrockServer = new BedrockServer(new InetSocketAddress(config.getBedrock().getAddress(), config.getBedrock().getPort())); bedrockServer.setHandler(new ConnectorServerEventHandler(this)); bedrockServer.bind().whenComplete((avoid, throwable) -> { if (throwable == null) { @@ -129,10 +131,11 @@ public class GeyserConnector { } public void shutdown() { - logger.info("Shutting down connector."); + logger.info("Shutting down Geyser."); shuttingDown = true; generalThreadPool.shutdown(); + bedrockServer.close(); } public void addPlayer(GeyserSession player) {