mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-30 20:21:51 +01:00
4e958e229f
Co-authored-by: Jake Potrebic <jake.m.potrebic@gmail.com> Co-authored-by: zml <zml@stellardrift.ca> Co-authored-by: Mariell Hoversholm <proximyst@proximyst.com>
43 lines
2.3 KiB
Diff
43 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 c4f1fa6bd54a1928d163d83807f2823029db54e6..83a0dc052683ad2de6843d49d2e2a861d94e8de2 100644
|
|
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
|
|
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
|
|
@@ -2071,7 +2071,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 53c26b5353e1114a63451af1a466978b094cf2dd..1b420307af7c7c6764a93dd659d045f36e6ba3d9 100644
|
|
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
|
@@ -1835,7 +1835,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
|
|
}
|
|
|
|
// Paper start
|