Fix Player#kick ignoring the kicking text

This commit is contained in:
themode 2021-01-04 23:15:41 +01:00
parent 0a0d19128c
commit 47447706b0
2 changed files with 6 additions and 1 deletions

View File

@ -1743,7 +1743,6 @@ public class Player extends LivingEntity implements CommandSender {
DisconnectPacket disconnectPacket = new DisconnectPacket();
disconnectPacket.message = text;
playerConnection.sendPacket(disconnectPacket);
playerConnection.disconnect();
playerConnection.refreshOnline(false);
}

View File

@ -56,6 +56,12 @@ public final class PacketProcessor {
channel, c -> new NettyPlayerConnection((SocketChannel) channel.channel())
);
// Prevent the client from sending packets when disconnected (kick)
if (!playerConnection.isOnline()) {
playerConnection.disconnect();
return;
}
if (MinecraftServer.getRateLimit() > 0)
playerConnection.getPacketCounter().incrementAndGet();