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 61ed19059b491321c3887a20e50371c81dbe6912..591719ae6330517885c40a00f3ba9906fa9fa796 100644
|
|
--- a/src/main/java/org/bukkit/Bukkit.java
|
|
+++ b/src/main/java/org/bukkit/Bukkit.java
|
|
@@ -1989,6 +1989,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 842bdf9b083eda9c64f41f1df99bf4f1c03fb0fa..5c83da4c929f7f7b8cef19e84929531279f7c4c9 100644
|
|
--- a/src/main/java/org/bukkit/Server.java
|
|
+++ b/src/main/java/org/bukkit/Server.java
|
|
@@ -1747,5 +1747,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
|
|
}
|