Supports the ability for commands to be registered internally (#12520)
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user