From 999bd6c0efa38ebb1a3913d118b37188fe651796 Mon Sep 17 00:00:00 2001 From: CraftBukkit/Spigot Date: Fri, 23 Jul 2021 16:29:04 +1000 Subject: [PATCH] SPIGOT-6667: /schedule function not working correctly in other dimensions By: DerFrZocker --- .../server/commands/CommandSchedule.patch | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 paper-server/nms-patches/net/minecraft/server/commands/CommandSchedule.patch diff --git a/paper-server/nms-patches/net/minecraft/server/commands/CommandSchedule.patch b/paper-server/nms-patches/net/minecraft/server/commands/CommandSchedule.patch new file mode 100644 index 0000000000..d7fa2e2b65 --- /dev/null +++ b/paper-server/nms-patches/net/minecraft/server/commands/CommandSchedule.patch @@ -0,0 +1,20 @@ +--- a/net/minecraft/server/commands/CommandSchedule.java ++++ b/net/minecraft/server/commands/CommandSchedule.java +@@ -57,7 +57,7 @@ + } else { + long j = commandlistenerwrapper.getWorld().getTime() + (long) i; + MinecraftKey minecraftkey = (MinecraftKey) pair.getFirst(); +- CustomFunctionCallbackTimerQueue customfunctioncallbacktimerqueue = commandlistenerwrapper.getServer().getSaveData().H().u(); ++ CustomFunctionCallbackTimerQueue customfunctioncallbacktimerqueue = commandlistenerwrapper.getWorld().serverLevelData.H().u(); // CraftBukkit - SPIGOT-6667: Use world specific function timer + + ((Either) pair.getSecond()).ifLeft((customfunction) -> { + String s = minecraftkey.toString(); +@@ -78,7 +78,7 @@ + customfunctioncallbacktimerqueue.a(s, j, new CustomFunctionCallbackTag(minecraftkey)); + commandlistenerwrapper.sendMessage(new ChatMessage("commands.schedule.created.tag", new Object[]{minecraftkey, i, j}), true); + }); +- return Math.floorMod(j, Integer.MAX_VALUE); ++ return (int) Math.floorMod(j, (long) Integer.MAX_VALUE); // CraftBukkit - Downgrade to Java 8 method + } + } +