aboutsummaryrefslogtreecommitdiffhomepage
path: root/patch-remap/og/net/minecraft/network/protocol/PlayerConnectionUtils.patch
diff options
context:
space:
mode:
Diffstat (limited to 'patch-remap/og/net/minecraft/network/protocol/PlayerConnectionUtils.patch')
-rw-r--r--patch-remap/og/net/minecraft/network/protocol/PlayerConnectionUtils.patch33
1 files changed, 33 insertions, 0 deletions
diff --git a/patch-remap/og/net/minecraft/network/protocol/PlayerConnectionUtils.patch b/patch-remap/og/net/minecraft/network/protocol/PlayerConnectionUtils.patch
new file mode 100644
index 0000000000..3f6e230c44
--- /dev/null
+++ b/patch-remap/og/net/minecraft/network/protocol/PlayerConnectionUtils.patch
@@ -0,0 +1,33 @@
+--- a/net/minecraft/network/protocol/PlayerConnectionUtils.java
++++ b/net/minecraft/network/protocol/PlayerConnectionUtils.java
+@@ -9,6 +9,11 @@
+ import net.minecraft.util.thread.IAsyncTaskHandler;
+ import org.slf4j.Logger;
+
++// CraftBukkit start
++import net.minecraft.server.MinecraftServer;
++import net.minecraft.server.network.ServerCommonPacketListenerImpl;
++// CraftBukkit end
++
+ public class PlayerConnectionUtils {
+
+ private static final Logger LOGGER = LogUtils.getLogger();
+@@ -22,6 +27,7 @@
+ public static <T extends PacketListener> void ensureRunningOnSameThread(Packet<T> packet, T t0, IAsyncTaskHandler<?> iasynctaskhandler) throws CancelledPacketHandleException {
+ if (!iasynctaskhandler.isSameThread()) {
+ iasynctaskhandler.executeIfPossible(() -> {
++ if (MinecraftServer.getServer().hasStopped() || (t0 instanceof ServerCommonPacketListenerImpl && ((ServerCommonPacketListenerImpl) t0).processedDisconnect)) return; // CraftBukkit, MC-142590
+ if (t0.shouldHandleMessage(packet)) {
+ try {
+ packet.handle(t0);
+@@ -60,6 +66,10 @@
+
+ });
+ throw CancelledPacketHandleException.RUNNING_ON_DIFFERENT_THREAD;
++ // CraftBukkit start - SPIGOT-5477, MC-142590
++ } else if (MinecraftServer.getServer().hasStopped() || (t0 instanceof ServerCommonPacketListenerImpl && ((ServerCommonPacketListenerImpl) t0).processedDisconnect)) {
++ throw CancelledPacketHandleException.RUNNING_ON_DIFFERENT_THREAD;
++ // CraftBukkit end
+ }
+ }
+ }