aboutsummaryrefslogtreecommitdiffhomepage
path: root/patches/server/0328-Expose-MinecraftServer-isRunning.patch
blob: f31f5711dfe7cf55a4c9cdf8e3440fe3c8dbd693 (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 a6564ddf47d50b618627680a55b6546bf6d9eab9..6707e213d9bd2b173928b1e9dae87c403342953b 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -2933,5 +2933,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
 }