Package dev.jorel.commandapi
Class AbstractCommandAPICommand<Impl extends AbstractCommandAPICommand<Impl,Argument,CommandSender>,Argument extends AbstractArgument<?,?,Argument,CommandSender>,CommandSender>
java.lang.Object
dev.jorel.commandapi.ExecutableCommand<Impl,CommandSender>
dev.jorel.commandapi.AbstractCommandAPICommand<Impl,Argument,CommandSender>
- Type Parameters:
Impl- The class extending this class, used as the return type for chain callsArgument- The implementation of AbstractArgument used by the class extending this classCommandSender- The CommandSender class used by the class extending this class
- All Implemented Interfaces:
ChainableBuilder<Impl>
public abstract class AbstractCommandAPICommand<Impl extends AbstractCommandAPICommand<Impl,Argument,CommandSender>,Argument extends AbstractArgument<?,?,Argument,CommandSender>,CommandSender>
extends ExecutableCommand<Impl,CommandSender>
A builder used to create commands to be registered by the CommandAPI.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected CommandAPIExecutor<CommandSender, AbstractCommandSender<? extends CommandSender>> The CommandAPIExecutor for this executable implementationprotected booleanFields inherited from class dev.jorel.commandapi.ExecutableCommand
meta -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedAbstractCommandAPICommand(dev.jorel.commandapi.CommandMetaData<CommandSender> metaData) Creates a new Command builderprotectedAbstractCommandAPICommand(String commandName) Creates a new command builder -
Method Summary
Modifier and TypeMethodDescriptionClear all executors from the current command buildercopy()Returns the list of arguments that this command hasReturns the executors that this command hasReturns the list of subcommands that this command hasbooleanReturns whether this command is an automatically converted commandprotected abstract ImplnewConcreteCommandAPICommand(dev.jorel.commandapi.CommandMetaData<CommandSender> metaData) voidRegisters the command with a given namespacevoidsetArguments(List<Argument> args) Sets the arguments that this command hasvoidsetExecutor(CommandAPIExecutor<CommandSender, AbstractCommandSender<? extends CommandSender>> executor) Sets the executors for this commandvoidsetSubcommands(List<Impl> subcommands) Sets the list of subcommands that this command hasfinal ImplwithArguments(Argument... args) Appends the argument(s) to the current command builderwithArguments(List<Argument> args) Appends the arguments to the current command builderfinal ImplwithOptionalArguments(Argument... args) Appends the optional arguments to the current command builder.withOptionalArguments(List<Argument> args) Appends the optional arguments to the current command builder.withSubcommand(Impl subcommand) Adds a subcommand to this command builderwithSubcommands(Impl... subcommands) Adds subcommands to this command builderMethods 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
-
arguments
-
subcommands
-
isConverted
protected boolean isConverted -
executor
The CommandAPIExecutor for this executable implementation
-
-
Constructor Details
-
AbstractCommandAPICommand
Creates a new command builder- Parameters:
commandName- The name of the command to create
-
AbstractCommandAPICommand
Creates a new Command builder- Parameters:
metaData- The metadata of the command to create
-
-
Method Details
-
withArguments
-
withArguments
Appends the argument(s) to the current command builder- Parameters:
args- Arguments that this command can accept- Returns:
- this command builder
-
withOptionalArguments
Appends the optional arguments to the current command builder.This also calls
AbstractArgument.setOptional(boolean)on each argument to make sure they are optional- Parameters:
args- AListthat represents the arguments that this command can accept- Returns:
- this command builder
-
withOptionalArguments
Appends the optional arguments to the current command builder.This also calls
AbstractArgument.setOptional(boolean)on each argument to make sure they are optional- Parameters:
args- Arguments that this command can accept- Returns:
- this command builder
-
withSubcommand
-
withSubcommands
-
getArguments
-
setArguments
-
getSubcommands
-
setSubcommands
-
isConverted
public boolean isConverted()Returns whether this command is an automatically converted command- Returns:
- whether this command is an automatically converted command
-
register
Registers the command with a given namespace- Specified by:
registerin classExecutableCommand<Impl extends AbstractCommandAPICommand<Impl,Argument, CommandSender>, CommandSender> - Parameters:
namespace- The namespace of this command. This cannot be null- Throws:
NullPointerException- if the namespace is null
-
copy
-
newConcreteCommandAPICommand
protected abstract Impl newConcreteCommandAPICommand(dev.jorel.commandapi.CommandMetaData<CommandSender> metaData) -
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
-