Remove player on server shutdown

This commit is contained in:
TheMode 2021-08-19 23:17:25 +02:00
parent 72bda2c4ec
commit 874c60fb6a
1 changed files with 3 additions and 0 deletions

View File

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