aboutsummaryrefslogtreecommitdiffhomepage
path: root/patch-remap/mache-vineflower-stripped/net/minecraft/server/commands/ScheduleCommand.java.patch
diff options
context:
space:
mode:
Diffstat (limited to 'patch-remap/mache-vineflower-stripped/net/minecraft/server/commands/ScheduleCommand.java.patch')
-rw-r--r--patch-remap/mache-vineflower-stripped/net/minecraft/server/commands/ScheduleCommand.java.patch64
1 files changed, 64 insertions, 0 deletions
diff --git a/patch-remap/mache-vineflower-stripped/net/minecraft/server/commands/ScheduleCommand.java.patch b/patch-remap/mache-vineflower-stripped/net/minecraft/server/commands/ScheduleCommand.java.patch
new file mode 100644
index 0000000000..52ffe0022a
--- /dev/null
+++ b/patch-remap/mache-vineflower-stripped/net/minecraft/server/commands/ScheduleCommand.java.patch
@@ -0,0 +1,64 @@
+--- a/net/minecraft/server/commands/ScheduleCommand.java
++++ b/net/minecraft/server/commands/ScheduleCommand.java
+@@ -98,33 +53,34 @@
+ if (time == 0) {
+ throw ERROR_SAME_TICK.create();
+ } else {
+- long l = source.getLevel().getGameTime() + (long)time;
+- ResourceLocation resourceLocation = function.getFirst();
+- TimerQueue<MinecraftServer> scheduledEvents = source.getServer().getWorldData().overworldData().getScheduledEvents();
+- function.getSecond()
+- .ifLeft(
+- commandFunction -> {
+- String string = resourceLocation.toString();
+- if (append) {
+- scheduledEvents.remove(string);
+- }
+-
+- scheduledEvents.schedule(string, l, new FunctionCallback(resourceLocation));
+- source.sendSuccess(
+- () -> Component.translatable("commands.schedule.created.function", Component.translationArg(resourceLocation), time, l), true
+- );
+- }
+- )
+- .ifRight(functions -> {
+- String string = "#" + resourceLocation;
+- if (append) {
+- scheduledEvents.remove(string);
+- }
+-
+- scheduledEvents.schedule(string, l, new FunctionTagCallback(resourceLocation));
+- source.sendSuccess(() -> Component.translatable("commands.schedule.created.tag", Component.translationArg(resourceLocation), time, l), true);
+- });
+- return Math.floorMod(l, Integer.MAX_VALUE);
++ long j = source.getLevel().getGameTime() + (long) time;
++ ResourceLocation minecraftkey = (ResourceLocation) function.getFirst();
++ TimerQueue<MinecraftServer> customfunctioncallbacktimerqueue = source.getLevel().serverLevelData.overworldData().getScheduledEvents(); // CraftBukkit - SPIGOT-6667: Use world specific function timer
++
++ ((Either) function.getSecond()).ifLeft((net_minecraft_commands_functions_commandfunction) -> {
++ String s = minecraftkey.toString();
++
++ if (append) {
++ customfunctioncallbacktimerqueue.remove(s);
++ }
++
++ customfunctioncallbacktimerqueue.schedule(s, j, new FunctionCallback(minecraftkey));
++ source.sendSuccess(() -> {
++ return Component.translatable("commands.schedule.created.function", Component.translationArg(minecraftkey), time, j);
++ }, true);
++ }).ifRight((collection) -> {
++ String s = "#" + minecraftkey;
++
++ if (append) {
++ customfunctioncallbacktimerqueue.remove(s);
++ }
++
++ customfunctioncallbacktimerqueue.schedule(s, j, new FunctionTagCallback(minecraftkey));
++ source.sendSuccess(() -> {
++ return Component.translatable("commands.schedule.created.tag", Component.translationArg(minecraftkey), time, j);
++ }, true);
++ });
++ return Math.floorMod(j, Integer.MAX_VALUE);
+ }
+ }
+