Paper/patches/api/0191-Expose-MinecraftServer-isRunning.patch

45 Zeilen
1.6 KiB
Diff

2021-06-11 14:02:28 +02:00
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
2022-06-08 18:13:02 +02:00
index 3b60fa65686572fdd8fab22cd131ca5cfe5274c8..3455de478517a91285bb9d1b306ce1c4be619389 100644
2021-06-11 14:02:28 +02:00
--- a/src/main/java/org/bukkit/Bukkit.java
+++ b/src/main/java/org/bukkit/Bukkit.java
2022-06-08 18:13:02 +02:00
@@ -2238,6 +2238,15 @@ public final class Bukkit {
2021-06-11 14:02:28 +02:00
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
2022-06-09 23:11:43 +02:00
index b549cb954e4fb4e37277303911d174bedd0ee27d..8895de971276bc8027c9f02dee41f002dfcb8770 100644
2021-06-11 14:02:28 +02:00
--- a/src/main/java/org/bukkit/Server.java
+++ b/src/main/java/org/bukkit/Server.java
2022-06-09 23:11:43 +02:00
@@ -1959,5 +1959,12 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
2021-06-11 14:02:28 +02:00
* @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
}