2021-03-15 23:00:00 +01:00
|
|
|
--- 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();
|
2021-06-11 07:00:00 +02:00
|
|
|
@@ -20,6 +25,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 {
|
2019-02-03 04:23:04 +01:00
|
|
|
if (!iasynctaskhandler.isMainThread()) {
|
2019-04-23 04:00:00 +02:00
|
|
|
iasynctaskhandler.execute(() -> {
|
2019-05-05 01:25:51 +02:00
|
|
|
+ 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 {
|
2021-06-11 07:00:00 +02:00
|
|
|
@@ -28,6 +34,10 @@
|
2021-01-31 00:08:41 +01:00
|
|
|
|
2020-01-12 00:50:22 +01:00
|
|
|
});
|
2021-06-11 07:00:00 +02:00
|
|
|
throw CancelledPacketHandleException.RUNNING_ON_DIFFERENT_THREAD;
|
2021-01-31 00:08:41 +01:00
|
|
|
+ // CraftBukkit start - SPIGOT-5477, MC-142590
|
|
|
|
+ } else if (MinecraftServer.getServer().hasStopped() || (t0 instanceof PlayerConnection && ((PlayerConnection) t0).processedDisconnect)) {
|
2021-06-11 07:00:00 +02:00
|
|
|
+ throw CancelledPacketHandleException.RUNNING_ON_DIFFERENT_THREAD;
|
2021-01-31 00:08:41 +01:00
|
|
|
+ // CraftBukkit end
|
|
|
|
}
|
2020-01-12 00:50:22 +01:00
|
|
|
}
|
|
|
|
}
|