Paper/Spigot-Server-Patches/0358-Fix-CraftServer-isPrimaryThread-and-MinecraftServer-.patch
Spottedleaf c29c36e782 Updated Upstream (Bukkit/CraftBukkit/Spigot)
Upstream has released updates that appears to apply and compile correctly.
This update has not been tested by PaperMC and as with ANY update, please do your own testing

Bukkit Changes:
3284612a SPIGOT-5853: Add DragonBattle#generateEndPortal()
e4db04ae SPIGOT-5841: New map colours broken

CraftBukkit Changes:
d4243510 SPIGOT-5853: DragonBattle#getEndPortalLocation() throws NPE on new world
1601ec31 SPIGOT-5845: ChatColor.RESET does not work in ItemMeta to reset italics
4d92db6f CraftChatMessageTest does not need AbstractTestingBase
71045d3d SPIGOT-5828: Unlock worlds on unload
dbc347b9 SPIGOT-5841: New map colours broken
14053c70 SPIGOT-5847: BlockFadeEvent cannot be triggered asynchronously from another thread

Spigot Changes:
6f4ff1b6 SPIGOT-5851: ChatColor (HEX) doesn't appear correctly in the ActionBar
d94a518a SPIGOT-5848: PlayerSpawnLocationEvent throws NPE when setting a location of another world
2020-06-26 22:12:11 -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 cc493d5d8b621bb69aedc5d2c5121d9199074575..19680baafcc8a5a18ec3f58da694372117c7e969 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -2064,7 +2064,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
}
public boolean isDebugging() {
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index b97e8c2a42c608b1798c4a1964111c312a125097..1b591e6450125a0f5f8c79829fb8dea5c3eb8a8e 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -1781,7 +1781,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