Paper/CraftBukkit-Patches/0146-Clear-Packet-Queue-on-Disconnect.patch
2016-03-03 03:46:48 -06:00

35 lines
1.5 KiB
Diff

From 826e5a36d65dd521e93c10c6ad8b8d1999469bce Mon Sep 17 00:00:00 2001
From: md_5 <git@md-5.net>
Date: Wed, 22 Jul 2015 19:04:37 +1000
Subject: [PATCH] Clear Packet Queue on Disconnect
diff --git a/src/main/java/net/minecraft/server/NetworkManager.java b/src/main/java/net/minecraft/server/NetworkManager.java
index 4c6dfb1..a9ea3f5 100644
--- a/src/main/java/net/minecraft/server/NetworkManager.java
+++ b/src/main/java/net/minecraft/server/NetworkManager.java
@@ -316,6 +316,7 @@ public class NetworkManager extends SimpleChannelInboundHandler<Packet<?>> {
} else if (this.i() != null) {
this.i().a(new ChatComponentText("Disconnected"));
}
+ this.i.clear(); // Free up packet queue.
}
}
diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java
index 371b3d1..13b9a7b 100644
--- a/src/main/java/net/minecraft/server/PlayerConnection.java
+++ b/src/main/java/net/minecraft/server/PlayerConnection.java
@@ -1036,7 +1036,7 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable {
}
// CraftBukkit start
- if (packet == null) {
+ if (packet == null || this.processedDisconnect) { // Spigot
return;
} else if (packet instanceof PacketPlayOutSpawnPosition) {
PacketPlayOutSpawnPosition packet6 = (PacketPlayOutSpawnPosition) packet;
--
2.5.0