Make schedule command per-world

This commit is contained in:
Jake Potrebic 2021-01-04 19:52:44 -08:00
parent 3daa3905f0
commit 0faa210781

View file

@ -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<CommandSourceStack> 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<net.minecraft.commands.functions.CommandFunction<CommandSourceStack>> 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);