Class Command.Builder<C>
- Type Parameters:
C- command sender type
Command instances. The builder is immutable, and each
setter method will return a new builder instance.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfaceEssentially aUnaryOperatorforCommand.Builder, but as a separate interface to avoid conflicts. -
Method Summary
Modifier and TypeMethodDescriptionappendHandler(@NonNull CommandExecutionHandler<C> handler) Sets a new command execution handler that invokes the givenhandlerafter the currenthandler.apply(@NonNull Command.Builder.Applicable<@NonNull C> applicable) Applies the providedCommand.Builder.Applicableto thisCommand.Builder, and returns the result.argument(@NonNull CommandComponent<? super C> argument) Adds the givenargumentto the command.<T> @NonNull Command.Builder<C> argument(CommandComponent.Builder<? super C, T> builder) Adds the givenargumentto the command.build()Builds a command using the builder instance.Returns the current command description of this command builder.commandDescription(@NonNull CommandDescription commandDescription) Returns a new builder with the givencommandDescription.commandDescription(@NonNull Description commandDescription) Returns the result of invokingcommandDescription(CommandDescription)with the result ofCommandDescription.commandDescription(Description).commandDescription(@NonNull Description commandDescription, @NonNull Description verboseCommandDescription) Returns the result of invokingcommandDescription(CommandDescription)with the result ofCommandDescription.commandDescription(Description, Description).Returns the required command permission for this builder.<T> @NonNull Command.Builder<C> flag(@NonNull CommandFlag<T> flag) Registers a new command flag.<T> @NonNull Command.Builder<C> flag(@NonNull CommandFlag.Builder<C, T> builder) Registers a new command flag.futureHandler(@NonNull CommandExecutionHandler.FutureCommandExecutionHandler<C> commandExecutionHandler) Specifies the command execution handler.handler()Returns the current command execution handler.handler(@NonNull CommandExecutionHandler<C> commandExecutionHandler) Specifies the command execution handler.Inserts a required literal into the command chain.Inserts a required literal into the command chain.manager(@Nullable CommandManager<C> commandManager) Supplies a command manager instance to the builder.meta()Returns the currentcommand metavalue.<V> @NonNull Command.Builder<C> Adds command meta to the internal command meta-map.<T> @NonNull Command.Builder<C> Marks thebuilderas optional and adds it to the command.<T> @NonNull Command.Builder<C> Adds the given optional argument to the command.<T> @NonNull Command.Builder<C> optional(@NonNull String name, @NonNull ParserDescriptor<? super C, T> parser, @NonNull DefaultValue<? super C, T> defaultValue) Adds the given optional argument to the command.<T> @NonNull Command.Builder<C> optional(@NonNull String name, @NonNull ParserDescriptor<? super C, T> parser, @NonNull DefaultValue<? super C, T> defaultValue, @NonNull Description description) Adds the given optional argument to the command.<T> @NonNull Command.Builder<C> optional(@NonNull String name, @NonNull ParserDescriptor<? super C, T> parser, @NonNull DefaultValue<? super C, T> defaultValue, @NonNull Description description, @NonNull SuggestionProvider<? super C> suggestions) Adds the given optional argument to the command.<T> @NonNull Command.Builder<C> optional(@NonNull String name, @NonNull ParserDescriptor<? super C, T> parser, @NonNull DefaultValue<? super C, T> defaultValue, @NonNull SuggestionProvider<? super C> suggestions) Adds the given optional argument to the command.<T> @NonNull Command.Builder<C> optional(@NonNull String name, @NonNull ParserDescriptor<? super C, T> parser, @NonNull Description description) Adds the given optional argument to the command.<T> @NonNull Command.Builder<C> optional(@NonNull String name, @NonNull ParserDescriptor<? super C, T> parser, @NonNull Description description, @NonNull SuggestionProvider<? super C> suggestions) Adds the given optional argument to the command.<T> @NonNull Command.Builder<C> optional(@NonNull String name, @NonNull ParserDescriptor<? super C, T> parser, @NonNull SuggestionProvider<? super C> suggestions) Adds the given optional argument to the command.<T> @NonNull Command.Builder<C> optional(@NonNull CommandComponent.Builder<? super C, T> builder) Marks thebuilderas optional and adds it to the command.<T> @NonNull Command.Builder<C> Adds the given optional argument to the command.<T> @NonNull Command.Builder<C> optional(@NonNull CloudKey<T> name, @NonNull ParserDescriptor<? super C, T> parser, @NonNull DefaultValue<? super C, T> defaultValue) Adds the given optional argument to the command.<T> @NonNull Command.Builder<C> optional(@NonNull CloudKey<T> name, @NonNull ParserDescriptor<? super C, T> parser, @NonNull DefaultValue<? super C, T> defaultValue, @NonNull Description description) Adds the given optional argument to the command.<T> @NonNull Command.Builder<C> optional(@NonNull CloudKey<T> name, @NonNull ParserDescriptor<? super C, T> parser, @NonNull DefaultValue<? super C, T> defaultValue, @NonNull Description description, @NonNull SuggestionProvider<? super C> suggestions) Adds the given optional argument to the command.<T> @NonNull Command.Builder<C> optional(@NonNull CloudKey<T> name, @NonNull ParserDescriptor<? super C, T> parser, @NonNull DefaultValue<? super C, T> defaultValue, @NonNull SuggestionProvider<? super C> suggestions) Adds the given optional argument to the command.<T> @NonNull Command.Builder<C> optional(@NonNull CloudKey<T> name, @NonNull ParserDescriptor<? super C, T> parser, @NonNull Description description) Adds the given optional argument to the command.<T> @NonNull Command.Builder<C> optional(@NonNull CloudKey<T> name, @NonNull ParserDescriptor<? super C, T> parser, @NonNull Description description, @NonNull SuggestionProvider<? super C> suggestions) Adds the given optional argument to the command.<T> @NonNull Command.Builder<C> optional(@NonNull CloudKey<T> name, @NonNull ParserDescriptor<? super C, T> parser, @NonNull SuggestionProvider<? super C> suggestions) Adds the given optional argument to the command.<U,V, O> @NonNull Command.Builder <C> optionalArgumentPair(@NonNull String name, @NonNull TypeToken<O> outputType, @NonNull String firstName, @NonNull ParserDescriptor<C, U> firstParser, @NonNull String secondName, @NonNull ParserDescriptor<C, V> secondParser, @NonNull AggregateParserPairBuilder.Mapper<C, U, V, O> mapper, @NonNull Description description) Creates a new argument pair that maps to a custom type.<U,V> @NonNull Command.Builder <C> optionalArgumentPair(@NonNull String name, @NonNull String firstName, @NonNull ParserDescriptor<C, U> firstParser, @NonNull String secondName, @NonNull ParserDescriptor<C, V> secondParser, @NonNull Description description) Creates a new argument pair that maps toPair.<U,V, O> @NonNull Command.Builder <C> optionalArgumentPair(@NonNull CloudKey<O> name, @NonNull TypeToken<O> outputType, @NonNull String firstName, @NonNull ParserDescriptor<C, U> firstParser, @NonNull String secondName, @NonNull ParserDescriptor<C, V> secondParser, @NonNull AggregateParserPairBuilder.Mapper<C, U, V, O> mapper, @NonNull Description description) Creates a new argument pair that maps to a custom type.<U,V> @NonNull Command.Builder <C> optionalArgumentPair(@NonNull CloudKey<Pair<U, V>> name, @NonNull String firstName, @NonNull ParserDescriptor<C, U> firstParser, @NonNull String secondName, @NonNull ParserDescriptor<C, V> secondParser, @NonNull Description description) Creates a new argument pair that maps toPair.<U,V, W, O>
@NonNull Command.Builder<C> optionalArgumentTriplet(@NonNull String name, @NonNull TypeToken<O> outputType, @NonNull String firstName, @NonNull ParserDescriptor<C, U> firstParser, @NonNull String secondName, @NonNull ParserDescriptor<C, V> secondParser, @NonNull String thirdName, @NonNull ParserDescriptor<C, W> thirdParser, @NonNull AggregateParserTripletBuilder.Mapper<C, U, V, W, O> mapper, @NonNull Description description) Creates a new argument triplet that maps to a custom type.<U,V, W> @NonNull Command.Builder <C> optionalArgumentTriplet(@NonNull String name, @NonNull String firstName, @NonNull ParserDescriptor<C, U> firstParser, @NonNull String secondName, @NonNull ParserDescriptor<C, V> secondParser, @NonNull String thirdName, @NonNull ParserDescriptor<C, W> thirdParser, @NonNull Description description) Create a new argument pair that maps toTriplet<U,V, W, O>
@NonNull Command.Builder<C> optionalArgumentTriplet(@NonNull CloudKey<O> name, @NonNull TypeToken<O> outputType, @NonNull String firstName, @NonNull ParserDescriptor<C, U> firstParser, @NonNull String secondName, @NonNull ParserDescriptor<C, V> secondParser, @NonNull String thirdName, @NonNull ParserDescriptor<C, W> thirdParser, @NonNull AggregateParserTripletBuilder.Mapper<C, U, V, W, O> mapper, @NonNull Description description) Creates a new argument triplet that maps to a custom type.<U,V, W> @NonNull Command.Builder <C> optionalArgumentTriplet(@NonNull CloudKey<Triplet<U, V, W>> name, @NonNull String firstName, @NonNull ParserDescriptor<C, U> firstParser, @NonNull String secondName, @NonNull ParserDescriptor<C, V> secondParser, @NonNull String thirdName, @NonNull ParserDescriptor<C, W> thirdParser, @NonNull Description description) Create a new argument pair that maps toTripletpermission(@NonNull String permission) Specifies a command permission.permission(@NonNull Permission permission) Specifies a command permission.permission(@NonNull PredicatePermission<C> permission) Specifies a command permission.prependHandler(@NonNull CommandExecutionHandler<C> handler) Sets a new command execution handler that invokes the givenhandlerbefore the currenthandler.<N extends C>
@NonNull Command.Builder<N> Makes the current command be a proxy of the supplied command.<T> @NonNull Command.Builder<C> Marks thebuilderas required and adds it to the command.<T> @NonNull Command.Builder<C> Adds the given required argument to the command.<T> @NonNull Command.Builder<C> required(@NonNull String name, @NonNull ParserDescriptor<? super C, T> parser, @NonNull Description description) Adds the given required argument to the command.<T> @NonNull Command.Builder<C> required(@NonNull String name, @NonNull ParserDescriptor<? super C, T> parser, @NonNull Description description, @NonNull SuggestionProvider<? super C> suggestions) Adds the given required argument to the command.<T> @NonNull Command.Builder<C> required(@NonNull String name, @NonNull ParserDescriptor<? super C, T> parser, @NonNull SuggestionProvider<? super C> suggestions) Adds the given required argument to the command.<T> @NonNull Command.Builder<C> required(@NonNull CommandComponent.Builder<? super C, T> builder) Marks thebuilderas required and adds it to the command.<T> @NonNull Command.Builder<C> Adds the given required argument to the command.<T> @NonNull Command.Builder<C> required(@NonNull CloudKey<T> name, @NonNull ParserDescriptor<? super C, T> parser, @NonNull Description description) Adds the given required argument to the command.<T> @NonNull Command.Builder<C> required(@NonNull CloudKey<T> name, @NonNull ParserDescriptor<? super C, T> parser, @NonNull Description description, @NonNull SuggestionProvider<? super C> suggestions) Adds the given required argument to the command.<T> @NonNull Command.Builder<C> required(@NonNull CloudKey<T> name, @NonNull ParserDescriptor<? super C, T> parser, @NonNull SuggestionProvider<? super C> suggestions) Adds the given required argument to the command.<U,V, O> @NonNull Command.Builder <C> requiredArgumentPair(@NonNull String name, @NonNull TypeToken<O> outputType, @NonNull String firstName, @NonNull ParserDescriptor<C, U> firstParser, @NonNull String secondName, @NonNull ParserDescriptor<C, V> secondParser, @NonNull AggregateParserPairBuilder.Mapper<C, U, V, O> mapper, @NonNull Description description) Creates a new argument pair that maps to a custom type.<U,V> @NonNull Command.Builder <C> requiredArgumentPair(@NonNull String name, @NonNull String firstName, @NonNull ParserDescriptor<C, U> firstParser, @NonNull String secondName, @NonNull ParserDescriptor<C, V> secondParser, @NonNull Description description) Creates a new argument pair that maps toPair.<U,V, O> @NonNull Command.Builder <C> requiredArgumentPair(@NonNull CloudKey<O> name, @NonNull TypeToken<O> outputType, @NonNull String firstName, @NonNull ParserDescriptor<C, U> firstParser, @NonNull String secondName, @NonNull ParserDescriptor<C, V> secondParser, @NonNull AggregateParserPairBuilder.Mapper<C, U, V, O> mapper, @NonNull Description description) Creates a new argument pair that maps to a custom type.<U,V> @NonNull Command.Builder <C> requiredArgumentPair(@NonNull CloudKey<Pair<U, V>> name, @NonNull String firstName, @NonNull ParserDescriptor<C, U> firstParser, @NonNull String secondName, @NonNull ParserDescriptor<C, V> secondParser, @NonNull Description description) Creates a new argument pair that maps toPair.<U,V, W, O>
@NonNull Command.Builder<C> requiredArgumentTriplet(@NonNull String name, @NonNull TypeToken<O> outputType, @NonNull String firstName, @NonNull ParserDescriptor<C, U> firstParser, @NonNull String secondName, @NonNull ParserDescriptor<C, V> secondParser, @NonNull String thirdName, @NonNull ParserDescriptor<C, W> thirdParser, @NonNull AggregateParserTripletBuilder.Mapper<C, U, V, W, O> mapper, @NonNull Description description) Creates a new argument triplet that maps to a custom type.<U,V, W> @NonNull Command.Builder <C> requiredArgumentTriplet(@NonNull String name, @NonNull String firstName, @NonNull ParserDescriptor<C, U> firstParser, @NonNull String secondName, @NonNull ParserDescriptor<C, V> secondParser, @NonNull String thirdName, @NonNull ParserDescriptor<C, W> thirdParser, @NonNull Description description) Create a new argument pair that maps toTriplet<U,V, W, O>
@NonNull Command.Builder<C> requiredArgumentTriplet(@NonNull CloudKey<O> name, @NonNull TypeToken<O> outputType, @NonNull String firstName, @NonNull ParserDescriptor<C, U> firstParser, @NonNull String secondName, @NonNull ParserDescriptor<C, V> secondParser, @NonNull String thirdName, @NonNull ParserDescriptor<C, W> thirdParser, @NonNull AggregateParserTripletBuilder.Mapper<C, U, V, W, O> mapper, @NonNull Description description) Creates a new argument triplet that maps to a custom type.<U,V, W> @NonNull Command.Builder <C> requiredArgumentTriplet(@NonNull CloudKey<Triplet<U, V, W>> name, @NonNull String firstName, @NonNull ParserDescriptor<C, U> firstParser, @NonNull String secondName, @NonNull ParserDescriptor<C, V> secondParser, @NonNull String thirdName, @NonNull ParserDescriptor<C, W> thirdParser, @NonNull Description description) Create a new argument pair that maps toTripletReturns the required sender type for this builder.<N extends C>
@NonNull Command.Builder<N> senderType(@NonNull TypeToken<? extends N> senderType) Specifies a required sender type.<N extends C>
@NonNull Command.Builder<N> senderType(@NonNull Class<? extends N> senderType) Specifies a required sender type.
-
Method Details
-
senderType
Returns the required sender type for this builder.Returns
nullwhen there is not a specific required sender type.- Returns:
- required sender type
-
commandPermission
Returns the required command permission for this builder.Will return
Permission.empty()if there is no required permission.- Returns:
- required permission
-
meta
Returns the currentcommand metavalue.- Returns:
- current command meta
-
apply
@API(status=STABLE) public @NonNull Command.Builder<@NonNull C> apply(@NonNull Command.Builder.Applicable<@NonNull C> applicable) Applies the providedCommand.Builder.Applicableto thisCommand.Builder, and returns the result.- Parameters:
applicable- operation- Returns:
- operation result
-
meta
@API(status=STABLE) public <V> @NonNull Command.Builder<C> meta(@NonNull CloudKey<V> key, @NonNull V value) Adds command meta to the internal command meta-map.- Type Parameters:
V- meta value type- Parameters:
key- meta keyvalue- meta value- Returns:
- new builder instance using the inserted meta key-value pair
-
manager
Supplies a command manager instance to the builder.This will be used when attempting to retrieve command argument parsers, in the case that they're needed.
This is optional.
- Parameters:
commandManager- Command manager- Returns:
- new builder instance using the provided command manager
-
commandDescription
@API(status=STABLE) public @NonNull Command.Builder<C> commandDescription(@NonNull CommandDescription commandDescription) Returns a new builder with the givencommandDescription.See
Command.commandDescription()for information about the description.- Parameters:
commandDescription- the new command description- Returns:
- new builder instance using the provided command description
-
commandDescription
Returns the current command description of this command builder.- Returns:
- the current description
-
commandDescription
Returns the result of invokingcommandDescription(CommandDescription)with the result ofCommandDescription.commandDescription(Description).- Parameters:
commandDescription- the new command description- Returns:
- new builder instance using the provided command description
-
commandDescription
public @NonNull Command.Builder<C> commandDescription(@NonNull Description commandDescription, @NonNull Description verboseCommandDescription) Returns the result of invokingcommandDescription(CommandDescription)with the result ofCommandDescription.commandDescription(Description, Description).- Parameters:
commandDescription- the new command descriptionverboseCommandDescription- the new verbose command description- Returns:
- new builder instance using the provided command description
-
literal
Inserts a required literal into the command chain.- Parameters:
main- main argument namealiases- argument aliases- Returns:
- new builder instance with the modified command chain
-
literal
@API(status=STABLE) public @NonNull Command.Builder<C> literal(@NonNull String main, @NonNull Description description, @NonNull String... aliases) Inserts a required literal into the command chain.- Parameters:
main- main argument namedescription- literal descriptionaliases- argument aliases- Returns:
- new builder instance with the modified command chain
-
required
@API(status=STABLE) public <T> @NonNull Command.Builder<C> required(@NonNull String name, @NonNull CommandComponent.Builder<? super C, T> builder) Marks thebuilderas required and adds it to the command.- Type Parameters:
T- value type- Parameters:
name- the name that will be inserted into the builderbuilder- the component builder- Returns:
- new builder instance with the command argument inserted into the argument list
-
optional
@API(status=STABLE) public <T> @NonNull Command.Builder<C> optional(@NonNull String name, @NonNull CommandComponent.Builder<? super C, T> builder) Marks thebuilderas optional and adds it to the command.- Type Parameters:
T- value type- Parameters:
name- the name that will be inserted into the builderbuilder- the component builder- Returns:
- new builder instance with the command argument inserted into the argument list
-
required
@API(status=STABLE) public <T> @NonNull Command.Builder<C> required(@NonNull CommandComponent.Builder<? super C, T> builder) Marks thebuilderas required and adds it to the command.- Type Parameters:
T- value type- Parameters:
builder- the component builder- Returns:
- new builder instance with the command argument inserted into the argument list
-
optional
@API(status=STABLE) public <T> @NonNull Command.Builder<C> optional(@NonNull CommandComponent.Builder<? super C, T> builder) Marks thebuilderas optional and adds it to the command.- Type Parameters:
T- value type- Parameters:
builder- the component builder- Returns:
- new builder instance with the command argument inserted into the argument list
-
required
@API(status=STABLE) public <T> @NonNull Command.Builder<C> required(@NonNull String name, @NonNull ParserDescriptor<? super C, T> parser) Adds the given required argument to the command.- Type Parameters:
T- the type produced by the parser- Parameters:
name- the name of the argumentparser- the parser- Returns:
- new builder instance with the command argument inserted into the argument list
-
required
@API(status=STABLE) public <T> @NonNull Command.Builder<C> required(@NonNull String name, @NonNull ParserDescriptor<? super C, T> parser, @NonNull SuggestionProvider<? super C> suggestions) Adds the given required argument to the command.- Type Parameters:
T- the type produced by the parser- Parameters:
name- the name of the argumentparser- the parsersuggestions- the suggestion provider- Returns:
- new builder instance with the command argument inserted into the argument list
-
required
@API(status=STABLE) public <T> @NonNull Command.Builder<C> required(@NonNull CloudKey<T> name, @NonNull ParserDescriptor<? super C, T> parser) Adds the given required argument to the command.- Type Parameters:
T- the type produced by the parser- Parameters:
name- the name of the argumentparser- the parser- Returns:
- new builder instance with the command argument inserted into the argument list
-
required
@API(status=STABLE) public <T> @NonNull Command.Builder<C> required(@NonNull CloudKey<T> name, @NonNull ParserDescriptor<? super C, T> parser, @NonNull SuggestionProvider<? super C> suggestions) Adds the given required argument to the command.- Type Parameters:
T- the type produced by the parser- Parameters:
name- the name of the argumentparser- the parsersuggestions- the suggestion provider- Returns:
- new builder instance with the command argument inserted into the argument list
-
required
@API(status=STABLE) public <T> @NonNull Command.Builder<C> required(@NonNull CloudKey<T> name, @NonNull ParserDescriptor<? super C, T> parser, @NonNull Description description) Adds the given required argument to the command.- Type Parameters:
T- the type produced by the parser- Parameters:
name- the name of the argumentparser- the parserdescription- the description of the argument- Returns:
- new builder instance with the command argument inserted into the argument list
-
required
@API(status=STABLE) public <T> @NonNull Command.Builder<C> required(@NonNull CloudKey<T> name, @NonNull ParserDescriptor<? super C, T> parser, @NonNull Description description, @NonNull SuggestionProvider<? super C> suggestions) Adds the given required argument to the command.- Type Parameters:
T- the type produced by the parser- Parameters:
name- the name of the argumentparser- the parserdescription- the description of the argumentsuggestions- the suggestion provider- Returns:
- new builder instance with the command argument inserted into the argument list
-
required
@API(status=STABLE) public <T> @NonNull Command.Builder<C> required(@NonNull String name, @NonNull ParserDescriptor<? super C, T> parser, @NonNull Description description) Adds the given required argument to the command.- Type Parameters:
T- the type produced by the parser- Parameters:
name- the name of the argumentparser- the parserdescription- the description of the argument- Returns:
- new builder instance with the command argument inserted into the argument list
-
required
@API(status=STABLE) public <T> @NonNull Command.Builder<C> required(@NonNull String name, @NonNull ParserDescriptor<? super C, T> parser, @NonNull Description description, @NonNull SuggestionProvider<? super C> suggestions) Adds the given required argument to the command.- Type Parameters:
T- the type produced by the parser- Parameters:
name- the name of the argumentparser- the parserdescription- the description of the argumentsuggestions- the suggestion provider- Returns:
- new builder instance with the command argument inserted into the argument list
-
optional
@API(status=STABLE) public <T> @NonNull Command.Builder<C> optional(@NonNull String name, @NonNull ParserDescriptor<? super C, T> parser) Adds the given optional argument to the command.- Type Parameters:
T- the type produced by the parser- Parameters:
name- the name of the argumentparser- the parser- Returns:
- new builder instance with the command argument inserted into the argument list
-
optional
@API(status=STABLE) public <T> @NonNull Command.Builder<C> optional(@NonNull String name, @NonNull ParserDescriptor<? super C, T> parser, @NonNull SuggestionProvider<? super C> suggestions) Adds the given optional argument to the command.- Type Parameters:
T- the type produced by the parser- Parameters:
name- the name of the argumentparser- the parsersuggestions- the suggestion provider- Returns:
- new builder instance with the command argument inserted into the argument list
-
optional
@API(status=STABLE) public <T> @NonNull Command.Builder<C> optional(@NonNull CloudKey<T> name, @NonNull ParserDescriptor<? super C, T> parser) Adds the given optional argument to the command.- Type Parameters:
T- the type produced by the parser- Parameters:
name- the name of the argumentparser- the parser- Returns:
- new builder instance with the command argument inserted into the argument list
-
optional
@API(status=STABLE) public <T> @NonNull Command.Builder<C> optional(@NonNull CloudKey<T> name, @NonNull ParserDescriptor<? super C, T> parser, @NonNull SuggestionProvider<? super C> suggestions) Adds the given optional argument to the command.- Type Parameters:
T- the type produced by the parser- Parameters:
name- the name of the argumentparser- the parsersuggestions- the suggestion provider- Returns:
- new builder instance with the command argument inserted into the argument list
-
optional
@API(status=STABLE) public <T> @NonNull Command.Builder<C> optional(@NonNull String name, @NonNull ParserDescriptor<? super C, T> parser, @NonNull Description description) Adds the given optional argument to the command.- Type Parameters:
T- the type produced by the parser- Parameters:
name- the name of the argumentparser- the parserdescription- the description of the argument- Returns:
- new builder instance with the command argument inserted into the argument list
-
optional
@API(status=STABLE) public <T> @NonNull Command.Builder<C> optional(@NonNull String name, @NonNull ParserDescriptor<? super C, T> parser, @NonNull Description description, @NonNull SuggestionProvider<? super C> suggestions) Adds the given optional argument to the command.- Type Parameters:
T- the type produced by the parser- Parameters:
name- the name of the argumentparser- the parserdescription- the description of the argumentsuggestions- the suggestion provider- Returns:
- new builder instance with the command argument inserted into the argument list
-
optional
@API(status=STABLE) public <T> @NonNull Command.Builder<C> optional(@NonNull CloudKey<T> name, @NonNull ParserDescriptor<? super C, T> parser, @NonNull Description description) Adds the given optional argument to the command.- Type Parameters:
T- the type produced by the parser- Parameters:
name- the name of the argumentparser- the parserdescription- the description of the argument- Returns:
- new builder instance with the command argument inserted into the argument list
-
optional
@API(status=STABLE) public <T> @NonNull Command.Builder<C> optional(@NonNull CloudKey<T> name, @NonNull ParserDescriptor<? super C, T> parser, @NonNull Description description, @NonNull SuggestionProvider<? super C> suggestions) Adds the given optional argument to the command.- Type Parameters:
T- the type produced by the parser- Parameters:
name- the name of the argumentparser- the parserdescription- the description of the argumentsuggestions- the suggestion provider- Returns:
- new builder instance with the command argument inserted into the argument list
-
optional
@API(status=STABLE) public <T> @NonNull Command.Builder<C> optional(@NonNull String name, @NonNull ParserDescriptor<? super C, T> parser, @NonNull DefaultValue<? super C, T> defaultValue) Adds the given optional argument to the command.- Type Parameters:
T- the type produced by the parser- Parameters:
name- the name of the argumentparser- the parserdefaultValue- the default value- Returns:
- new builder instance with the command argument inserted into the argument list
-
optional
@API(status=STABLE) public <T> @NonNull Command.Builder<C> optional(@NonNull String name, @NonNull ParserDescriptor<? super C, T> parser, @NonNull DefaultValue<? super C, T> defaultValue, @NonNull SuggestionProvider<? super C> suggestions) Adds the given optional argument to the command.- Type Parameters:
T- the type produced by the parser- Parameters:
name- the name of the argumentparser- the parserdefaultValue- the default valuesuggestions- the suggestion provider- Returns:
- new builder instance with the command argument inserted into the argument list
-
optional
@API(status=STABLE) public <T> @NonNull Command.Builder<C> optional(@NonNull CloudKey<T> name, @NonNull ParserDescriptor<? super C, T> parser, @NonNull DefaultValue<? super C, T> defaultValue) Adds the given optional argument to the command.- Type Parameters:
T- the type produced by the parser- Parameters:
name- the name of the argumentparser- the parserdefaultValue- the default value- Returns:
- new builder instance with the command argument inserted into the argument list
-
optional
@API(status=STABLE) public <T> @NonNull Command.Builder<C> optional(@NonNull CloudKey<T> name, @NonNull ParserDescriptor<? super C, T> parser, @NonNull DefaultValue<? super C, T> defaultValue, @NonNull SuggestionProvider<? super C> suggestions) Adds the given optional argument to the command.- Type Parameters:
T- the type produced by the parser- Parameters:
name- the name of the argumentparser- the parserdefaultValue- the default valuesuggestions- the suggestion provider- Returns:
- new builder instance with the command argument inserted into the argument list
-
optional
@API(status=STABLE) public <T> @NonNull Command.Builder<C> optional(@NonNull String name, @NonNull ParserDescriptor<? super C, T> parser, @NonNull DefaultValue<? super C, T> defaultValue, @NonNull Description description) Adds the given optional argument to the command.- Type Parameters:
T- the type produced by the parser- Parameters:
name- the name of the argumentparser- the parserdefaultValue- the default valuedescription- the description of the argument- Returns:
- new builder instance with the command argument inserted into the argument list
-
optional
@API(status=STABLE) public <T> @NonNull Command.Builder<C> optional(@NonNull String name, @NonNull ParserDescriptor<? super C, T> parser, @NonNull DefaultValue<? super C, T> defaultValue, @NonNull Description description, @NonNull SuggestionProvider<? super C> suggestions) Adds the given optional argument to the command.- Type Parameters:
T- the type produced by the parser- Parameters:
name- the name of the argumentparser- the parserdefaultValue- the default valuedescription- the description of the argumentsuggestions- the suggestion provider- Returns:
- new builder instance with the command argument inserted into the argument list
-
optional
@API(status=STABLE) public <T> @NonNull Command.Builder<C> optional(@NonNull CloudKey<T> name, @NonNull ParserDescriptor<? super C, T> parser, @NonNull DefaultValue<? super C, T> defaultValue, @NonNull Description description) Adds the given optional argument to the command.- Type Parameters:
T- the type produced by the parser- Parameters:
name- the name of the argumentparser- the parserdefaultValue- the default valuedescription- the description of the argument- Returns:
- new builder instance with the command argument inserted into the argument list
-
optional
@API(status=STABLE) public <T> @NonNull Command.Builder<C> optional(@NonNull CloudKey<T> name, @NonNull ParserDescriptor<? super C, T> parser, @NonNull DefaultValue<? super C, T> defaultValue, @NonNull Description description, @NonNull SuggestionProvider<? super C> suggestions) Adds the given optional argument to the command.- Type Parameters:
T- the type produced by the parser- Parameters:
name- the name of the argumentparser- the parserdefaultValue- the default valuedescription- the description of the argumentsuggestions- the suggestion provider- Returns:
- new builder instance with the command argument inserted into the argument list
-
argument
@API(status=STABLE) public @NonNull Command.Builder<C> argument(@NonNull CommandComponent<? super C> argument) Adds the givenargumentto the command.- Parameters:
argument- argument to add- Returns:
- new builder instance with the command argument inserted into the argument list
-
argument
@API(status=STABLE) public <T> @NonNull Command.Builder<C> argument(CommandComponent.Builder<? super C, T> builder) Adds the givenargumentto the command.- Type Parameters:
T- value type- Parameters:
builder- builder that builds the component to add- Returns:
- new builder instance with the command argument inserted into the argument list
-
requiredArgumentPair
@API(status=STABLE) public <U,V> @NonNull Command.Builder<C> requiredArgumentPair(@NonNull String name, @NonNull String firstName, @NonNull ParserDescriptor<C, U> firstParser, @NonNull String secondName, @NonNull ParserDescriptor<C, V> secondParser, @NonNull Description description) Creates a new argument pair that maps toPair.- Type Parameters:
U- first typeV- second type- Parameters:
name- name of the argumentfirstName- name of the first subcomponentfirstParser- parser for the first subcomponentsecondName- name of the second subcomponentsecondParser- parser for the second subcomponentdescription- description of the argument- Returns:
- new builder instance with the argument inserted
-
requiredArgumentPair
@API(status=STABLE) public <U,V> @NonNull Command.Builder<C> requiredArgumentPair(@NonNull CloudKey<Pair<U, V>> name, @NonNull String firstName, @NonNull ParserDescriptor<C, U> firstParser, @NonNull String secondName, @NonNull ParserDescriptor<C, V> secondParser, @NonNull Description description) Creates a new argument pair that maps toPair.- Type Parameters:
U- first typeV- second type- Parameters:
name- name of the argumentfirstName- name of the first subcomponentfirstParser- parser for the first subcomponentsecondName- name of the second subcomponentsecondParser- parser for the second subcomponentdescription- description of the argument- Returns:
- new builder instance with the argument inserted
-
optionalArgumentPair
@API(status=STABLE) public <U,V> @NonNull Command.Builder<C> optionalArgumentPair(@NonNull String name, @NonNull String firstName, @NonNull ParserDescriptor<C, U> firstParser, @NonNull String secondName, @NonNull ParserDescriptor<C, V> secondParser, @NonNull Description description) Creates a new argument pair that maps toPair.- Type Parameters:
U- first typeV- second type- Parameters:
name- name of the argumentfirstName- name of the first subcomponentfirstParser- parser for the first subcomponentsecondName- name of the second subcomponentsecondParser- parser for the second subcomponentdescription- description of the argument- Returns:
- new builder instance with the argument inserted
-
optionalArgumentPair
@API(status=STABLE) public <U,V> @NonNull Command.Builder<C> optionalArgumentPair(@NonNull CloudKey<Pair<U, V>> name, @NonNull String firstName, @NonNull ParserDescriptor<C, U> firstParser, @NonNull String secondName, @NonNull ParserDescriptor<C, V> secondParser, @NonNull Description description) Creates a new argument pair that maps toPair.- Type Parameters:
U- first typeV- second type- Parameters:
name- name of the argumentfirstName- name of the first subcomponentfirstParser- parser for the first subcomponentsecondName- name of the second subcomponentsecondParser- parser for the second subcomponentdescription- description of the argument- Returns:
- new builder instance with the argument inserted
-
requiredArgumentPair
@API(status=STABLE) public <U,V, @NonNull Command.Builder<C> requiredArgumentPairO> (@NonNull String name, @NonNull TypeToken<O> outputType, @NonNull String firstName, @NonNull ParserDescriptor<C, U> firstParser, @NonNull String secondName, @NonNull ParserDescriptor<C, V> secondParser, @NonNull AggregateParserPairBuilder.Mapper<C, U, V, O> mapper, @NonNull Description description) Creates a new argument pair that maps to a custom type.- Type Parameters:
U- first typeV- second typeO- output type- Parameters:
name- name of the argumentoutputType- the output typefirstName- name of the first subcomponentfirstParser- parser for the first subcomponentsecondName- name of the second subcomponentsecondParser- parser for the second subcomponentmapper- mapper that maps fromPairto the custom typedescription- description of the argument- Returns:
- new builder instance with the argument inserted
-
requiredArgumentPair
@API(status=STABLE) public <U,V, @NonNull Command.Builder<C> requiredArgumentPairO> (@NonNull CloudKey<O> name, @NonNull TypeToken<O> outputType, @NonNull String firstName, @NonNull ParserDescriptor<C, U> firstParser, @NonNull String secondName, @NonNull ParserDescriptor<C, V> secondParser, @NonNull AggregateParserPairBuilder.Mapper<C, U, V, O> mapper, @NonNull Description description) Creates a new argument pair that maps to a custom type.- Type Parameters:
U- first typeV- second typeO- output type- Parameters:
name- name of the argumentoutputType- the output typefirstName- name of the first subcomponentfirstParser- parser for the first subcomponentsecondName- name of the second subcomponentsecondParser- parser for the second subcomponentmapper- mapper that maps fromPairto the custom typedescription- description of the argument- Returns:
- new builder instance with the argument inserted
-
optionalArgumentPair
@API(status=STABLE) public <U,V, @NonNull Command.Builder<C> optionalArgumentPairO> (@NonNull String name, @NonNull TypeToken<O> outputType, @NonNull String firstName, @NonNull ParserDescriptor<C, U> firstParser, @NonNull String secondName, @NonNull ParserDescriptor<C, V> secondParser, @NonNull AggregateParserPairBuilder.Mapper<C, U, V, O> mapper, @NonNull Description description) Creates a new argument pair that maps to a custom type.- Type Parameters:
U- first typeV- second typeO- output type- Parameters:
name- name of the argumentoutputType- the output typefirstName- name of the first subcomponentfirstParser- parser for the first subcomponentsecondName- name of the second subcomponentsecondParser- parser for the second subcomponentmapper- mapper that maps fromPairto the custom typedescription- description of the argument- Returns:
- new builder instance with the argument inserted
-
optionalArgumentPair
@API(status=STABLE) public <U,V, @NonNull Command.Builder<C> optionalArgumentPairO> (@NonNull CloudKey<O> name, @NonNull TypeToken<O> outputType, @NonNull String firstName, @NonNull ParserDescriptor<C, U> firstParser, @NonNull String secondName, @NonNull ParserDescriptor<C, V> secondParser, @NonNull AggregateParserPairBuilder.Mapper<C, U, V, O> mapper, @NonNull Description description) Creates a new argument pair that maps to a custom type.- Type Parameters:
U- first typeV- second typeO- output type- Parameters:
name- name of the argumentoutputType- the output typefirstName- name of the first subcomponentfirstParser- parser for the first subcomponentsecondName- name of the second subcomponentsecondParser- parser for the second subcomponentmapper- mapper that maps fromPairto the custom typedescription- description of the argument- Returns:
- new builder instance with the argument inserted
-
requiredArgumentTriplet
@API(status=STABLE) public <U,V, @NonNull Command.Builder<C> requiredArgumentTripletW> (@NonNull String name, @NonNull String firstName, @NonNull ParserDescriptor<C, U> firstParser, @NonNull String secondName, @NonNull ParserDescriptor<C, V> secondParser, @NonNull String thirdName, @NonNull ParserDescriptor<C, W> thirdParser, @NonNull Description description) Create a new argument pair that maps toTriplet- Type Parameters:
U- first typeV- second typeW- third type- Parameters:
name- name of the argumentfirstName- name of the first subcomponentfirstParser- parser for the first subcomponentsecondName- name of the second subcomponentsecondParser- parser for the second subcomponentthirdName- name of the third subcomponentthirdParser- parser for the third subcomponentdescription- description of the argument- Returns:
- new builder instance with the argument inserted
-
requiredArgumentTriplet
@API(status=STABLE) public <U,V, @NonNull Command.Builder<C> requiredArgumentTripletW> (@NonNull CloudKey<Triplet<U, V, W>> name, @NonNull String firstName, @NonNull ParserDescriptor<C, U> firstParser, @NonNull String secondName, @NonNull ParserDescriptor<C, V> secondParser, @NonNull String thirdName, @NonNull ParserDescriptor<C, W> thirdParser, @NonNull Description description) Create a new argument pair that maps toTripletFor this to work, there must be a
CommandManagerattached to the command builder. To guarantee this, it is recommended to get the command builder instance usingCommandBuilderSource.commandBuilder(String, String...).- Type Parameters:
U- first typeV- second typeW- third type- Parameters:
name- name of the argumentfirstName- name of the first subcomponentfirstParser- parser for the first subcomponentsecondName- name of the second subcomponentsecondParser- parser for the second subcomponentthirdName- name of the third subcomponentthirdParser- parser for the third subcomponentdescription- description of the argument- Returns:
- new builder instance with the argument inserted
-
optionalArgumentTriplet
@API(status=STABLE) public <U,V, @NonNull Command.Builder<C> optionalArgumentTripletW> (@NonNull String name, @NonNull String firstName, @NonNull ParserDescriptor<C, U> firstParser, @NonNull String secondName, @NonNull ParserDescriptor<C, V> secondParser, @NonNull String thirdName, @NonNull ParserDescriptor<C, W> thirdParser, @NonNull Description description) Create a new argument pair that maps toTripletFor this to work, there must be a
CommandManagerattached to the command builder. To guarantee this, it is recommended to get the command builder instance usingCommandBuilderSource.commandBuilder(String, String...).- Type Parameters:
U- first typeV- second typeW- third type- Parameters:
name- name of the argumentfirstName- name of the first subcomponentfirstParser- parser for the first subcomponentsecondName- name of the second subcomponentsecondParser- parser for the second subcomponentthirdName- name of the third subcomponentthirdParser- parser for the third subcomponentdescription- description of the argument- Returns:
- new builder instance with the argument inserted
-
optionalArgumentTriplet
@API(status=STABLE) public <U,V, @NonNull Command.Builder<C> optionalArgumentTripletW> (@NonNull CloudKey<Triplet<U, V, W>> name, @NonNull String firstName, @NonNull ParserDescriptor<C, U> firstParser, @NonNull String secondName, @NonNull ParserDescriptor<C, V> secondParser, @NonNull String thirdName, @NonNull ParserDescriptor<C, W> thirdParser, @NonNull Description description) Create a new argument pair that maps toTripletFor this to work, there must be a
CommandManagerattached to the command builder. To guarantee this, it is recommended to get the command builder instance usingCommandBuilderSource.commandBuilder(String, String...).- Type Parameters:
U- first typeV- second typeW- third type- Parameters:
name- name of the argumentfirstName- name of the first subcomponentfirstParser- parser for the first subcomponentsecondName- name of the second subcomponentsecondParser- parser for the second subcomponentthirdName- name of the third subcomponentthirdParser- parser for the third subcomponentdescription- description of the argument- Returns:
- new builder instance with the argument inserted
-
requiredArgumentTriplet
@API(status=STABLE) public <U,V, @NonNull Command.Builder<C> requiredArgumentTripletW, O> (@NonNull String name, @NonNull TypeToken<O> outputType, @NonNull String firstName, @NonNull ParserDescriptor<C, U> firstParser, @NonNull String secondName, @NonNull ParserDescriptor<C, V> secondParser, @NonNull String thirdName, @NonNull ParserDescriptor<C, W> thirdParser, @NonNull AggregateParserTripletBuilder.Mapper<C, U, V, W, O> mapper, @NonNull Description description) Creates a new argument triplet that maps to a custom type.For this to work, there must be a
CommandManagerattached to the command builder. To guarantee this, it is recommended to get the command builder instance usingCommandBuilderSource.commandBuilder(String, String...).- Type Parameters:
U- first typeV- second typeW- third typeO- output type- Parameters:
name- name of the argumentoutputType- the output typefirstName- name of the first subcomponentfirstParser- parser for the first subcomponentsecondName- name of the second subcomponentsecondParser- parser for the second subcomponentthirdName- name of the third subcomponentthirdParser- parser for the third subcomponentmapper- mapper that maps fromTripletto the custom typedescription- description of the argument- Returns:
- new builder instance with the argument inserted
-
requiredArgumentTriplet
@API(status=STABLE) public <U,V, @NonNull Command.Builder<C> requiredArgumentTripletW, O> (@NonNull CloudKey<O> name, @NonNull TypeToken<O> outputType, @NonNull String firstName, @NonNull ParserDescriptor<C, U> firstParser, @NonNull String secondName, @NonNull ParserDescriptor<C, V> secondParser, @NonNull String thirdName, @NonNull ParserDescriptor<C, W> thirdParser, @NonNull AggregateParserTripletBuilder.Mapper<C, U, V, W, O> mapper, @NonNull Description description) Creates a new argument triplet that maps to a custom type.For this to work, there must be a
CommandManagerattached to the command builder. To guarantee this, it is recommended to get the command builder instance usingCommandBuilderSource.commandBuilder(String, String...).- Type Parameters:
U- first typeV- second typeW- third typeO- output type- Parameters:
name- name of the argumentoutputType- the output typefirstName- name of the first subcomponentfirstParser- parser for the first subcomponentsecondName- name of the second subcomponentsecondParser- parser for the second subcomponentthirdName- name of the third subcomponentthirdParser- parser for the third subcomponentmapper- Mapper that maps fromTripletto the custom typedescription- description of the argument- Returns:
- new builder instance with the argument inserted
-
optionalArgumentTriplet
@API(status=STABLE) public <U,V, @NonNull Command.Builder<C> optionalArgumentTripletW, O> (@NonNull String name, @NonNull TypeToken<O> outputType, @NonNull String firstName, @NonNull ParserDescriptor<C, U> firstParser, @NonNull String secondName, @NonNull ParserDescriptor<C, V> secondParser, @NonNull String thirdName, @NonNull ParserDescriptor<C, W> thirdParser, @NonNull AggregateParserTripletBuilder.Mapper<C, U, V, W, O> mapper, @NonNull Description description) Creates a new argument triplet that maps to a custom type.For this to work, there must be a
CommandManagerattached to the command builder. To guarantee this, it is recommended to get the command builder instance usingCommandBuilderSource.commandBuilder(String, String...).- Type Parameters:
U- first typeV- second typeW- third typeO- output type- Parameters:
name- name of the argumentoutputType- the output typefirstName- name of the first subcomponentfirstParser- parser for the first subcomponentsecondName- name of the second subcomponentsecondParser- parser for the second subcomponentthirdName- name of the third subcomponentthirdParser- parser for the third subcomponentmapper- mapper that maps fromTripletto the custom typedescription- description of the argument- Returns:
- new builder instance with the argument inserted
-
optionalArgumentTriplet
@API(status=STABLE) public <U,V, @NonNull Command.Builder<C> optionalArgumentTripletW, O> (@NonNull CloudKey<O> name, @NonNull TypeToken<O> outputType, @NonNull String firstName, @NonNull ParserDescriptor<C, U> firstParser, @NonNull String secondName, @NonNull ParserDescriptor<C, V> secondParser, @NonNull String thirdName, @NonNull ParserDescriptor<C, W> thirdParser, @NonNull AggregateParserTripletBuilder.Mapper<C, U, V, W, O> mapper, @NonNull Description description) Creates a new argument triplet that maps to a custom type.For this to work, there must be a
CommandManagerattached to the command builder. To guarantee this, it is recommended to get the command builder instance usingCommandBuilderSource.commandBuilder(String, String...).- Type Parameters:
U- first typeV- second typeW- third typeO- output type- Parameters:
name- name of the argumentoutputType- the output typefirstName- name of the first subcomponentfirstParser- parser for the first subcomponentsecondName- name of the second subcomponentsecondParser- parser for the second subcomponentthirdName- name of the third subcomponentthirdParser- parser for the third subcomponentmapper- mapper that maps fromTripletto the custom typedescription- description of the argument- Returns:
- new builder instance with the argument inserted
-
handler
public @NonNull Command.Builder<C> handler(@NonNull CommandExecutionHandler<C> commandExecutionHandler) Specifies the command execution handler.- Parameters:
commandExecutionHandler- New execution handler- Returns:
- new builder instance using the command execution handler
-
futureHandler
public @NonNull Command.Builder<C> futureHandler(@NonNull CommandExecutionHandler.FutureCommandExecutionHandler<C> commandExecutionHandler) Specifies the command execution handler.- Parameters:
commandExecutionHandler- New execution handler- Returns:
- new builder instance using the command execution handler
-
handler
Returns the current command execution handler.- Returns:
- the current handler
-
prependHandler
@API(status=STABLE) public @NonNull Command.Builder<C> prependHandler(@NonNull CommandExecutionHandler<C> handler) Sets a new command execution handler that invokes the givenhandlerbefore the currenthandler.- Parameters:
handler- the handler to invoke before the current handler- Returns:
- new builder instance
-
appendHandler
@API(status=STABLE) public @NonNull Command.Builder<C> appendHandler(@NonNull CommandExecutionHandler<C> handler) Sets a new command execution handler that invokes the givenhandlerafter the currenthandler.- Parameters:
handler- the handler to invoke after the current handler- Returns:
- new builder instance
-
senderType
Specifies a required sender type.- Type Parameters:
N- the new sender type or a superclass thereof- Parameters:
senderType- required sender type- Returns:
- new builder instance using the required sender type
-
senderType
public <N extends C> @NonNull Command.Builder<N> senderType(@NonNull TypeToken<? extends N> senderType) Specifies a required sender type.- Type Parameters:
N- the new sender type or a superclass thereof- Parameters:
senderType- required sender type- Returns:
- new builder instance using the required sender type
-
permission
Specifies a command permission.- Parameters:
permission- the command permission- Returns:
- new builder instance using the command permission
-
permission
Specifies a command permission.- Parameters:
permission- the command permission- Returns:
- new builder instance using the command permission
-
permission
Specifies a command permission.- Parameters:
permission- the command permission- Returns:
- new builder instance using the command permission
-
proxies
Makes the current command be a proxy of the supplied command. TThis means that all the proxied command's variable command arguments will be inserted into this builder instance, in the order they are declared in the proxied command. Furthermore, the proxied command's command handler will be shown by the command that is currently being built. If the current command builder does not have a permission node set, this too will be copied.
- Type Parameters:
N- new command sender type- Parameters:
command- the command to proxy- Returns:
- new builder that proxies the given command
-
flag
Registers a new command flag.- Type Parameters:
T- flag value type- Parameters:
flag- flag- Returns:
- new builder instance that uses the provided flag
-
flag
Registers a new command flag.- Type Parameters:
T- flag value type- Parameters:
builder- flag builder.CommandFlag.Builder.build()will be invoked.- Returns:
- new builder instance that uses the provided flag
-
build
Builds a command using the builder instance.- Returns:
- built command
-