2024-11-22 12:22:20 +01:00
|
|
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
|
|
From: Abel <abelvanhulst@gmail.com>
|
|
|
|
Date: Sun, 10 Nov 2024 16:32:34 +0100
|
|
|
|
Subject: [PATCH] API to check if the server is sleeping
|
|
|
|
|
|
|
|
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
|
2024-12-05 11:18:29 +01:00
|
|
|
index b3980a33470646f530e289f9b83509d3aa952720..1c5a439650146bee85a98d8072ee131300264eee 100644
|
2024-11-22 12:22:20 +01:00
|
|
|
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
|
|
|
|
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
|
2024-12-05 11:18:29 +01:00
|
|
|
@@ -3026,4 +3026,10 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
2024-11-22 12:22:20 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
// Paper end - Add tick times API and /mspt command
|
|
|
|
+
|
|
|
|
+ // Paper start - API to check if the server is sleeping
|
|
|
|
+ public boolean isTickPaused() {
|
|
|
|
+ return this.emptyTicks > 0 && this.emptyTicks >= this.pauseWhileEmptySeconds() * 20;
|
|
|
|
+ }
|
|
|
|
+ // Paper end - API to check if the server is sleeping
|
|
|
|
}
|
|
|
|
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
2024-12-05 11:18:29 +01:00
|
|
|
index 918072dd3f1308d9dc680754052317eb00789762..df9cfdcc27d6f596d554d7271b1d6a30cd3fbc0e 100644
|
2024-11-22 12:22:20 +01:00
|
|
|
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
|
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
2024-11-25 19:43:28 +01:00
|
|
|
@@ -3258,4 +3258,11 @@ public final class CraftServer implements Server {
|
2024-11-22 12:22:20 +01:00
|
|
|
return this.potionBrewer;
|
|
|
|
}
|
|
|
|
// Paper end
|
|
|
|
+
|
|
|
|
+ // Paper start - API to check if the server is sleeping
|
|
|
|
+ @Override
|
|
|
|
+ public boolean isPaused() {
|
|
|
|
+ return this.console.isTickPaused();
|
|
|
|
+ }
|
|
|
|
+ // Paper end - API to check if the server is sleeping
|
|
|
|
}
|