geforkt von Mirrors/Paper
45 Zeilen
1.6 KiB
Diff
45 Zeilen
1.6 KiB
Diff
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
|
|
index 3ed3d7eb10f601dcb32e5ca7b053afeb5b0db729..bc4c76eb8b5329b4eeefe62828fed45b8b1c5154 100644
|
|
--- a/src/main/java/org/bukkit/Bukkit.java
|
|
+++ b/src/main/java/org/bukkit/Bukkit.java
|
|
@@ -2173,6 +2173,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 84bcfb8f8220700c0336a378eec41be765db844a..9e459ea23dc480996ebea314e5bc98dd891c020a 100644
|
|
--- a/src/main/java/org/bukkit/Server.java
|
|
+++ b/src/main/java/org/bukkit/Server.java
|
|
@@ -1907,5 +1907,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
|
|
}
|