38 Zeilen
2.5 KiB
Diff
38 Zeilen
2.5 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: Jake Potrebic <jake.m.potrebic@gmail.com>
|
|
Date: Mon, 4 Jan 2021 19:52:44 -0800
|
|
Subject: [PATCH] Make schedule command per-world
|
|
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/commands/ScheduleCommand.java b/src/main/java/net/minecraft/server/commands/ScheduleCommand.java
|
|
index 122a790285734ecd95fe6817043a84cf1752dbe8..173ab97b01b2191d9d731a28f2690eb4f539880b 100644
|
|
--- a/src/main/java/net/minecraft/server/commands/ScheduleCommand.java
|
|
+++ b/src/main/java/net/minecraft/server/commands/ScheduleCommand.java
|
|
@@ -32,7 +32,7 @@ public class ScheduleCommand {
|
|
return new TranslatableComponent("commands.schedule.cleared.failure", new Object[]{object});
|
|
});
|
|
private static final SuggestionProvider<CommandSourceStack> SUGGEST_SCHEDULE = (commandcontext, suggestionsbuilder) -> {
|
|
- return SharedSuggestionProvider.suggest((Iterable) ((CommandSourceStack) commandcontext.getSource()).getServer().getWorldData().overworldData().getScheduledEvents().getEventsIds(), suggestionsbuilder);
|
|
+ return SharedSuggestionProvider.suggest((Iterable) ((CommandSourceStack) commandcontext.getSource()).getLevel().worldDataServer.overworldData().getScheduledEvents().getEventsIds(), suggestionsbuilder); // Paper
|
|
};
|
|
|
|
public static void register(CommandDispatcher<CommandSourceStack> dispatcher) {
|
|
@@ -55,7 +55,7 @@ public class ScheduleCommand {
|
|
} else {
|
|
long j = source.getLevel().getGameTime() + (long) i;
|
|
ResourceLocation minecraftkey = (ResourceLocation) pair.getFirst();
|
|
- TimerQueue<MinecraftServer> customfunctioncallbacktimerqueue = source.getServer().getWorldData().overworldData().getScheduledEvents();
|
|
+ TimerQueue<MinecraftServer> customfunctioncallbacktimerqueue = source.getLevel().worldDataServer.overworldData().getScheduledEvents(); // Paper
|
|
|
|
((Either) pair.getSecond()).ifLeft((customfunction) -> {
|
|
String s = minecraftkey.toString();
|
|
@@ -81,7 +81,7 @@ public class ScheduleCommand {
|
|
}
|
|
|
|
private static int remove(CommandSourceStack commandlistenerwrapper, String s) throws CommandSyntaxException {
|
|
- int i = commandlistenerwrapper.getServer().getWorldData().overworldData().getScheduledEvents().remove(s);
|
|
+ int i = commandlistenerwrapper.getLevel().worldDataServer.overworldData().getScheduledEvents().remove(s); // Paper
|
|
|
|
if (i == 0) {
|
|
throw ScheduleCommand.ERROR_CANT_REMOVE.create(s);
|