Interface Parameter.Value.Builder<T>
- All Superinterfaces:
- AbstractBuilder<Parameter.Value<T>>,- Builder<Parameter.Value<T>,,- Parameter.Value.Builder<T>> - ResettableBuilder<Parameter.Value<T>,- Parameter.Value.Builder<T>> 
- Enclosing interface:
- Parameter.Value<T>
Parameter from constituent components.- 
Method SummaryModifier and TypeMethodDescriptiondefault <V extends ValueParser<? extends T>>
 Parameter.Value.Builder<T>addParser(@NonNull DefaultedRegistryReference<V> parser) TheValueParserthat will extract the value(s) from the parameters.addParser(ValueParser<? extends T> parser) TheValueParserthat will extract the value(s) from the parameters.build()Creates aParameterfrom the builder.completer(@Nullable ValueCompleter completer) Provides a function that provides tab completionsIf set, this parameter will repeat until the argument string has been parsed.The key that the parameter will place parsed values into.key(Parameter.Key<T> key) The key that the parameter will place parsed values into.modifier(@Nullable ValueParameterModifier<T> modifier) Provides a modifier that allows for the modification of the outcome of an argument parse or a completion.optional()Marks this parameter as optional, such that if an argument does not exist or cannot be parsed, an exception is not thrown, and no value is returned.requiredPermission(@Nullable String permission) requirements(@Nullable Predicate<CommandCause> executionRequirements) Sets a function that determines what is required of the providedCausebefore this parameter attempts to parse.terminal()Marks this parameter as a terminal parameter.usage(@Nullable ValueUsage usage) Sets the usage.
- 
Method Details- 
keyThe key that the parameter will place parsed values into.This is a mandatory element. - Parameters:
- key- The key.
- Returns:
- This builder, for chaining
 
- 
keyThe key that the parameter will place parsed values into.This is a mandatory element. - Parameters:
- key- The key.
- Returns:
- This builder, for chaining
 
- 
addParserTheValueParserthat will extract the value(s) from the parameters. If this is aValueParameter, the object's complete and usage methods will be used for completion and usage unless this builder'scompleter(ValueCompleter)} andusage(ValueUsage)methods are specified.- Parameters:
- parser- The- ValueParameterto use
- Returns:
- This builder, for chaining
 
- 
addParserdefault <V extends ValueParser<? extends T>> Parameter.Value.Builder<T> addParser(@NonNull DefaultedRegistryReference<V> parser) TheValueParserthat will extract the value(s) from the parameters. If this is aValueParameter, the object's complete and usage methods will be used for completion and usage unless this builder'scompleter(ValueCompleter)} andusage(ValueUsage)methods are specified.- Type Parameters:
- V- The- ValueParserto be used as a parser
- Parameters:
- parser- The- ValueParserto use
- Returns:
- This builder, for chaining
 
- 
completerProvides a function that provides tab completionsOptional. If this is null(or never set), completions will either be done via the suppliedaddParser(ValueParser)or will just return an empty list. If this is supplied, no modifiers will run on completion.- Parameters:
- completer- The- ValueCompleter
- Returns:
- This builder, for chaining
 
- 
modifierProvides a modifier that allows for the modification of the outcome of an argument parse or a completion. This is primarily intended for use with Mojang/Sponge standard parameters, allowing developers to tweak the input of a standard parameter without having to worry about completion types.Developers should only use this when they use a parameter type that they do not control. If you are using this with a ValueParameter,ValueParserorValueCompleterthat you control (that is, able to modify the source of), it is strongly recommended that you do that instead. For more information about how a modifier should be used, read theValueParameterModifierdocs instead.Optional. If this is null(or never set), any outcomes will not be modified.- Parameters:
- modifier- The modifier
- Returns:
- This builder, for chaning
 
- 
usageSets the usage. TheFunctionaccepts the parameter key and the callingCause.Optional. If this is null(or never set), the usage string will either be provided via the suppliedaddParser(ValueParser)or will just return the parameter's key. If this is supplied, no modifiers will run on usage.- Parameters:
- usage- The function
- Returns:
- This builder, for chaining
 
- 
requiredPermissionSets a function that determines what is required of the appropriateSubjectin the providedCausebefore this parameter is parsed.If the source does not have this permission, this parameter will simply be skipped. Consider combining this with optional()so that those with permission can also skip this parameter.- Parameters:
- permission- The permission to check for, or- nullfor no check.
- Returns:
- This builder, for chaining
 
- 
requirementsSets a function that determines what is required of the providedCausebefore this parameter attempts to parse.If this is set to null, this parameter will always attempt to parse, subject to other modifiers.Note: this will overwrite any requirements set using requiredPermission(String)}.- Parameters:
- executionRequirements- A function that sets the
- Returns:
- This builder, for chaining
 
- 
consumeAllRemainingParameter.Value.Builder<T> consumeAllRemaining()If set, this parameter will repeat until the argument string has been parsed.For example, if you have the argument string, 1 2 3 4and you use ResourceKeyedValueParameters.INTEGERwithout setting this method, this parameter will parse the first element, 1, and the remaining elements will be left for the next parameter in the chain. If you call this method, the resultingParameter.Valuewill continuously parse the argument string until either:- The entire argument string has been parsed, in which case the parsing is considered complete and command execution will continue
- A part of the argument string could not be parsed, in which
     case an exception will be raised. If this element is also marked
     as optional(), then parsing will continue as if nothing has been parsed.
 Unless marked as optional, this element must be able to consume at least one argument. This will automatically mark the element as terminal.- Returns:
- This builder, for chaining
 
- 
optionalParameter.Value.Builder<T> optional()Marks this parameter as optional, such that if an argument does not exist or cannot be parsed, an exception is not thrown, and no value is returned.- Returns:
- This builder, for chaining
 
- 
terminalParameter.Value.Builder<T> terminal()Marks this parameter as a terminal parameter. Any terminal parameter can be considered as a point where argument parsing can stop, allowing control to pass to the command's associatedCommandExecutor.Note that a parameter may be considered terminal even if this isn't set, including if the parameter will consume the rest of the argument string, or if all following arguments are optional(). In these scenarios, the built parameter may not be aware of its terminal status.- Returns:
- This builder, for chaining.
 
- 
buildParameter.Value<T> build()Creates aParameterfrom the builder.- Specified by:
- buildin interface- AbstractBuilder<T>
- Returns:
- The Parameter
 
 
-