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.MinecraftServer;
import net.minestom.server.advancements.AdvancementTab; import net.minestom.server.advancements.AdvancementTab;
import net.minestom.server.attribute.Attribute; import net.minestom.server.attribute.Attribute;
import net.minestom.server.attribute.AttributeInstance;
import net.minestom.server.bossbar.BossBar; import net.minestom.server.bossbar.BossBar;
import net.minestom.server.chat.ChatParser; import net.minestom.server.chat.ChatParser;
import net.minestom.server.chat.ColoredText; import net.minestom.server.chat.ColoredText;
@ -1726,8 +1725,13 @@ public class Player extends LivingEntity implements CommandSender {
disconnectPacket = new DisconnectPacket(text); disconnectPacket = new DisconnectPacket(text);
} }
playerConnection.sendPacket(disconnectPacket); if (playerConnection instanceof NettyPlayerConnection) {
playerConnection.refreshOnline(false); ((NettyPlayerConnection) playerConnection).writeAndFlush(disconnectPacket);
playerConnection.disconnect();
} else {
playerConnection.sendPacket(disconnectPacket);
playerConnection.refreshOnline(false);
}
} }
/** /**