Remove player on server shutdown

This commit is contained in:
TheMode 2021-08-19 23:17:25 +02:00
parent 72bda2c4ec
commit 874c60fb6a

View File

@ -349,11 +349,14 @@ public final class ConnectionManager {
if (playerConnection instanceof PlayerSocketConnection) { if (playerConnection instanceof PlayerSocketConnection) {
final PlayerSocketConnection socketConnection = (PlayerSocketConnection) playerConnection; final PlayerSocketConnection socketConnection = (PlayerSocketConnection) playerConnection;
socketConnection.writeAndFlush(disconnectPacket); socketConnection.writeAndFlush(disconnectPacket);
playerConnection.disconnect();
try { try {
socketConnection.getChannel().close(); socketConnection.getChannel().close();
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); e.printStackTrace();
} }
} else {
player.remove();
} }
} }
this.players.clear(); this.players.clear();