From 2ced02339aeb75e0c59014b1543e75f85f3dac36 Mon Sep 17 00:00:00 2001 From: md_5 Date: Sun, 3 Feb 2019 14:23:04 +1100 Subject: [PATCH] Don't handle sync packets for kicked players --- nms-patches/PlayerConnection.patch | 2 +- nms-patches/PlayerConnectionUtils.patch | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) create mode 100644 nms-patches/PlayerConnectionUtils.patch diff --git a/nms-patches/PlayerConnection.patch b/nms-patches/PlayerConnection.patch index 20384d05ca..9e4c4cbb48 100644 --- a/nms-patches/PlayerConnection.patch +++ b/nms-patches/PlayerConnection.patch @@ -73,7 +73,7 @@ + } + + private final org.bukkit.craftbukkit.CraftServer server; -+ private boolean processedDisconnect; ++ public boolean processedDisconnect; + private int lastTick = MinecraftServer.currentTick; + private int allowedPlayerTicks = 1; + private int lastDropTick = MinecraftServer.currentTick; diff --git a/nms-patches/PlayerConnectionUtils.patch b/nms-patches/PlayerConnectionUtils.patch new file mode 100644 index 0000000000..2fc062eb3a --- /dev/null +++ b/nms-patches/PlayerConnectionUtils.patch @@ -0,0 +1,10 @@ +--- a/net/minecraft/server/PlayerConnectionUtils.java ++++ b/net/minecraft/server/PlayerConnectionUtils.java +@@ -5,6 +5,7 @@ + public static void ensureMainThread(Packet packet, T t0, IAsyncTaskHandler iasynctaskhandler) throws CancelledPacketHandleException { + if (!iasynctaskhandler.isMainThread()) { + iasynctaskhandler.postToMainThread(() -> { ++ if (t0 instanceof PlayerConnection && ((PlayerConnection) t0).processedDisconnect) return; // CraftBukkit + packet.a(t0); + }); + throw CancelledPacketHandleException.INSTANCE;