From 4cafe0ab6318dce5b1775e57728b433bf581267d 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 b9973406..dda12412 100644 --- a/src/main/java/org/bukkit/Bukkit.java +++ b/src/main/java/org/bukkit/Bukkit.java @@ -1661,6 +1661,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 80f9abdc..5758ae79 100644 --- a/src/main/java/org/bukkit/Server.java +++ b/src/main/java/org/bukkit/Server.java @@ -1455,5 +1455,12 @@ public interface Server extends PluginMessageRecipient { * @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 } -- 2.17.1