PaperMC/paper-server/nms-patches/PlayerConnectionUtils.patch
CraftBukkit/Spigot 04c4f1b337 Add more checkstyle checks
By: md_5 <git@md-5.net>
2021-01-31 10:08:41 +11:00

21 lines
1.1 KiB
Diff

--- a/net/minecraft/server/PlayerConnectionUtils.java
+++ b/net/minecraft/server/PlayerConnectionUtils.java
@@ -14,6 +14,7 @@
public static <T extends PacketListener> void ensureMainThread(Packet<T> packet, T t0, IAsyncTaskHandler<?> iasynctaskhandler) throws CancelledPacketHandleException {
if (!iasynctaskhandler.isMainThread()) {
iasynctaskhandler.execute(() -> {
+ if (MinecraftServer.getServer().hasStopped() || (t0 instanceof PlayerConnection && ((PlayerConnection) t0).processedDisconnect)) return; // CraftBukkit, MC-142590
if (t0.a().isConnected()) {
packet.a(t0);
} else {
@@ -22,6 +23,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
}
}
}