aboutsummaryrefslogtreecommitdiffhomepage
path: root/patches/server/0323-Expose-MinecraftServer-isRunning.patch
blob: 1f82adb8b4d27e741ade245b5b4ef53fcc513333 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
From 0000000000000000000000000000000000000000 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 ff6bac3e53795c427719900428a56a0e505f6ec2..c40331c2be3a3cfb156c3faa5f6a9fd3cb237077 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -2950,5 +2950,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().hasStopped();
+    }
     // Paper end
 }