Paper/nms-patches/PlayerConnectionUtils.patch

22 lines
1.1 KiB
Diff
Raw Normal View History

--- a/net/minecraft/server/PlayerConnectionUtils.java
+++ b/net/minecraft/server/PlayerConnectionUtils.java
2019-07-20 01:00:00 +02:00
@@ -14,6 +14,7 @@
2019-04-23 04:00:00 +02:00
public static <T extends PacketListener> void ensureMainThread(Packet<T> packet, T t0, IAsyncTaskHandler<?> iasynctaskhandler) throws CancelledPacketHandleException {
if (!iasynctaskhandler.isMainThread()) {
2019-04-23 04:00:00 +02:00
iasynctaskhandler.execute(() -> {
+ if (MinecraftServer.getServer().hasStopped() || (t0 instanceof PlayerConnection && ((PlayerConnection) t0).processedDisconnect)) return; // CraftBukkit, MC-142590
2019-07-20 01:00:00 +02:00
if (t0.a().isConnected()) {
packet.a(t0);
} else {
2020-01-12 00:50:22 +01:00
@@ -23,5 +24,10 @@
});
throw CancelledPacketHandleException.INSTANCE;
}
+ // CraftBukkit start - SPIGOT-5477, MC-142590
+ else if (MinecraftServer.getServer().hasStopped() || (t0 instanceof PlayerConnection && ((PlayerConnection) t0).processedDisconnect)) {
+ throw CancelledPacketHandleException.INSTANCE;
+ }
+ // CraftBukkit end
}
}