aboutsummaryrefslogtreecommitdiffhomepage
path: root/Spigot-Server-Patches/0381-Fix-CraftServer-isPrimaryThread-and-MinecraftServer-.patch
diff options
context:
space:
mode:
Diffstat (limited to 'Spigot-Server-Patches/0381-Fix-CraftServer-isPrimaryThread-and-MinecraftServer-.patch')
-rw-r--r--Spigot-Server-Patches/0381-Fix-CraftServer-isPrimaryThread-and-MinecraftServer-.patch46
1 files changed, 46 insertions, 0 deletions
diff --git a/Spigot-Server-Patches/0381-Fix-CraftServer-isPrimaryThread-and-MinecraftServer-.patch b/Spigot-Server-Patches/0381-Fix-CraftServer-isPrimaryThread-and-MinecraftServer-.patch
new file mode 100644
index 0000000000..8e6a75aad4
--- /dev/null
+++ b/Spigot-Server-Patches/0381-Fix-CraftServer-isPrimaryThread-and-MinecraftServer-.patch
@@ -0,0 +1,46 @@
+From 3de070a84f4e03c4f82c2538e87c3ac3c7da769a Mon Sep 17 00:00:00 2001
+From: Spottedleaf <[email protected]>
+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 35c5d38c2..c70ab3caf 100644
+--- a/src/main/java/net/minecraft/server/MinecraftServer.java
++++ b/src/main/java/net/minecraft/server/MinecraftServer.java
+@@ -2154,7 +2154,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
+ // CraftBukkit start
+ @Override
+ public boolean isMainThread() {
+- return super.isMainThread() || this.isStopped(); // CraftBukkit - MC-142590
++ return super.isMainThread() /*|| this.isStopped()*/; // CraftBukkit - MC-142590 // Paper - causes issues elsewhere
+ }
+
+ @Deprecated
+diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+index b89486beb..7a8ab7d40 100644
+--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
++++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+@@ -1664,7 +1664,7 @@ 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
+--
+2.23.0
+