diff --git a/Spigot-Server-Patches/Fix-CraftServer-isPrimaryThread-and-MinecraftServer-.patch b/Spigot-Server-Patches/Fix-CraftServer-isPrimaryThread-and-MinecraftServer-.patch new file mode 100644 index 0000000000..eddf4b365a --- /dev/null +++ b/Spigot-Server-Patches/Fix-CraftServer-isPrimaryThread-and-MinecraftServer-.patch @@ -0,0 +1,44 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Spottedleaf +Date: Mon, 13 May 2019 21:10:59 -0700 +Subject: [PATCH] Fix CraftServer#isPrimaryThread and MinecraftServer + isMainThread + +md_5 changed it so he could shut down the server asynchronously +from watchdog, although we have patches that prevent that type +of behavior for this exact reason. + +md_5 also placed code in PlayerConnectionUtils that would have +solved https://bugs.mojang.com/browse/MC-142590, making the change +to MinecraftServer#isMainThread irrelevant. +By reverting his change to MinecraftServer#isMainThread packet +handling that should have been handled synchronously will be handled +synchronously when the server gets shut down. + +diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java +index 70f730996c..73ac45bf7a 100644 +--- a/src/main/java/net/minecraft/server/MinecraftServer.java ++++ b/src/main/java/net/minecraft/server/MinecraftServer.java +@@ -0,0 +0,0 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant -Date: Mon, 13 May 2019 21:10:59 -0700 -Subject: [PATCH] Fix CraftServer#isPrimaryThread - -md_5 changed it so he could shut down the server asynchronously -from watchdog, although we have patches that prevent that type -of behavior for this exact reason. - -diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index 56e8a613e9..22d53844c5 100644 ---- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java -+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -@@ -0,0 +0,0 @@ public final class CraftServer implements Server { - - @Override - public boolean isPrimaryThread() { -- return Thread.currentThread().equals(console.serverThread) || console.hasStopped() || !org.spigotmc.AsyncCatcher.enabled; // All bets are off if we have shut down (e.g. due to watchdog) -+ return Thread.currentThread().equals(console.serverThread); // Paper - Fix issues with detecting main thread properly - } - - @Override --- \ No newline at end of file