mirror of
https://github.com/array-in-a-matrix/brainwine.git
synced 2025-04-02 11:11:58 -04:00
Make '/help [command]' work with aliases
This commit is contained in:
parent
dfbfe5ebb0
commit
ac71f0f9c1
2 changed files with 7 additions and 3 deletions
|
@ -107,7 +107,7 @@ public class CommandManager {
|
|||
commandName = commandName.substring(1);
|
||||
}
|
||||
|
||||
Command command = commands.getOrDefault(commandName, aliases.get(commandName));
|
||||
Command command = getCommand(commandName, true);
|
||||
|
||||
if(command == null || !command.canExecute(executor)) {
|
||||
executor.notify("Unknown command. Type '/help' for a list of commands.", SYSTEM);
|
||||
|
@ -153,7 +153,11 @@ public class CommandManager {
|
|||
}
|
||||
|
||||
public static Command getCommand(String name) {
|
||||
return commands.get(name);
|
||||
return getCommand(name, false);
|
||||
}
|
||||
|
||||
public static Command getCommand(String name, boolean allowAlias) {
|
||||
return commands.getOrDefault(name, allowAlias ? aliases.get(name) : null);
|
||||
}
|
||||
|
||||
public static Collection<Command> getCommands() {
|
||||
|
|
|
@ -33,7 +33,7 @@ public class HelpCommand extends Command {
|
|||
arg = arg.substring(1);
|
||||
}
|
||||
|
||||
Command command = CommandManager.getCommand(arg);
|
||||
Command command = CommandManager.getCommand(arg, true);
|
||||
|
||||
// If command does not exist (or can not be used by the executor) then notify the executor of this.
|
||||
if(command == null || !command.canExecute(executor)) {
|
||||
|
|
Loading…
Add table
Reference in a new issue