9
0
mirror of https://github.com/Winds-Studio/Leaf.git synced 2026-01-03 14:22:26 +00:00
Files
Leaf/leaf-server/minecraft-patches/features/0193-Paper-Relocate-CommandMap-registerServerAliases-call.patch

27 lines
2.1 KiB
Diff

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();