3
0
Mirror von https://github.com/PaperMC/Paper.git synchronisiert 2024-11-15 04:20:04 +01:00

Add API MinecraftServer#isStopping (#3129)

Dieser Commit ist enthalten in:
Josh Roy 2020-04-11 01:51:35 -04:00 committet von GitHub
Ursprung 942ff3c28e
Commit 11de41c777
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 4AEE18F83AFDEB23
3 geänderte Dateien mit 73 neuen und 0 gelöschten Zeilen

Datei anzeigen

@ -40,5 +40,6 @@ MicleBrick <miclebrick@outlook.com>
Trigary <trigary0@gmail.com> Trigary <trigary0@gmail.com>
rickyboy320 <rickw320@hotmail.com> rickyboy320 <rickw320@hotmail.com>
DoNotSpamPls <7570108+DoNotSpamPls@users.noreply.github.com> DoNotSpamPls <7570108+DoNotSpamPls@users.noreply.github.com>
JRoy <joshroy126@gmail.com>
Robert Norman <spottedleaf@spottedleaf.dev>, <Spottedleaf@users.noreply.github.com> Robert Norman <spottedleaf@spottedleaf.dev>, <Spottedleaf@users.noreply.github.com>
``` ```

Datei anzeigen

@ -0,0 +1,47 @@
From 4cafe0ab6318dce5b1775e57728b433bf581267d 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 b9973406..dda12412 100644
--- a/src/main/java/org/bukkit/Bukkit.java
+++ b/src/main/java/org/bukkit/Bukkit.java
@@ -1661,6 +1661,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 80f9abdc..5758ae79 100644
--- a/src/main/java/org/bukkit/Server.java
+++ b/src/main/java/org/bukkit/Server.java
@@ -1455,5 +1455,12 @@ public interface Server extends PluginMessageRecipient {
* @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
}
--
2.17.1

Datei anzeigen

@ -0,0 +1,25 @@
From b8b834494e5bc24038c34e2ad59a46b38a1330fd Mon Sep 17 00:00:00 2001
From: JRoy <joshroy126@gmail.com>
Date: Fri, 10 Apr 2020 21:24:12 -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/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index b9a398bc5..32121e87b 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -2207,5 +2207,10 @@ public final class CraftServer implements Server {
public int getCurrentTick() {
return net.minecraft.server.MinecraftServer.currentTick;
}
+
+ @Override
+ public boolean isStopping() {
+ return !net.minecraft.server.MinecraftServer.getServer().isRunning();
+ }
// Paper end
}
--
2.17.1