Mirror von
https://github.com/PaperMC/Paper.git
synchronisiert 2024-11-15 04:20:04 +01:00
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 1a66d6314765840f529900a850265ed20173fd9b..4e8383432a3a8a07dbc31f77986b0f4790779f7d 100644
|
|
--- a/src/main/java/org/bukkit/Bukkit.java
|
|
+++ b/src/main/java/org/bukkit/Bukkit.java
|
|
@@ -2462,6 +2462,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 88bb506880fa019881e95a2cc07915841c2028e7..37caeff1416cf0e3c63260ba7ad82a92e95a5399 100644
|
|
--- a/src/main/java/org/bukkit/Server.java
|
|
+++ b/src/main/java/org/bukkit/Server.java
|
|
@@ -2147,5 +2147,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
|
|
}
|