Interface VariableValueParameters.Factory
- Enclosing class:
- VariableValueParameters
ValueParameter
s or their builders.-
Method Summary
Modifier and TypeMethodDescriptionCreates aVariableValueParameters.NumberRangeBuilder
for double values.createDynamicChoicesBuilder
(Class<T> returnType) Creates theVariableValueParameters.DynamicChoicesBuilder
that will create objects that parse objects and return results of typeT
.<T extends Enum<T>>
ValueParameter<T>createEnumParameter
(Class<T> enumClass) Creates theValueParameter
for the specifiedEnum
Creates aVariableValueParameters.NumberRangeBuilder
for float values.Creates aVariableValueParameters.NumberRangeBuilder
for integer values.createLiteralBuilder
(Class<T> returnType) Creates theVariableValueParameters.LiteralBuilder
that will create objects that parse objects and return results of typeT
.Creates aVariableValueParameters.NumberRangeBuilder
for long values.createRegistryEntryBuilder
(List<Function<CommandContext, @Nullable RegistryHolder>> holderProvider, RegistryType<T> registryKey) Creates aVariableValueParameters.RegistryEntryBuilder
that retrieves objects from theRegistry
represented by the givenRegistryKey
and the providedRegistryHolder
, which may be determined by the current state of theCommandContext
.Creates aVariableValueParameters.RegistryEntryBuilder
that retrieves objects from the providedDefaultedRegistryReference
, which retrieves an object from the appropriateRegistry
.createRegistryEntryBuilder
(RegistryType<T> registryKey) Creates aVariableValueParameters.RegistryEntryBuilder
that retrieves objects from theRegistry
represented by the givenRegistryKey
and the providedRegistryHolder
, which may be determined by the current state of theCommandContext
.createStaticChoicesBuilder
(Class<T> returnType) Creates theVariableValueParameters.StaticChoicesBuilder
that will create objects that parse objects and return results of typeT
.createValidatedStringParameter
(Pattern pattern) Creates aValueParameter
that validates its input against aPattern
.
-
Method Details
-
createEnumParameter
Creates theValueParameter
for the specifiedEnum
- Type Parameters:
T
- The type ofEnum
- Parameters:
enumClass
- TheEnum
type to base the choices on- Returns:
- The
ValueParameter
-
createStaticChoicesBuilder
Creates theVariableValueParameters.StaticChoicesBuilder
that will create objects that parse objects and return results of typeT
.- Type Parameters:
T
- The parser return type- Parameters:
returnType
- TheClass
ofT
- Returns:
- The builder
-
createDynamicChoicesBuilder
<T> VariableValueParameters.DynamicChoicesBuilder<T> createDynamicChoicesBuilder(Class<T> returnType) Creates theVariableValueParameters.DynamicChoicesBuilder
that will create objects that parse objects and return results of typeT
.- Type Parameters:
T
- The parser return type- Parameters:
returnType
- TheClass
ofT
- Returns:
- The builder
-
createRegistryEntryBuilder
<T> VariableValueParameters.RegistryEntryBuilder<T> createRegistryEntryBuilder(RegistryType<T> registryKey) Creates aVariableValueParameters.RegistryEntryBuilder
that retrieves objects from theRegistry
represented by the givenRegistryKey
and the providedRegistryHolder
, which may be determined by the current state of theCommandContext
.This element can support multiple functions that return
RegistryHolder
s, however order matters, theRegistry
from the first holder that is resolved will be used. Holders may be added viaVariableValueParameters.RegistryEntryBuilder.addHolderFunction(Function)
.- Type Parameters:
T
- The type that the targetRegistry
holds- Parameters:
registryKey
- TheRegistryKey
that represents the targetRegistry
in theRegistryHolder
provided viaholderProvider
.- Returns:
- The
VariableValueParameters.RegistryEntryBuilder
-
createRegistryEntryBuilder
<T> VariableValueParameters.RegistryEntryBuilder<T> createRegistryEntryBuilder(List<Function<CommandContext, @Nullable RegistryHolder>> holderProvider, RegistryType<T> registryKey) Creates aVariableValueParameters.RegistryEntryBuilder
that retrieves objects from theRegistry
represented by the givenRegistryKey
and the providedRegistryHolder
, which may be determined by the current state of theCommandContext
.This element can support multiple functions that return
RegistryHolder
s, however order matters, theRegistry
from the first holder that is resolved will be used. Beyond the holders provided in this function, additional functions that resolve holders can be added throughVariableValueParameters.RegistryEntryBuilder.addHolderFunction(Function)
.Game
andServer
scopedRegistryHolder
providers are available viaVariableValueParameters.RegistryEntryBuilder.GLOBAL_HOLDER_PROVIDER
andVariableValueParameters.RegistryEntryBuilder.SERVER_HOLDER_PROVIDER
.World
scoped providers are available viaVariableValueParameters.RegistryEntryBuilder.WORLD_FROM_CAUSE_HOLDER_PROVIDER
andVariableValueParameters.RegistryEntryBuilder.WORLD_FROM_LOCATABLE_HOLDER_PROVIDER
.- Type Parameters:
T
- The type that the targetRegistry
holds- Parameters:
holderProvider
- AFunction
that provides aRegistryHolder
based on theCommandContext
up to this parameter.registryKey
- TheRegistryKey
that represents the targetRegistry
in theRegistryHolder
provided viaholderProvider
.- Returns:
- The
VariableValueParameters.RegistryEntryBuilder
-
createRegistryEntryBuilder
<T> VariableValueParameters.RegistryEntryBuilder<T> createRegistryEntryBuilder(DefaultedRegistryType<T> type) Creates aVariableValueParameters.RegistryEntryBuilder
that retrieves objects from the providedDefaultedRegistryReference
, which retrieves an object from the appropriateRegistry
.- Type Parameters:
T
- The type that the targetRegistry
holds- Parameters:
type
- The registry type- Returns:
- The
VariableValueParameters.RegistryEntryBuilder
-
createLiteralBuilder
Creates theVariableValueParameters.LiteralBuilder
that will create objects that parse objects and return results of typeT
.- Type Parameters:
T
- The parser return type- Parameters:
returnType
- TheClass
ofT
- Returns:
- The builder
-
createIntegerNumberRangeBuilder
VariableValueParameters.NumberRangeBuilder<Integer> createIntegerNumberRangeBuilder()Creates aVariableValueParameters.NumberRangeBuilder
for integer values.- Returns:
- The
VariableValueParameters.NumberRangeBuilder
-
createFloatNumberRangeBuilder
VariableValueParameters.NumberRangeBuilder<Float> createFloatNumberRangeBuilder()Creates aVariableValueParameters.NumberRangeBuilder
for float values.- Returns:
- The
VariableValueParameters.NumberRangeBuilder
-
createDoubleNumberRangeBuilder
VariableValueParameters.NumberRangeBuilder<Double> createDoubleNumberRangeBuilder()Creates aVariableValueParameters.NumberRangeBuilder
for double values.- Returns:
- The
VariableValueParameters.NumberRangeBuilder
-
createLongNumberRangeBuilder
VariableValueParameters.NumberRangeBuilder<Long> createLongNumberRangeBuilder()Creates aVariableValueParameters.NumberRangeBuilder
for long values.- Returns:
- The
VariableValueParameters.NumberRangeBuilder
-
createValidatedStringParameter
Creates aValueParameter
that validates its input against aPattern
.- Parameters:
pattern
- ThePattern
- Returns:
- The
ValueParameter
-