Paper/patches/server/0351-Expose-MinecraftServer-isRunning.patch
2023-06-07 15:12:41 -07:00

23 lines
996 B
Diff

From 0000000000000000000000000000000000000000 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 f300e2e446d97a4ef0bc2b8566489a0aaed909d5..7f4ee248bede39701365d200cdc4e39f7bdd8b26 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -2745,5 +2745,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().hasStopped();
+ }
// Paper end
}