aboutsummaryrefslogtreecommitdiffhomepage
path: root/paper-server/patches/unapplied/net/minecraft/server/ReloadableServerResources.java.patch
blob: 59120184c0e441a4036ad37361d924307e89d7c6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
--- a/net/minecraft/server/ReloadableServerResources.java
+++ b/net/minecraft/server/ReloadableServerResources.java
@@ -39,6 +39,7 @@
         this.postponedTags = pendingTagLoads;
         this.recipes = new RecipeManager(registries);
         this.commands = new Commands(environment, CommandBuildContext.simple(registries, enabledFeatures));
+        io.papermc.paper.command.brigadier.PaperCommands.INSTANCE.setDispatcher(this.commands, CommandBuildContext.simple(registries, enabledFeatures)); // Paper - Brigadier Command API
         this.advancements = new ServerAdvancementManager(registries);
         this.functionLibrary = new ServerFunctionLibrary(functionPermissionLevel, this.commands.getDispatcher());
     }
@@ -83,6 +84,14 @@
                     ReloadableServerResources reloadableServerResources = new ReloadableServerResources(
                         reloadResult.layers(), reloadResult.lookupWithUpdatedTags(), enabledFeatures, environment, pendingTagLoads, functionPermissionLevel
                     );
+                    // Paper start - call commands event for bootstraps
+                    //noinspection ConstantValue
+                    io.papermc.paper.plugin.lifecycle.event.LifecycleEventRunner.INSTANCE.callReloadableRegistrarEvent(
+                        io.papermc.paper.plugin.lifecycle.event.types.LifecycleEvents.COMMANDS,
+                        io.papermc.paper.command.brigadier.PaperCommands.INSTANCE,
+                        io.papermc.paper.plugin.bootstrap.BootstrapContext.class,
+                        MinecraftServer.getServer() == null ? io.papermc.paper.plugin.lifecycle.event.registrar.ReloadableRegistrarEvent.Cause.INITIAL : io.papermc.paper.plugin.lifecycle.event.registrar.ReloadableRegistrarEvent.Cause.RELOAD);
+                    // Paper end - call commands event
                     return SimpleReloadInstance.create(
                             resourceManager,
                             reloadableServerResources.listeners(),