Package dev.jorel.commandapi
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 dev.jorel.commandapi.ExecutableCommand
meta -
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 dev.jorel.commandapi.ExecutableCommand
getAliases, getFullDescription, getName, getPermission, getRequirements, getShortDescription, getUsage, override, register, setAliases, setPermission, setRequirements, withAliases, withFullDescription, withHelp, withoutPermission, withoutPermission, withPermission, withPermission, withRequirement, withShortDescription, withUsageMethods 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
-
executor
The 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(dev.jorel.commandapi.AbstractArgumentTree<?, Argument, CommandSender>)(a.then(b.then(c))).- Parameters:
trees- The child branches to add in a chain.- Returns:
- this tree node
-
thenNested
Creates a chain of child branches starting at this nodethenNested(a, b, c)is equivalent tothen(dev.jorel.commandapi.AbstractArgumentTree<?, Argument, CommandSender>)(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
-