Class HelpCommandBase
java.lang.Object
dev.ua.theroer.magicutils.commands.MagicCommand
dev.ua.theroer.magicutils.commands.HelpCommandBase
Shared help command implementation for all platforms.
-
Nested Class Summary
Nested classes/interfaces inherited from class MagicCommand
MagicCommand.Builder<S>, MagicCommand.SubCommandInfo -
Constructor Summary
ConstructorsConstructorDescriptionHelpCommandBase(LoggerCore logger, Supplier<CommandManager<?>> managerSupplier) Creates a help command using the default command name.HelpCommandBase(LoggerCore logger, Supplier<CommandManager<?>> managerSupplier, String helpCommand) Creates a help command with a custom command name. -
Method Summary
Modifier and TypeMethodDescriptionexecute(MagicSender sender, String commandName, String subCommand) Executes the help command.String[]Returns suggestions for known command names.protected voidsendLine(MagicSender sender, String line) Sends a formatted line to the sender.Methods inherited from class MagicCommand
addAlias, addSubCommand, addSubCommand, builder, copy, findExecuteMethod, fromSpec, getArguments, getCommandInfo, getSubCommands, getUsage, isFrozen, mergeSubCommands, mount, mount, mountSubCommands, overrideInfo, removeAlias, resolveInfo, setExecute, setExecute, setExecute, setExecute, setExecute, setExecute, withInfo, withName
-
Constructor Details
-
HelpCommandBase
Creates a help command using the default command name.- Parameters:
logger- logger coremanagerSupplier- supplier for command manager
-
HelpCommandBase
public HelpCommandBase(LoggerCore logger, Supplier<CommandManager<?>> managerSupplier, String helpCommand) Creates a help command with a custom command name.- Parameters:
logger- logger coremanagerSupplier- supplier for command managerhelpCommand- help command name
-
-
Method Details
-
execute
Executes the help command.- Parameters:
sender- command sendercommandName- optional command filtersubCommand- optional subcommand filter- Returns:
- command result
-
getCommandSuggestions
Returns suggestions for known command names.- Returns:
- command name suggestions
-
sendLine
Sends a formatted line to the sender.- Parameters:
sender- command senderline- line to send
-