aboutsummaryrefslogtreecommitdiffhomepage
path: root/patches/server/1052-Fix-sending-disconnect-packet-in-phases-where-it-doe.patch
diff options
context:
space:
mode:
authorShane Freeder <[email protected]>2024-05-30 19:05:39 +0100
committerShane Freeder <[email protected]>2024-05-30 19:05:39 +0100
commit8e6554a80a1efefa48adb1f7733554e528fb45f5 (patch)
tree446e5eb06d731735a1c34655aa71929b9c16f8b9 /patches/server/1052-Fix-sending-disconnect-packet-in-phases-where-it-doe.patch
parent0fcf3e347f671ce6bdc9699cbe4c34567562dd2b (diff)
downloadPaper-8e6554a80a1efefa48adb1f7733554e528fb45f5.tar.gz
Paper-8e6554a80a1efefa48adb1f7733554e528fb45f5.zip
Fix sending disconnect packet in phases where it doesn't exist
Diffstat (limited to 'patches/server/1052-Fix-sending-disconnect-packet-in-phases-where-it-doe.patch')
-rw-r--r--patches/server/1052-Fix-sending-disconnect-packet-in-phases-where-it-doe.patch21
1 files changed, 21 insertions, 0 deletions
diff --git a/patches/server/1052-Fix-sending-disconnect-packet-in-phases-where-it-doe.patch b/patches/server/1052-Fix-sending-disconnect-packet-in-phases-where-it-doe.patch
new file mode 100644
index 0000000000..802fa6c8e4
--- /dev/null
+++ b/patches/server/1052-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 02833deaa2bb7e5abc655bc1bdbe15c4b3ac7119..f40420a6841f03983b0837e177ea2ae7c3a37ca1 100644
+--- a/src/main/java/net/minecraft/network/Connection.java
++++ b/src/main/java/net/minecraft/network/Connection.java
+@@ -214,7 +214,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(() -> {