diff options
author | MiniDigger | Martin <[email protected]> | 2024-01-14 11:04:49 +0100 |
---|---|---|
committer | MiniDigger | Martin <[email protected]> | 2024-01-14 11:04:49 +0100 |
commit | bee74680e607c2e29b038329f62181238911cd83 (patch) | |
tree | 708fd1a4a0227d9071243adf2a42d5e9e96cde4a /patch-remap/og/net/minecraft/server/commands/CommandTime.patch | |
parent | 0a44692ef6ff6e255d48eb3ba1bb114166eafda9 (diff) | |
download | Paper-softspoon.tar.gz Paper-softspoon.zip |
add remapped patches as a testsoftspoon
Diffstat (limited to 'patch-remap/og/net/minecraft/server/commands/CommandTime.patch')
-rw-r--r-- | patch-remap/og/net/minecraft/server/commands/CommandTime.patch | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/patch-remap/og/net/minecraft/server/commands/CommandTime.patch b/patch-remap/og/net/minecraft/server/commands/CommandTime.patch new file mode 100644 index 0000000000..8711223f84 --- /dev/null +++ b/patch-remap/og/net/minecraft/server/commands/CommandTime.patch @@ -0,0 +1,56 @@ +--- a/net/minecraft/server/commands/CommandTime.java ++++ b/net/minecraft/server/commands/CommandTime.java +@@ -9,6 +9,11 @@ + import net.minecraft.network.chat.IChatBaseComponent; + import net.minecraft.server.level.WorldServer; + ++// CraftBukkit start ++import org.bukkit.Bukkit; ++import org.bukkit.event.world.TimeSkipEvent; ++// CraftBukkit end ++ + public class CommandTime { + + public CommandTime() {} +@@ -49,12 +54,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(); + +- worldserver.setDayTime((long) i); ++ // CraftBukkit start ++ TimeSkipEvent event = new TimeSkipEvent(worldserver.getWorld(), TimeSkipEvent.SkipReason.COMMAND, i - worldserver.getDayTime()); ++ Bukkit.getPluginManager().callEvent(event); ++ if (!event.isCancelled()) { ++ worldserver.setDayTime((long) worldserver.getDayTime() + event.getSkipAmount()); ++ } ++ // CraftBukkit end + } + + commandlistenerwrapper.sendSuccess(() -> { +@@ -64,12 +75,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(); + +- worldserver.setDayTime(worldserver.getDayTime() + (long) i); ++ // CraftBukkit start ++ TimeSkipEvent event = new TimeSkipEvent(worldserver.getWorld(), TimeSkipEvent.SkipReason.COMMAND, i); ++ Bukkit.getPluginManager().callEvent(event); ++ if (!event.isCancelled()) { ++ worldserver.setDayTime(worldserver.getDayTime() + event.getSkipAmount()); ++ } ++ // CraftBukkit end + } + + int j = getDayTime(commandlistenerwrapper.getLevel()); |