3
0
Mirror von https://github.com/PaperMC/Paper.git synchronisiert 2024-12-15 11:00:06 +01:00
Paper/patches/api/0192-Expose-MinecraftServer-isRunning.patch
2021-12-20 22:46:51 +00:00

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 c277b48d45c7aab3b727a7019b3ef253e045629d..c043e6798314e322e32a1c8e8ef6a795e022b858 100644
--- a/src/main/java/org/bukkit/Bukkit.java
+++ b/src/main/java/org/bukkit/Bukkit.java
@@ -2055,6 +2055,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 38febebef94652a9e44475560974d6e8d6949db0..ad940c5d327c7e1e09aea7d2cee27a8abcf3fed7 100644
--- a/src/main/java/org/bukkit/Server.java
+++ b/src/main/java/org/bukkit/Server.java
@@ -1801,5 +1801,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
}