Paper/Spigot-API-Patches/0193-Expose-MinecraftServer-isRunning.patch

45 lines
1.6 KiB
Diff
Raw Normal View History

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: JRoy <joshroy126@gmail.com>
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
2020-06-26 18:20:03 +02:00
index eb2fb4cdc4e7585017acfce0198bb0746d2255cc..600334831293793840511992048c43bff1febc24 100644
--- a/src/main/java/org/bukkit/Bukkit.java
+++ b/src/main/java/org/bukkit/Bukkit.java
2020-06-26 18:20:03 +02:00
@@ -1712,6 +1712,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
2020-06-26 18:20:03 +02:00
index 8cb38856d85e9239a132234fdc6af88f3adfe5b7..f44a582e954625a12b19d4e142865e5d3154edd5 100644
--- a/src/main/java/org/bukkit/Server.java
+++ b/src/main/java/org/bukkit/Server.java
2020-06-26 18:20:03 +02:00
@@ -1498,5 +1498,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
}