aboutsummaryrefslogtreecommitdiffhomepage
path: root/patches/server/0834-Add-config-option-for-worlds-affected-by-time-cmd.patch
diff options
context:
space:
mode:
Diffstat (limited to 'patches/server/0834-Add-config-option-for-worlds-affected-by-time-cmd.patch')
-rw-r--r--patches/server/0834-Add-config-option-for-worlds-affected-by-time-cmd.patch42
1 files changed, 42 insertions, 0 deletions
diff --git a/patches/server/0834-Add-config-option-for-worlds-affected-by-time-cmd.patch b/patches/server/0834-Add-config-option-for-worlds-affected-by-time-cmd.patch
new file mode 100644
index 0000000000..1b17c599e7
--- /dev/null
+++ b/patches/server/0834-Add-config-option-for-worlds-affected-by-time-cmd.patch
@@ -0,0 +1,42 @@
+From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
+From: Jake Potrebic <[email protected]>
+Date: Sun, 2 Jan 2022 22:34:51 -0800
+Subject: [PATCH] Add config option for worlds affected by time cmd
+
+
+diff --git a/src/main/java/com/destroystokyo/paper/PaperConfig.java b/src/main/java/com/destroystokyo/paper/PaperConfig.java
+index 3703e10fe8e33f3d65a38f91b28669de5bc40a5a..432db841f4b25ab219078501942bcfb586645be1 100644
+--- a/src/main/java/com/destroystokyo/paper/PaperConfig.java
++++ b/src/main/java/com/destroystokyo/paper/PaperConfig.java
+@@ -647,4 +647,9 @@ public class PaperConfig {
+ private static void sendFullPosForHardCollidingEntities() {
+ sendFullPosForHardCollidingEntities = getBoolean("settings.send-full-pos-for-hard-colliding-entities", true);
+ }
++
++ public static boolean timeCommandAffectsAllWorlds = false; // See https://hub.spigotmc.org/stash/projects/SPIGOT/repos/craftbukkit/commits/aeaeb359317e6ba25b7c45cf6d70ff945a3777cf
++ private static void timeCommandAffectsAllWorlds() {
++ timeCommandAffectsAllWorlds = getBoolean("settings.time-command-affects-all-worlds", timeCommandAffectsAllWorlds);
++ }
+ }
+diff --git a/src/main/java/net/minecraft/server/commands/TimeCommand.java b/src/main/java/net/minecraft/server/commands/TimeCommand.java
+index ad4860bf64979e6b10bc6aecc4ac67a5c069e030..da854c5bfaf9e791b272a497caf864748f3dfbda 100644
+--- a/src/main/java/net/minecraft/server/commands/TimeCommand.java
++++ b/src/main/java/net/minecraft/server/commands/TimeCommand.java
+@@ -51,7 +51,7 @@ public class TimeCommand {
+ }
+
+ public static int setTime(CommandSourceStack source, int time) {
+- Iterator iterator = com.google.common.collect.Iterators.singletonIterator(source.getLevel()); // CraftBukkit - SPIGOT-6496: Only set the time for the world the command originates in
++ Iterator iterator = com.destroystokyo.paper.PaperConfig.timeCommandAffectsAllWorlds ? source.getServer().getAllLevels().iterator() : com.google.common.collect.Iterators.singletonIterator(source.getLevel()); // CraftBukkit - SPIGOT-6496: Only set the time for the world the command originates in // Paper - add config option for spigot's change
+
+ while (iterator.hasNext()) {
+ ServerLevel worldserver = (ServerLevel) iterator.next();
+@@ -70,7 +70,7 @@ public class TimeCommand {
+ }
+
+ public static int addTime(CommandSourceStack source, int time) {
+- Iterator iterator = com.google.common.collect.Iterators.singletonIterator(source.getLevel()); // CraftBukkit - SPIGOT-6496: Only set the time for the world the command originates in
++ Iterator iterator = com.destroystokyo.paper.PaperConfig.timeCommandAffectsAllWorlds ? source.getServer().getAllLevels().iterator() : com.google.common.collect.Iterators.singletonIterator(source.getLevel()); // CraftBukkit - SPIGOT-6496: Only set the time for the world the command originates in // Paper - add config option for spigot's change
+
+ while (iterator.hasNext()) {
+ ServerLevel worldserver = (ServerLevel) iterator.next();