diff options
Diffstat (limited to 'patches/server/0982-Fix-sending-disconnect-packet-in-phases-where-it-doe.patch')
-rw-r--r-- | patches/server/0982-Fix-sending-disconnect-packet-in-phases-where-it-doe.patch | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/patches/server/0982-Fix-sending-disconnect-packet-in-phases-where-it-doe.patch b/patches/server/0982-Fix-sending-disconnect-packet-in-phases-where-it-doe.patch new file mode 100644 index 0000000000..1abf467e7e --- /dev/null +++ b/patches/server/0982-Fix-sending-disconnect-packet-in-phases-where-it-doe.patch @@ -0,0 +1,21 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Shane Freeder <[email protected]> +Date: Thu, 30 May 2024 18:46:15 +0100 +Subject: [PATCH] Fix sending disconnect packet in phases where it doesn't + exist + + +diff --git a/src/main/java/net/minecraft/network/Connection.java b/src/main/java/net/minecraft/network/Connection.java +index 4b9da6e2140b14f1e56056f5e9e94b2169d85501..55848fa832d0f4d2d03f99df51e10c5fdfcd2ded 100644 +--- a/src/main/java/net/minecraft/network/Connection.java ++++ b/src/main/java/net/minecraft/network/Connection.java +@@ -218,7 +218,8 @@ public class Connection extends SimpleChannelInboundHandler<Packet<?>> { + if (player != null) player.quitReason = org.bukkit.event.player.PlayerQuitEvent.QuitReason.ERRONEOUS_STATE; // Paper - Add API for quit reason + if (flag) { + Connection.LOGGER.debug("Failed to sent packet", throwable); +- if (this.getSending() == PacketFlow.CLIENTBOUND) { ++ boolean doesDisconnectExist = this.packetListener.protocol() != ConnectionProtocol.STATUS && this.packetListener.protocol() != ConnectionProtocol.HANDSHAKING; // Paper ++ if (this.getSending() == PacketFlow.CLIENTBOUND && doesDisconnectExist) { // Paper + Packet<?> packet = this.sendLoginDisconnect ? new ClientboundLoginDisconnectPacket(ichatmutablecomponent) : new ClientboundDisconnectPacket(ichatmutablecomponent); + + this.send((Packet) packet, PacketSendListener.thenRun(() -> { |