13
0
geforkt von Mirrors/Paper
Paper/paper-server/nms-patches/net/minecraft/network/protocol/PlayerConnectionUtils.patch
CraftBukkit/Spigot 9da047989c Repackage NMS
By: md_5 <git@md-5.net>
2021-03-16 09:00:00 +11:00

34 Zeilen
1.4 KiB
Diff

--- a/net/minecraft/network/protocol/PlayerConnectionUtils.java
+++ b/net/minecraft/network/protocol/PlayerConnectionUtils.java
@@ -7,6 +7,11 @@
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
+// CraftBukkit start
+import net.minecraft.server.MinecraftServer;
+import net.minecraft.server.network.PlayerConnection;
+// CraftBukkit end
+
public class PlayerConnectionUtils {
private static final Logger LOGGER = LogManager.getLogger();
@@ -18,6 +23,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 {
@@ -26,6 +32,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
}
}
}