Class ADPMainCommand
- java.lang.Object
-
- com.alessiodp.core.common.commands.utils.ADPMainCommand
-
- All Implemented Interfaces:
ADPExecutableCommand
public abstract class ADPMainCommand extends Object implements ADPExecutableCommand
-
-
Field Summary
Fields Modifier and Type Field Description protected List<String>aliasesprotected @NotNull ADPCommandcommandprotected @NotNull StringcommandNameprotected Stringdescriptionprotected booleanexecutableByConsoleprotected Stringhelpprotected booleanlistedInHelpprotected @NotNull ADPPluginpluginprotected StringrunCommandprotected HashMap<String,ADPSubCommand>subCommandsList of sub commandsprotected HashMap<ADPCommand,ADPSubCommand>subCommandsByEnumprotected Stringsyntaxprotected booleantabSupportEnable tab support for this command
-
Constructor Summary
Constructors Constructor Description ADPMainCommand()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description booleanexists(@NotNull String command)Does the given command exist?protected @Nullable ADPSubCommandgetSubCommand(@NotNull String command)Get sub command with given nameabstract booleanonCommand(@NotNull User sender, String command, String[] args)Handle the command@NotNull List<String>onTabComplete(@NotNull User sender, String[] args)Handle tab complete eventvoidregister(@NotNull ADPSubCommand subCommand)Register the sub command into the list-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.alessiodp.core.common.commands.utils.ADPExecutableCommand
getCommand, getCommandName, getConsoleSyntax, getDescription, getHelp, getRunCommand, getSyntax, getSyntaxForUser, isExecutableByConsole, isListedInHelp
-
-
-
-
Field Detail
-
plugin
@NotNull protected final @NotNull ADPPlugin plugin
-
command
@NotNull protected final @NotNull ADPCommand command
-
commandName
@NotNull protected final @NotNull String commandName
-
executableByConsole
protected final boolean executableByConsole
-
listedInHelp
protected boolean listedInHelp
-
description
protected String description
-
help
protected String help
-
syntax
protected String syntax
-
runCommand
protected String runCommand
-
subCommands
protected HashMap<String,ADPSubCommand> subCommands
List of sub commands
-
subCommandsByEnum
protected HashMap<ADPCommand,ADPSubCommand> subCommandsByEnum
-
tabSupport
protected boolean tabSupport
Enable tab support for this command
-
-
Method Detail
-
onCommand
public abstract boolean onCommand(@NotNull @NotNull User sender, String command, String[] args)Handle the command- Parameters:
sender- the user that sent the commandcommand- the command performedargs- arguments of the command- Returns:
- true if has been handled
-
onTabComplete
@NotNull public @NotNull List<String> onTabComplete(@NotNull @NotNull User sender, String[] args)
Handle tab complete event- Parameters:
sender- the user that send the tab completeargs- arguments of the tab complete- Returns:
- a list of strings to tab complete
-
register
public final void register(@NotNull @NotNull ADPSubCommand subCommand)Register the sub command into the list- Parameters:
subCommand- the sub command to register
-
exists
public final boolean exists(@NotNull @NotNull String command)Does the given command exist?- Parameters:
command- the command name- Returns:
- true if the command exists
-
getSubCommand
@Nullable protected final @Nullable ADPSubCommand getSubCommand(@NotNull @NotNull String command)
Get sub command with given name- Parameters:
command- the command name- Returns:
- the sub command found
-
-