1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
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);
}
}
|