Class AbstractCommandTree<Impl extends AbstractCommandTree<Impl, Argument, CommandSender>, Argument extends AbstractArgument<?, ?, Argument, CommandSender>, CommandSender>
java.lang.Object
dev.jorel.commandapi.ExecutableCommand<Impl, CommandSender>
dev.jorel.commandapi.AbstractCommandTree<Impl, Argument, CommandSender>
- Type Parameters:
Impl- The class extending this class, used as the return type for chain callsArgument- The implementation of AbstractArgument being used by this classCommandSender- The CommandSender class used by the class extending this class
- All Implemented Interfaces:
ChainableBuilder<Impl>
public abstract class AbstractCommandTree<Impl extends AbstractCommandTree<Impl, Argument, CommandSender>, Argument extends AbstractArgument<?, ?, Argument, CommandSender>, CommandSender>
extends ExecutableCommand<Impl, CommandSender>
This is the root node for creating a command as a tree
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected CommandAPIExecutor<CommandSender, AbstractCommandSender<? extends CommandSender>> The CommandAPIExecutor for this executable implementationFields inherited from class ExecutableCommand
metaModifier and TypeFieldDescriptionprotected final dev.jorel.commandapi.CommandMetaData<CommandSender> The Command's meta-data for this executable command -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedAbstractCommandTree(String commandName) Creates a main root node for a command tree with a given command name -
Method Summary
Modifier and TypeMethodDescriptionClear all executors from the current command builderReturns the executors that this command hasvoidRegisters the command with a given namespacevoidsetExecutor(CommandAPIExecutor<CommandSender, AbstractCommandSender<? extends CommandSender>> executor) Sets the executors for this commandthen(AbstractArgumentTree<?, Argument, CommandSender> tree) Create a child branch on the treefinal ImplthenNested(AbstractArgumentTree<?, Argument, CommandSender>... trees) Creates a chain of child branches starting at this nodefinal ImplthenNested(List<AbstractArgumentTree<?, Argument, CommandSender>> trees) Creates a chain of child branches starting at this nodeMethods inherited from class ExecutableCommand
getAliases, getFullDescription, getName, getPermission, getRequirements, getShortDescription, getUsage, override, register, setAliases, setPermission, setRequirements, withAliases, withFullDescription, withHelp, withoutPermission, withoutPermission, withPermission, withPermission, withRequirement, withShortDescription, withUsageModifier and TypeMethodDescriptionString[]Returns an array of aliases that can be used to run this commandReturns 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 namespacevoidsetAliases(String[] aliases) Sets the aliases 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 Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface ChainableBuilder
instance
-
Field Details
-
executor
protected CommandAPIExecutor<CommandSender, AbstractCommandSender<? extends CommandSender>> executorThe CommandAPIExecutor for this executable implementation
-
-
Constructor Details
-
AbstractCommandTree
Creates a main root node for a command tree with a given command name- Parameters:
commandName- The name of the command to create
-
-
Method Details
-
then
Create a child branch on the tree- Parameters:
tree- the child node- Returns:
- this root node
-
thenNested
Creates a chain of child branches starting at this nodethenNested(a, b, c)is equivalent tothen(AbstractArgumentTree)(a.then(b.then(c))).- Parameters:
trees- The child branches to add in a chain.- Returns:
- this tree node
-
thenNested
@SafeVarargs public final Impl thenNested(AbstractArgumentTree<?, Argument, CommandSender>... trees) Creates a chain of child branches starting at this nodethenNested(a, b, c)is equivalent tothen(AbstractArgumentTree)(a.then(b.then(c))).- Parameters:
trees- The child branches to add in a chain.- Returns:
- this tree node
-
register
Registers the command with a given namespace- Specified by:
registerin classExecutableCommand<Impl extends AbstractCommandTree<Impl, Argument, CommandSender>, CommandSender>- Parameters:
namespace- The namespace of this command. This cannot be null- Throws:
NullPointerException- if the namespace is null
-
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
-