Paper/Spigot-Server-Patches/0464-Expose-MinecraftServer-isRunning.patch

26 Zeilen
946 B
Diff

From b8b834494e5bc24038c34e2ad59a46b38a1330fd Mon Sep 17 00:00:00 2001
From: JRoy <joshroy126@gmail.com>
Date: Fri, 10 Apr 2020 21:24:12 -0400
Subject: [PATCH] Expose MinecraftServer#isRunning
This allows for plugins to detect if the server is actually turning off in onDisable rather than just plugins reloading.
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index b9a398bc5..32121e87b 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -2207,5 +2207,10 @@ public final class CraftServer implements Server {
public int getCurrentTick() {
return net.minecraft.server.MinecraftServer.currentTick;
}
+
+ @Override
+ public boolean isStopping() {
+ return !net.minecraft.server.MinecraftServer.getServer().isRunning();
+ }
// Paper end
}
--
2.17.1