3
0
Mirror von https://github.com/PaperMC/Paper.git synchronisiert 2024-11-14 20:10:05 +01:00

Implemented requested changes

Dieser Commit ist enthalten in:
Abel 2024-11-13 15:27:27 +01:00
Ursprung 7344636757
Commit 96b4d3cf54
2 geänderte Dateien mit 8 neuen und 8 gelöschten Zeilen

Datei anzeigen

@ -5,7 +5,7 @@ Subject: [PATCH] API to allow/disallow tick sleeping
diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java
index 0b78564256ebc647ebac402e549d86ab6e307c8d..20eb2607f22fb8bd43af634be1a5691055ce57ac 100644
index 0b78564256ebc647ebac402e549d86ab6e307c8d..79cc122b8329edd24c7378494979114c6a44f4c5 100644
--- a/src/main/java/org/bukkit/Server.java
+++ b/src/main/java/org/bukkit/Server.java
@@ -2572,4 +2572,14 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
@ -19,7 +19,7 @@ index 0b78564256ebc647ebac402e549d86ab6e307c8d..20eb2607f22fb8bd43af634be1a56910
+ * If there isn't any pausing configured, the server will never pause.
+ * @param value Whether to allow sleeping of the server (defaults to true).
+ */
+ void allowSleeping(boolean value);
+ void allowPausing(boolean value);
+ // Paper end - API to allow/disallow tick sleeping
+
}

Datei anzeigen

@ -5,14 +5,14 @@ Subject: [PATCH] API to allow/disallow tick sleeping
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 64b56abf8900d0424100da460fc68ac964394793..28b969c241a4d3c8712c7d463ac43f793f09d94b 100644
index 64b56abf8900d0424100da460fc68ac964394793..e7f94f28efa2df5f4d85ac293bd56f411e8fc623 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -307,6 +307,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
private static final AtomicReference<RuntimeException> fatalException = new AtomicReference();
private final SuppressedExceptionCollector suppressedExceptions;
private final DiscontinuousFrame tickFrame;
+ private static boolean allowPausing = true; // Paper - API to allow/disallow tick sleeping
+ private boolean allowPausing = true; // Paper - API to allow/disallow tick sleeping
// CraftBukkit start
public final WorldLoader.DataLoadContext worldLoader;
@ -31,14 +31,14 @@ index 64b56abf8900d0424100da460fc68ac964394793..28b969c241a4d3c8712c7d463ac43f79
// Paper end - Add tick times API and /mspt command
+
+ // Paper start - API to allow/disallow tick sleeping
+ public static void allowPausing(boolean value) {
+ public void allowPausing(boolean value) {
+ allowPausing = value;
+ }
+ // Paper end - API to allow/disallow tick sleeping
+
}
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index dfddcfb1fe1679adaecf75375757dca720e76ce1..a8e0be7944cedbad3dd1bae4cb20a93878fb8aea 100644
index dfddcfb1fe1679adaecf75375757dca720e76ce1..a1f7d6454494846c269df7010fe98329780fae18 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -3246,4 +3246,12 @@ public final class CraftServer implements Server {
@ -48,8 +48,8 @@ index dfddcfb1fe1679adaecf75375757dca720e76ce1..a8e0be7944cedbad3dd1bae4cb20a938
+
+ // Paper start - API to allow/disallow tick sleeping
+ @Override
+ public void allowSleeping(final boolean value) {
+ MinecraftServer.allowPausing(value);
+ public void allowPausing(final boolean value) {
+ MinecraftServer.getServer().allowPausing(value);
+ }
+ // Paper end - API to allow/disallow tick sleeping
+