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

26 lines
948 B
Diff
Raw Normal View History

From 54f024d408679baaaaad219aeb853145ca144554 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 53b71b7915..1a3c6aae18 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -2217,5 +2217,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.25.1