mirror of
https://github.com/PaperMC/Paper.git
synced 2025-05-19 13:40:24 -07:00
Add API MinecraftServer#isStopping (#3129)
This commit is contained in:
parent
de4c48dac9
commit
4042fd2067
@ -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>
|
||||||
|
Josh Roy <10731363+JRoy@users.noreply.github.com>
|
||||||
Robert Norman <spottedleaf@spottedleaf.dev>, <Spottedleaf@users.noreply.github.com>
|
Robert Norman <spottedleaf@spottedleaf.dev>, <Spottedleaf@users.noreply.github.com>
|
||||||
```
|
```
|
||||||
|
45
Spigot-API-Patches/Expose-MinecraftServer-isRunning.patch
Normal file
45
Spigot-API-Patches/Expose-MinecraftServer-isRunning.patch
Normal file
@ -0,0 +1,45 @@
|
|||||||
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Josh Roy <10731363+JRoy@users.noreply.github.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
|
||||||
|
@@ -0,0 +0,0 @@ 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
|
||||||
|
@@ -0,0 +0,0 @@ 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
|
||||||
|
}
|
||||||
|
--
|
23
Spigot-Server-Patches/Expose-MinecraftServer-isRunning.patch
Normal file
23
Spigot-Server-Patches/Expose-MinecraftServer-isRunning.patch
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Josh Roy <10731363+JRoy@users.noreply.github.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
|
||||||
|
@@ -0,0 +0,0 @@ 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
|
||||||
|
}
|
||||||
|
--
|
Loading…
x
Reference in New Issue
Block a user