From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: JRoy Date: Fri, 10 Apr 2020 21:24:35 -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/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java index d715a069a8cfc8704471f254f421bb7baeb498f4..e54ba870293676f16fabac5b91ffd7202d3a17e0 100644 --- a/src/main/java/org/bukkit/Bukkit.java +++ b/src/main/java/org/bukkit/Bukkit.java @@ -2386,6 +2386,15 @@ public final class Bukkit { public static int getCurrentTick() { return server.getCurrentTick(); } + + /** + * Checks if the server is in the process of being shutdown. + * + * @return true if server is in the process of being shutdown + */ + public static boolean isStopping() { + return server.isStopping(); + } // Paper end @NotNull diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java index e00d4860ba9ac19014995e85fccea659793f67e7..e4d7c0a3c36a34ef5bdb728d52cf0c4f2aa3ef77 100644 --- a/src/main/java/org/bukkit/Server.java +++ b/src/main/java/org/bukkit/Server.java @@ -2078,5 +2078,12 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi * @return Current tick */ int getCurrentTick(); + + /** + * Checks if the server is in the process of being shutdown. + * + * @return true if server is in the process of being shutdown + */ + boolean isStopping(); // Paper end }