Fix player not being directly disconnected after a kick

This commit is contained in:
themode 2021-03-14 21:34:38 +01:00
parent 4f2ec0a65f
commit 509f8f7851

View File

@ -4,7 +4,6 @@ import com.google.common.collect.Queues;
import net.minestom.server.MinecraftServer;
import net.minestom.server.advancements.AdvancementTab;
import net.minestom.server.attribute.Attribute;
import net.minestom.server.attribute.AttributeInstance;
import net.minestom.server.bossbar.BossBar;
import net.minestom.server.chat.ChatParser;
import net.minestom.server.chat.ColoredText;
@ -1726,9 +1725,14 @@ public class Player extends LivingEntity implements CommandSender {
disconnectPacket = new DisconnectPacket(text);
}
if (playerConnection instanceof NettyPlayerConnection) {
((NettyPlayerConnection) playerConnection).writeAndFlush(disconnectPacket);
playerConnection.disconnect();
} else {
playerConnection.sendPacket(disconnectPacket);
playerConnection.refreshOnline(false);
}
}
/**
* Kicks the player with a reason.