2020-05-06 09:48:49 +00:00
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
2019-05-16 22:27:36 +00:00
From: Spottedleaf <Spottedleaf@users.noreply.github.com>
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.
2019-05-18 05:01:44 +00:00
By reverting his change to MinecraftServer#isMainThread packet
handling that should have been handled synchronously will be handled
2019-05-16 22:27:36 +00:00
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
2020-06-30 05:20:29 +00:00
index a97e6bc15dd07594379475e5dec0fc957ca1314a..b9e047643e1c3f84f26d936fcb067f607018ef34 100644
2019-05-16 22:27:36 +00:00
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
2020-06-30 05:20:29 +00:00
@@ -2065,7 +2065,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
2019-05-16 22:27:36 +00:00
// 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
}
2020-06-25 14:09:55 +00:00
public boolean isDebugging() {
2019-05-16 22:27:36 +00:00
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
2020-06-30 05:20:29 +00:00
index 0fc130c00909a7f779d5f84bc9309b07277940cc..aaca0623cb69b84198b9747c8acf48e60843f300 100644
2019-05-16 22:27:36 +00:00
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
2020-06-27 05:12:11 +00:00
@@ -1781,7 +1781,7 @@ public final class CraftServer implements Server {
2019-05-16 22:27:36 +00:00
@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