Package redempt.ordinate.builder
Class CommandBuilder<T,B extends CommandBuilder<T,B>>  
java.lang.Object
redempt.ordinate.builder.CommandBuilder<T,B> 
- Type Parameters:
- T- The sender type
- B- The type of the builder itself
Builds a command, provided by 
CommandManager- 
Field SummaryFieldsModifier and TypeFieldDescriptionprotected ComponentFactory<T>protected CommandManager<T>protected CommandPipeline<T>
- 
Constructor SummaryConstructorsConstructorDescriptionCommandBuilder(String[] names, CommandManager<T> manager, BuilderOptions<T> options, CommandBuilderFactory<T, B> builderFactory) 
- 
Method SummaryModifier and TypeMethodDescriptionAdds a new argument to the commandAdds a new boolean flag to the command, which will be passed as true if present in the command when run and false otherwisebuild()<V> BconsumingArg(Class<V> type, String name) Adds a new consuming argument to the command.<V> BconsumingArg(Class<V> type, String name, boolean optional, Function<CommandContext<T>, V> defaultValue) Adds a new consuming argument to the command.handler(Consumer<CommandArguments<T>> handler) Assigns a handler that will be run when the command is executedSets the help message of the commandRemoves the auto-generated help subcommand<V> BoptionalArg(Class<V> type, String name, Function<CommandContext<T>, V> defaultValue) Adds a new optional argument to the commandMarks the command as post-argument, meaning it will be positioned after the arguments of its parent and will be able to access those argumentsregister()Registers the command.subcommand(String[] names, Consumer<B> consumer) Creates a subcommand for the commandsubcommand(String name, Consumer<B> consumer) Creates a subcommand for the command
- 
Field Details- 
pipeline
- 
manager
- 
componentFactory
- 
deferred
 
- 
- 
Constructor Details- 
CommandBuilderpublic CommandBuilder(String[] names, CommandManager<T> manager, BuilderOptions<T> options, CommandBuilderFactory<T, B> builderFactory) 
 
- 
- 
Method Details- 
helpSets the help message of the command- Parameters:
- help- The help message
- Returns:
- Itself
 
- 
argAdds a new argument to the command- Parameters:
- type- The type of the argument
- name- The name of the argument
- Returns:
- Itself
 
- 
consumingArgpublic <V> B consumingArg(Class<V> type, String name, boolean optional, Function<CommandContext<T>, V> defaultValue) Adds a new consuming argument to the command. Consuming arguments take all the remaining arguments in the command and parse them as a single string.- Type Parameters:
- V- The argument type
- Parameters:
- type- The type of the argument
- name- The name of the argument
- optional- Whether the argument should be optional
- defaultValue- The default value if no value is provided
- Returns:
- Itself
 
- 
consumingArgAdds a new consuming argument to the command. Consuming arguments take all the remaining arguments in the command and parse them as a single string.- Type Parameters:
- V- The argument type
- Parameters:
- type- The type of the argument
- name- The name of the argument
- Returns:
- Itself
 
- 
optionalArgAdds a new optional argument to the command- Type Parameters:
- V- The argument type
- Parameters:
- type- The type of the argument
- name- The name of the argument
- defaultValue- The default value of the argument, pass null for no default
- Returns:
- Itself
 
- 
subcommandCreates a subcommand for the command- Parameters:
- names- The names of the subcommand
- consumer- A function which will mutate the created builder, after which its command will be added as a child of this one
- Returns:
- Itself
 
- 
subcommandCreates a subcommand for the command- Parameters:
- name- The names of the subcommand
- consumer- A function which will mutate the created builder, after which its command will be added as a child of this one
- Returns:
- Itself
 
- 
noHelpSubcommandRemoves the auto-generated help subcommand- Returns:
- Itself
 
- 
handlerAssigns a handler that will be run when the command is executed- Parameters:
- handler- The handler
- Returns:
- Itself
 
- 
boolFlagAdds a new boolean flag to the command, which will be passed as true if present in the command when run and false otherwise- Parameters:
- names- The names of the flag, must all start with a dash
- Returns:
- Itself
 
- 
postArgumentMarks the command as post-argument, meaning it will be positioned after the arguments of its parent and will be able to access those arguments- Returns:
- Itself
 
- 
build
- 
registerRegisters the command. Do not call on subcommands.- Returns:
- The built command
 
 
-