mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-30 16:19:03 +01:00
37 lines
1.6 KiB
Diff
37 lines
1.6 KiB
Diff
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
|
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
|
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
|
|
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
|
|
@@ -0,0 +0,0 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
|
}
|
|
}
|
|
// 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
|
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 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 {
|
|
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
|
|
}
|