Package redempt.redlib.commandmanager
Class Command
java.lang.Object
redempt.redlib.commandmanager.Command
- Direct Known Subclasses:
CommandCollection.MergedBaseCommand
Represents a command which can be registered
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected static classstatic enum -
Field Summary
Fields -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedCommand()protectedCommand(String[] names, CommandArgument[] args, CommandFlag[] flags, ContextProvider<?>[] providers, ContextProvider<?>[] asserters, String help, String permission, Command.SenderType type, String hook, List<Command> children, boolean hideSub, boolean noTab, boolean noHelp, boolean postArg) -
Method Summary
Modifier and TypeMethodDescriptionprotected Map<String,Command.MethodHook> createHookMap(Object... listeners) String[]intgetDepth()getHelp()protected StringgetHelpRecursive(org.bukkit.command.CommandSender sender, int level) getName()protected static ArgType<?>booleanbooleanbooleannameMatches(String name) Check if a name matches any of this command's aliasesvoidRegisters this command and its childrenprotected voidregisterHook(Map<String, Command.MethodHook> hooks, org.bukkit.plugin.Plugin plugin) runHook(org.bukkit.command.CommandSender sender, String[] args, List<Object> prepend, List<Result<Boolean, String>> results) booleanshowHelp(org.bukkit.command.CommandSender sender) Shows the help to a CommandSender
-
Field Details
-
children
-
plugin
protected org.bukkit.plugin.Plugin plugin -
names
-
hook
-
help
-
topLevel
protected boolean topLevel -
parent
-
-
Constructor Details
-
Command
protected Command() -
Command
protected Command(String[] names, CommandArgument[] args, CommandFlag[] flags, ContextProvider<?>[] providers, ContextProvider<?>[] asserters, String help, String permission, Command.SenderType type, String hook, List<Command> children, boolean hideSub, boolean noTab, boolean noHelp, boolean postArg)
-
-
Method Details
-
showHelp
public boolean showHelp(org.bukkit.command.CommandSender sender) Shows the help to a CommandSender- Parameters:
sender- The sender to show the help to- Returns:
- True if the help was shown to the user, false if the usage was shown instead
-
getHelpRecursive
-
getFullName
- Returns:
- The expanded name of the command, plus arguments
-
getArgsDisplay
- Returns:
- The display of the arguments for this command
-
getExpandedName
- Returns:
- The name of the command concatenated with its parents' names
-
register
Registers this command and its children- Parameters:
prefix- The fallback prefixlisteners- The listener objects containing method hooks
-
createHookMap
-
registerHook
-
tab
-
execute
-
runHook
-
nameMatches
Check if a name matches any of this command's aliases- Parameters:
name- The name to check- Returns:
- Whether the name matches any of this command's aliases
-
getDepth
public int getDepth() -
getType
-
getName
- Returns:
- The command's primary name/first alias
-
lastArgTakesAll
public boolean lastArgTakesAll()- Returns:
- Whether the last argument in this command is consuming or vararg
-
getAliases
- Returns:
- All of the command's names/aliases
-
isPostArg
public boolean isPostArg()- Returns:
- Whether this subcommand comes after the arguments of its parent
-
getHelp
- Returns:
- The command's help message
-
getPermission
- Returns:
- Nullable. The permission required to run the command
-