SPIGOT-6496: /time functions affect entire server, not just the origin world

By: DerFrZocker <derrieple@gmail.com>
This commit is contained in:
CraftBukkit/Spigot 2022-01-03 08:29:31 +11:00
parent c0b8deb846
commit cc34358a3e

View File

@ -12,7 +12,13 @@
public class CommandTime {
public CommandTime() {}
@@ -52,7 +57,13 @@
@@ -47,12 +52,18 @@
}
public static int setTime(CommandListenerWrapper commandlistenerwrapper, int i) {
- Iterator iterator = commandlistenerwrapper.getServer().getAllLevels().iterator();
+ Iterator iterator = com.google.common.collect.Iterators.singletonIterator(commandlistenerwrapper.getLevel()); // CraftBukkit - SPIGOT-6496: Only set the time for the world the command originates in
while (iterator.hasNext()) {
WorldServer worldserver = (WorldServer) iterator.next();
@ -27,7 +33,13 @@
}
commandlistenerwrapper.sendSuccess(new ChatMessage("commands.time.set", new Object[]{i}), true);
@@ -65,7 +76,13 @@
@@ -60,12 +71,18 @@
}
public static int addTime(CommandListenerWrapper commandlistenerwrapper, int i) {
- Iterator iterator = commandlistenerwrapper.getServer().getAllLevels().iterator();
+ Iterator iterator = com.google.common.collect.Iterators.singletonIterator(commandlistenerwrapper.getLevel()); // CraftBukkit - SPIGOT-6496: Only set the time for the world the command originates in
while (iterator.hasNext()) {
WorldServer worldserver = (WorldServer) iterator.next();