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 booleanprotected StringFields inherited from class ExecutableCommand
metaModifier and TypeFieldDescriptionprotected final dev.jorel.commandapi.CommandMetaData<CommandSender> The Command's meta-data for this executable command -
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 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
-
arguments
-
subcommands
-
isConverted
protected boolean isConverted -
namespace
-
executor
protected CommandAPIExecutor<CommandSender, AbstractCommandSender<? extends CommandSender>> executorThe 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
-