forked from GeyserMC/Geyser
Close bedrock server upon shutdown
This commit is contained in:
parent
e38322a3ec
commit
0960ab2365
1 changed files with 5 additions and 2 deletions
|
@ -76,6 +76,8 @@ public class GeyserConnector {
|
||||||
private final ScheduledExecutorService generalThreadPool;
|
private final ScheduledExecutorService generalThreadPool;
|
||||||
private PingPassthroughThread passthroughThread;
|
private PingPassthroughThread passthroughThread;
|
||||||
|
|
||||||
|
private BedrockServer bedrockServer;
|
||||||
|
|
||||||
private Metrics metrics;
|
private Metrics metrics;
|
||||||
|
|
||||||
private GeyserConnector(IGeyserConfiguration config, IGeyserLogger logger) {
|
private GeyserConnector(IGeyserConfiguration config, IGeyserLogger logger) {
|
||||||
|
@ -106,7 +108,7 @@ public class GeyserConnector {
|
||||||
if (config.isPingPassthrough())
|
if (config.isPingPassthrough())
|
||||||
generalThreadPool.scheduleAtFixedRate(passthroughThread, 1, 1, TimeUnit.SECONDS);
|
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.setHandler(new ConnectorServerEventHandler(this));
|
||||||
bedrockServer.bind().whenComplete((avoid, throwable) -> {
|
bedrockServer.bind().whenComplete((avoid, throwable) -> {
|
||||||
if (throwable == null) {
|
if (throwable == null) {
|
||||||
|
@ -129,10 +131,11 @@ public class GeyserConnector {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void shutdown() {
|
public void shutdown() {
|
||||||
logger.info("Shutting down connector.");
|
logger.info("Shutting down Geyser.");
|
||||||
shuttingDown = true;
|
shuttingDown = true;
|
||||||
|
|
||||||
generalThreadPool.shutdown();
|
generalThreadPool.shutdown();
|
||||||
|
bedrockServer.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addPlayer(GeyserSession player) {
|
public void addPlayer(GeyserSession player) {
|
||||||
|
|
Loading…
Reference in a new issue