From 0faa21078101f5d0c7a9c57ce2f9f2dcaa8e8ae8 Mon Sep 17 00:00:00 2001 From: Jake Potrebic Date: Mon, 4 Jan 2021 19:52:44 -0800 Subject: [PATCH] Make schedule command per-world --- .../server/commands/ScheduleCommand.java.patch | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/paper-server/patches/sources/net/minecraft/server/commands/ScheduleCommand.java.patch b/paper-server/patches/sources/net/minecraft/server/commands/ScheduleCommand.java.patch index 686b6c5886..885d99adba 100644 --- a/paper-server/patches/sources/net/minecraft/server/commands/ScheduleCommand.java.patch +++ b/paper-server/patches/sources/net/minecraft/server/commands/ScheduleCommand.java.patch @@ -1,5 +1,14 @@ --- a/net/minecraft/server/commands/ScheduleCommand.java +++ b/net/minecraft/server/commands/ScheduleCommand.java +@@ -33,7 +33,7 @@ + }); + private static final SimpleCommandExceptionType ERROR_MACRO = new SimpleCommandExceptionType(Component.translatableEscape("commands.schedule.macro")); + private static final SuggestionProvider SUGGEST_SCHEDULE = (commandcontext, suggestionsbuilder) -> { +- return SharedSuggestionProvider.suggest((Iterable) ((CommandSourceStack) commandcontext.getSource()).getServer().getWorldData().overworldData().getScheduledEvents().getEventsIds(), suggestionsbuilder); ++ return SharedSuggestionProvider.suggest((Iterable) ((net.minecraft.commands.CommandSourceStack) commandcontext.getSource()).getLevel().serverLevelData.getScheduledEvents().getEventsIds(), suggestionsbuilder); // Paper - Make schedule command per-world + }; + + public ScheduleCommand() {} @@ -58,7 +58,7 @@ } else { long j = source.getLevel().getGameTime() + (long) time; @@ -9,3 +18,12 @@ Optional> optional = ((Either) function.getSecond()).left(); String s; +@@ -93,7 +93,7 @@ + } + + private static int remove(CommandSourceStack source, String eventName) throws CommandSyntaxException { +- int i = source.getServer().getWorldData().overworldData().getScheduledEvents().remove(eventName); ++ int i = source.getLevel().serverLevelData.getScheduledEvents().remove(eventName); // Paper - Make schedule command per-world + + if (i == 0) { + throw ScheduleCommand.ERROR_CANT_REMOVE.create(eventName);