PaperMC/paper-server/patches/sources/net/minecraft/server/commands/ReloadCommand.java.patch

29 lines
1.6 KiB
Diff
Raw Normal View History

--- a/net/minecraft/server/commands/ReloadCommand.java
+++ b/net/minecraft/server/commands/ReloadCommand.java
2024-12-14 22:42:43 +01:00
@@ -16,7 +_,7 @@
private static final Logger LOGGER = LogUtils.getLogger();
2020-12-03 05:04:01 +01:00
2024-12-14 22:42:43 +01:00
public static void reloadPacks(Collection<String> selectedIds, CommandSourceStack source) {
- source.getServer().reloadResources(selectedIds).exceptionally(throwable -> {
+ source.getServer().reloadResources(selectedIds, io.papermc.paper.event.server.ServerResourcesReloadedEvent.Cause.COMMAND).exceptionally(throwable -> { // Paper - Add ServerResourcesReloadedEvent
LOGGER.warn("Failed to execute reload", throwable);
2020-12-03 05:04:01 +01:00
source.sendFailure(Component.translatable("commands.reload.failure"));
return null;
2024-12-14 22:42:43 +01:00
@@ -36,6 +_,16 @@
2024-12-14 22:42:43 +01:00
return list;
}
+
+ // CraftBukkit start
+ public static void reload(MinecraftServer server) {
+ PackRepository packRepository = server.getPackRepository();
+ WorldData worldData = server.getWorldData();
+ Collection<String> selectedIds = packRepository.getSelectedIds();
+ Collection<String> collection = discoverNewPacks(packRepository, worldData, selectedIds);
+ server.reloadResources(collection, io.papermc.paper.event.server.ServerResourcesReloadedEvent.Cause.PLUGIN); // Paper - Add ServerResourcesReloadedEvent
+ }
+ // CraftBukkit end
2024-12-14 22:42:43 +01:00
public static void register(CommandDispatcher<CommandSourceStack> dispatcher) {
2024-12-14 22:42:43 +01:00
dispatcher.register(Commands.literal("reload").requires(source -> source.hasPermission(2)).executes(context -> {