testserver/patches/server/0582-Make-schedule-command-...

29 lines
1.8 KiB
Diff
Raw Normal View History

2021-06-14 19:58:32 +00:00
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
2021-11-24 18:27:25 +00:00
index 210df39e99bfe0f373cbdf7e0cd45ff1db9cd4aa..c0127908a954d3a40ca8829e3f1f63112212f261 100644
2021-06-14 19:58:32 +00:00
--- a/src/main/java/net/minecraft/server/commands/ScheduleCommand.java
+++ b/src/main/java/net/minecraft/server/commands/ScheduleCommand.java
2021-11-24 18:27:25 +00:00
@@ -31,7 +31,7 @@ public class ScheduleCommand {
2021-07-24 02:33:05 +00:00
return new TranslatableComponent("commands.schedule.cleared.failure", new Object[]{object});
2021-06-14 19:58:32 +00:00
});
2021-07-24 02:33:05 +00:00
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
2021-06-14 19:58:32 +00:00
};
2021-07-24 02:33:05 +00:00
public ScheduleCommand() {}
2021-11-24 18:27:25 +00:00
@@ -82,7 +82,7 @@ public class ScheduleCommand {
2021-06-14 19:58:32 +00:00
}
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
2021-07-24 02:33:05 +00:00
2021-06-14 19:58:32 +00:00
if (i == 0) {
2021-07-24 02:33:05 +00:00
throw ScheduleCommand.ERROR_CANT_REMOVE.create(eventName);