mirror of
https://github.com/Minestom/Minestom.git
synced 2025-03-02 11:21:15 +01:00
wait for netty to finish shutting down
This commit is contained in:
parent
ae845e38ab
commit
338a1737c7
@ -217,10 +217,22 @@ public final class NettyServer {
|
||||
* Stops the server and the various services.
|
||||
*/
|
||||
public void stop() {
|
||||
this.serverChannel.close();
|
||||
try {
|
||||
this.serverChannel.close().sync();
|
||||
} catch (InterruptedException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
this.worker.shutdownGracefully();
|
||||
this.boss.shutdownGracefully();
|
||||
try {
|
||||
this.worker.shutdownGracefully().await();
|
||||
} catch (InterruptedException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
try {
|
||||
this.boss.shutdownGracefully().await();
|
||||
} catch (InterruptedException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
this.trafficScheduler.shutdown();
|
||||
this.globalTrafficHandler.release();
|
||||
|
@ -70,6 +70,8 @@ public class Main {
|
||||
//MojangAuth.init();
|
||||
|
||||
minecraftServer.start("0.0.0.0", 25565, PlayerInit.getResponseDataConsumer());
|
||||
|
||||
Runtime.getRuntime().addShutdownHook(new Thread(MinecraftServer::stopCleanly));
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user