Paper/patches/server/0327-Fix-CraftServer-isPrimaryThread-and-MinecraftServer-.patch
Jason Penilla 8291fff4ac
Updated Upstream (CraftBukkit/Spigot)
Upstream has released updates that appear to apply and compile correctly.
This update has not been tested by PaperMC and as with ANY update, please do your own testing

CraftBukkit Changes:
f992ce60 Fix duplicate datapack reload on /reload

Spigot Changes:
9472b09d Rebuild patches
2021-06-15 01:38:57 -07:00

44 lines
2.3 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
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.
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 eb103c15218c334b9f85a57e30582e9efb188704..c8a59de4673d430fc8ec2e53315f107293122e7e 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -2262,7 +2262,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
// CraftBukkit start
@Override
public boolean isSameThread() {
- return super.isSameThread() || this.isStopped(); // CraftBukkit - MC-142590
+ return super.isSameThread() /*|| this.isStopped()*/; // CraftBukkit - MC-142590 // Paper - causes issues elsewhere
}
public boolean isDebugging() {
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index d9bfaff4880de1254a72869562b4c42aa29146f1..334ea92dd16bf325961afd92e835e63163cbcecb 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -1839,7 +1839,7 @@ public final class CraftServer implements Server {
@Override
public boolean isPrimaryThread() {
- return Thread.currentThread().equals(console.serverThread) || this.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
}
// Paper start