Package dev.jorel.commandapi
Class ExecutableCommand<Impl extends ExecutableCommand<Impl,CommandSender>,CommandSender>
java.lang.Object
dev.jorel.commandapi.ExecutableCommand<Impl,CommandSender>
- Type Parameters:
Impl- The class extending this class, used as the return type for chain callsCommandSender- The CommandSender class used by the class extending this class
- All Implemented Interfaces:
ChainableBuilder<Impl>
- Direct Known Subclasses:
AbstractCommandAPICommand,AbstractCommandTree
public abstract class ExecutableCommand<Impl extends ExecutableCommand<Impl,CommandSender>,CommandSender>
extends Object
This is a base class for
AbstractCommandAPICommand and AbstractCommandTree command definitions-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected CommandAPIExecutor<CommandSender, AbstractCommandSender<? extends CommandSender>> The CommandAPIExecutor for this executable implementationprotected final dev.jorel.commandapi.CommandMetaData<CommandSender> The Command's meta-data for this executable command -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedExecutableCommand(dev.jorel.commandapi.CommandMetaData<CommandSender> meta) -
Method Summary
Modifier and TypeMethodDescriptionClear all executors from the current command builderString[]Returns an array of aliases that can be used to run this commandReturns the executors that this command hasReturns the full description for this commandgetName()Returns the name of this commandReturns the permission associated with this commandReturns the requirements that must be satisfied to run this commandReturns the short description for this commandString[]getUsage()Returns the usage for this commandvoidoverride()Overrides a command.voidregister()Registers this command with the default namespaceabstract voidRegisters this command with a customStringnamespacevoidsetAliases(String[] aliases) Sets the aliases for this commandvoidsetExecutor(CommandAPIExecutor<CommandSender, AbstractCommandSender<? extends CommandSender>> executor) Sets the executors for this commandvoidsetPermission(CommandPermission permission) Sets the permission required to run this commandvoidsetRequirements(Predicate<CommandSender> requirements) Sets the requirements that must be satisfied to run this commandwithAliases(String... aliases) Adds an array of aliases to the current command builderwithFullDescription(String description) Sets the full description for this command.Sets the short and full description for this command.withoutPermission(CommandPermission permission) Applies a permission to the current command builderwithoutPermission(String permission) Applies a permission to the current command builderwithPermission(CommandPermission permission) Applies a permission to the current command builderwithPermission(String permission) Applies a permission to the current command builderwithRequirement(Predicate<CommandSender> requirement) Adds a requirement that has to be satisfied to use this command.withShortDescription(String description) Sets the short description for this command.Sets the full usage for this command.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface dev.jorel.commandapi.ChainableBuilder
instance
-
Field Details
-
meta
The Command's meta-data for this executable command -
executor
The CommandAPIExecutor for this executable implementation
-
-
Constructor Details
-
ExecutableCommand
-
-
Method Details
-
getName
-
withPermission
Applies a permission to the current command builder- Parameters:
permission- The permission node required to execute this command- Returns:
- this command builder
-
withPermission
-
withoutPermission
Applies a permission to the current command builder- Parameters:
permission- The permission node required to execute this command- Returns:
- this command builder
-
withoutPermission
-
withRequirement
Adds a requirement that has to be satisfied to use this command. This method can be used multiple times and each use of this method will AND its requirement with the previously declared ones- Parameters:
requirement- the predicate that must be satisfied to use this command- Returns:
- this command builder
-
withAliases
-
getPermission
Returns the permission associated with this command- Returns:
- the permission associated with this command
-
setPermission
Sets the permission required to run this command- Parameters:
permission- the permission required to run this command
-
getAliases
Returns an array of aliases that can be used to run this command- Returns:
- an array of aliases that can be used to run this command
-
setAliases
Sets the aliases for this command- Parameters:
aliases- the aliases for this command
-
getRequirements
Returns the requirements that must be satisfied to run this command- Returns:
- the requirements that must be satisfied to run this command
-
setRequirements
Sets the requirements that must be satisfied to run this command- Parameters:
requirements- the requirements that must be satisfied to run this command
-
getShortDescription
Returns the short description for this command- Returns:
- the short description for this command
-
withShortDescription
-
getFullDescription
Returns the full description for this command- Returns:
- the full description for this command
-
withFullDescription
-
withUsage
-
getUsage
-
withHelp
Sets the short and full description for this command. This is a short-hand for thewithShortDescription(java.lang.String)andwithFullDescription(java.lang.String)methods.- Parameters:
shortDescription- the short description for this commandfullDescription- the full description for this command- Returns:
- this command builder
-
override
public void override()Overrides a command. Effectively the same as unregistering the command using CommandAPI.unregister() and then registering the command using .register() -
register
public void register()Registers this command with the default namespace -
register
-
getExecutor
public CommandAPIExecutor<CommandSender,AbstractCommandSender<? extends CommandSender>> getExecutor()Returns the executors that this command has- Returns:
- the executors that this command has
-
setExecutor
public void setExecutor(CommandAPIExecutor<CommandSender, AbstractCommandSender<? extends CommandSender>> executor) Sets the executors for this command- Parameters:
executor- the executors for this command
-
clearExecutors
Clear all executors from the current command builder- Returns:
- this command builder
-