public static final class CommandSpec.Builder extends Object
Modifier and Type | Method and Description |
---|---|
CommandSpec.Builder |
arguments(CommandElement... args)
Sets the argument specification for this command.
|
CommandSpec.Builder |
arguments(CommandElement args)
Sets the argument specification for this command.
|
CommandSpec |
build()
Create a new
CommandSpec based on the data provided in this
builder. |
CommandSpec.Builder |
child(CommandCallable child,
Collection<String> aliases)
Add a single child command to this command.
|
CommandSpec.Builder |
child(CommandCallable child,
String... aliases)
Add a single child command to this command.
|
CommandSpec.Builder |
childArgumentParseExceptionFallback(boolean childCommandFallback)
If a child command is selected but fails to parse arguments passed to
it, the following determines the behavior.
|
CommandSpec.Builder |
children(Map<List<String>,? extends CommandCallable> children)
Adds more child arguments for this command.
|
CommandSpec.Builder |
description(Text description)
A short, one-line description of this command's purpose.
|
CommandSpec.Builder |
executor(CommandExecutor executor)
Sets the callback that will handle this command's execution.
|
CommandSpec.Builder |
extendedDescription(Text extendedDescription)
Sets an extended description to use in longer help listings for this
command.
|
CommandSpec.Builder |
inputTokenizer(InputTokenizer parser)
Sets the input tokenizer to be used to convert input from a string
into a list of argument tokens.
|
CommandSpec.Builder |
permission(String permission)
Sets the permission that will be checked before using this command.
|
public CommandSpec.Builder permission(String permission)
permission
- The permission to checkpublic CommandSpec.Builder executor(CommandExecutor executor)
executor
- The executor that will be called with this command's
parsed argumentspublic CommandSpec.Builder children(Map<List<String>,? extends CommandCallable> children)
children
- The children to usepublic CommandSpec.Builder child(CommandCallable child, String... aliases)
child
- The child to addaliases
- Aliases to make the child available under. First
one is primary and is the only one guaranteed to be listed in
usage outputs.public CommandSpec.Builder child(CommandCallable child, Collection<String> aliases)
child
- The child to add.aliases
- Aliases to make the child available under. First
one is primary and is the only one guaranteed to be listed in
usage outputs.public CommandSpec.Builder description(@Nullable Text description)
description
- The description to setpublic CommandSpec.Builder extendedDescription(@Nullable Text extendedDescription)
extendedDescription
- The description to setpublic CommandSpec.Builder childArgumentParseExceptionFallback(boolean childCommandFallback)
The default for this is true, which emulates the behavior from previous API revisions.
childCommandFallback
- Whether to fallback on argument parse
failurepublic CommandSpec.Builder arguments(CommandElement args)
GenericArguments.seq(CommandElement...)
method is used to parse a sequence of args.args
- The arguments object to useGenericArguments
public CommandSpec.Builder arguments(CommandElement... args)
arguments(seq(args))
.args
- The arguments object to useGenericArguments
public CommandSpec.Builder inputTokenizer(InputTokenizer parser)
parser
- The parser to usefor common input parser implementations
public CommandSpec build()
CommandSpec
based on the data provided in this
builder.