9
0
mirror of https://github.com/Winds-Studio/Leaf.git synced 2025-12-19 15:09:25 +00:00

Paper: Relocate CommandMap#registerServerAliases() call

This commit is contained in:
Dreeam
2025-10-12 15:24:59 -04:00
parent a774999314
commit 4a97094219
2 changed files with 52 additions and 0 deletions

View File

@@ -0,0 +1,26 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Strokkur424 <strokkur.24@gmail.com>
Date: Tue, 17 Jun 2025 19:30:35 +0200
Subject: [PATCH] Paper: Relocate CommandMap#registerServerAliases() call
Original license: GPLv3
Original project: https://github.com/PaperMC/Paper
Paper pull request: https://github.com/PaperMC/Paper/pull/12601
Fixed Paper#12600.
This PR relocates the CommandMap#registerServerAliases() call to be after the lifecycle events for COMMANDS has been
run to accommodate for commands registered during a plugin's onEnable method.
diff --git a/net/minecraft/server/MinecraftServer.java b/net/minecraft/server/MinecraftServer.java
index 0baa48054beead8f187b56ea8d71916600ccea9f..c6f21d508636cbb3e6e8e88ecc280a6872074103 100644
--- a/net/minecraft/server/MinecraftServer.java
+++ b/net/minecraft/server/MinecraftServer.java
@@ -749,6 +749,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
if (io.papermc.paper.plugin.PluginInitializerManager.instance().pluginRemapper != null) io.papermc.paper.plugin.PluginInitializerManager.instance().pluginRemapper.pluginsEnabled(); // Paper - Remap plugins
io.papermc.paper.command.brigadier.PaperCommands.INSTANCE.setValid(); // Paper - reset invalid state for event fire below
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, org.bukkit.plugin.Plugin.class, io.papermc.paper.plugin.lifecycle.event.registrar.ReloadableRegistrarEvent.Cause.INITIAL); // Paper - call commands event for regular plugins
+ this.server.getCommandMap().registerServerAliases(); // Paper - relocate initial CommandMap#registerServerAliases() call
((org.bukkit.craftbukkit.help.SimpleHelpMap) this.server.getHelpMap()).initializeCommands();
this.server.getPluginManager().callEvent(new org.bukkit.event.server.ServerLoadEvent(org.bukkit.event.server.ServerLoadEvent.LoadType.STARTUP));
this.connection.acceptConnections();

View File

@@ -0,0 +1,26 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Strokkur424 <strokkur.24@gmail.com>
Date: Tue, 17 Jun 2025 19:30:35 +0200
Subject: [PATCH] Paper: Relocate CommandMap#registerServerAliases() call
Original license: GPLv3
Original project: https://github.com/PaperMC/Paper
Paper pull request: https://github.com/PaperMC/Paper/pull/12601
Fixed Paper#12600.
This PR relocates the CommandMap#registerServerAliases() call to be after the lifecycle events for COMMANDS has been
run to accommodate for commands registered during a plugin's onEnable method.
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index dd38057071de1ecce2e420bd0696a134190a09c1..77e5fc9e2625e2e31f12ff46c80ca55d39d6fe33 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -632,7 +632,6 @@ public final class CraftServer implements Server {
this.commandMap.setFallbackCommands();
this.setVanillaCommands(false);
// Spigot end
- this.commandMap.registerServerAliases();
DefaultPermissions.registerCorePermissions();
CraftDefaultPermissions.registerCorePermissions();
if (!io.papermc.paper.configuration.GlobalConfiguration.get().misc.loadPermissionsYmlBeforePlugins) this.loadCustomPermissions(); // Paper