diff --git a/core/src/main/java/co/aikar/commands/BaseCommand.java b/core/src/main/java/co/aikar/commands/BaseCommand.java index 1ea8e03c..9b2502d3 100644 --- a/core/src/main/java/co/aikar/commands/BaseCommand.java +++ b/core/src/main/java/co/aikar/commands/BaseCommand.java @@ -81,7 +81,6 @@ public abstract class BaseCommand { Map registeredCommands = new HashMap<>(); String description; String commandName; - String usageMessage; String permission; String conditions; @@ -140,7 +139,6 @@ public abstract class BaseCommand { this.commandName = cmd != null ? cmd : self.getSimpleName().toLowerCase(); this.permission = annotations.getAnnotationValue(self, CommandPermission.class, Annotations.REPLACEMENTS); this.description = this.commandName + " commands"; - this.usageMessage = "/" + this.commandName; this.parentSubcommand = getParentSubcommand(self); this.conditions = annotations.getAnnotationValue(self, Conditions.class, Annotations.REPLACEMENTS | Annotations.NO_EMPTY); @@ -620,7 +618,7 @@ public abstract class BaseCommand { public void showSyntax(CommandIssuer issuer, RegisteredCommand cmd) { issuer.sendMessage(MessageType.SYNTAX, MessageKeys.INVALID_SYNTAX, - "{command}", "/" + cmd.command, + "{command}", manager.getCommandPrefix(issuer) + cmd.command, "{syntax}", cmd.syntaxText ); } diff --git a/core/src/main/java/co/aikar/commands/CommandHelp.java b/core/src/main/java/co/aikar/commands/CommandHelp.java index c3ab1e29..d11c6207 100644 --- a/core/src/main/java/co/aikar/commands/CommandHelp.java +++ b/core/src/main/java/co/aikar/commands/CommandHelp.java @@ -23,9 +23,7 @@ package co.aikar.commands; -import co.aikar.locales.MessageKeyProvider; import com.google.common.collect.SetMultimap; -import org.jetbrains.annotations.NotNull; import java.util.ArrayList; import java.util.Comparator; @@ -41,6 +39,7 @@ public class CommandHelp { private final CommandIssuer issuer; private final List helpEntries = new ArrayList<>(); private final String commandName; + final String commandPrefix; private int page; private int perPage; private List search; @@ -50,7 +49,9 @@ public class CommandHelp { this.manager = manager; this.issuer = issuer; this.perPage = manager.defaultHelpPerPage; - this.commandName = manager.getCommandPrefix(issuer) + rootCommand.getCommandName(); + this.commandPrefix = manager.getCommandPrefix(issuer); + this.commandName = this.commandPrefix + rootCommand.getCommandName(); + SetMultimap subCommands = rootCommand.getSubCommands(); Set seen = new HashSet<>(); @@ -62,7 +63,7 @@ public class CommandHelp { RegisteredCommand regCommand = e.getValue(); if (regCommand.hasPermission(issuer) && !seen.contains(regCommand)) { - this.helpEntries.add(new HelpEntry(regCommand)); + this.helpEntries.add(new HelpEntry(this, regCommand)); seen.add(regCommand); } }); diff --git a/core/src/main/java/co/aikar/commands/HelpEntry.java b/core/src/main/java/co/aikar/commands/HelpEntry.java index 13686cca..0a5b3900 100644 --- a/core/src/main/java/co/aikar/commands/HelpEntry.java +++ b/core/src/main/java/co/aikar/commands/HelpEntry.java @@ -25,10 +25,12 @@ package co.aikar.commands; public class HelpEntry { + private final CommandHelp commandHelp; private final RegisteredCommand command; private int searchScore = 1; - HelpEntry(RegisteredCommand command) { + HelpEntry(CommandHelp commandHelp, RegisteredCommand command) { + this.commandHelp = commandHelp; this.command = command; } @@ -36,8 +38,8 @@ public class HelpEntry { return this.command; } - public String getCommand(){ - return "/" + this.command.command; + public String getCommand() { + return this.commandHelp.commandPrefix + this.command.command; } public String getParameterSyntax(){