aboutsummaryrefslogtreecommitdiffhomepage
path: root/patches/server/0321-Expose-MinecraftServer-isRunning.patch
blob: 7a4ecb699ae5a14f74981ed64db6a07687bacd93 (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 1b80d12515141fb6a6b33475a086d85d437e60a5..e9391811dc6ff954bdf1854e1e33e96931bcd2ac 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -2960,5 +2960,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
 }