Supports the ability for commands to be registered internally (#12520)

This commit is contained in:
Owen
2025-05-06 16:05:00 -04:00
committed by GitHub
parent c98cd65802
commit 42a2a6c2b5
12 changed files with 92 additions and 52 deletions

View File

@@ -26,10 +26,12 @@ import org.bukkit.entity.minecart.CommandMinecart;
public class VanillaCommandWrapper extends BukkitCommand { // Paper
public final CommandNode<CommandSourceStack> vanillaCommand;
public final String helpCommandNamespace;
public VanillaCommandWrapper(String name, String description, String usageMessage, List<String> aliases, CommandNode<CommandSourceStack> vanillaCommand) {
public VanillaCommandWrapper(String name, String description, String usageMessage, List<String> aliases, CommandNode<CommandSourceStack> vanillaCommand, String helpCommandNamespace) {
super(name, description, usageMessage, aliases);
this.vanillaCommand = vanillaCommand;
this.helpCommandNamespace = helpCommandNamespace;
}
Commands commands() {
@@ -40,6 +42,7 @@ public class VanillaCommandWrapper extends BukkitCommand { // Paper
super(vanillaCommand.getName(), "A Mojang provided command.", vanillaCommand.getUsageText(), Collections.emptyList());
this.vanillaCommand = vanillaCommand;
this.setPermission(VanillaCommandWrapper.getPermission(vanillaCommand));
this.helpCommandNamespace = "Minecraft";
}
@Override

View File

@@ -199,18 +199,15 @@ public class SimpleHelpMap implements HelpMap {
}
private String getCommandPluginName(Command command) {
// Paper start - Move up
if (command instanceof PluginIdentifiableCommand) {
return ((PluginIdentifiableCommand) command).getPlugin().getName();
}
// Paper end
if (command instanceof VanillaCommandWrapper) {
return "Minecraft";
if (command instanceof VanillaCommandWrapper wrapper) {
return wrapper.helpCommandNamespace;
}
if (command instanceof BukkitCommand) {
return "Bukkit";
}
// Paper - Move PluginIdentifiableCommand instanceof check to allow brig commands
return null;
}