Generic help command

This commit is contained in:
KingRainbow44
2022-04-18 23:06:03 -04:00
parent ba4e727302
commit fa65f512ca
2 changed files with 71 additions and 4 deletions

View File

@@ -63,6 +63,23 @@ public final class CommandMap {
return this;
}
/**
* Returns a list of all registered commands.
* @return All command handlers as a list.
*/
public List<CommandHandler> getHandlers() {
return new LinkedList<>(this.commands.values());
}
/**
* Returns a handler by label/alias.
* @param label The command label.
* @return The command handler.
*/
public CommandHandler getHandler(String label) {
return this.commands.get(label);
}
/**
* Invoke a command handler with the given arguments.
* @param player The player invoking the command or null for the server console.