Interface VariableValueParameters.Factory
-
- Enclosing class:
- VariableValueParameters
public static interface VariableValueParameters.Factory
A factory that createsValueParameter
s or their builders.
-
-
Method Summary
-
-
-
Method Detail
-
createEnumParameter
<T extends java.lang.Enum<T>> ValueParameter<T> createEnumParameter(java.lang.Class<T> enumClass)
Creates theValueParameter
for the specifiedEnum
- Type Parameters:
T
- The type ofEnum
- Parameters:
enumClass
- TheEnum
type to base the choices on- Returns:
- The
ValueParameter
-
createStaticChoicesBuilder
<T> VariableValueParameters.StaticChoicesBuilder<T> createStaticChoicesBuilder(java.lang.Class<T> returnType)
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(java.lang.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(java.util.List<java.util.function.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
<T> VariableValueParameters.LiteralBuilder<T> createLiteralBuilder(java.lang.Class<T> returnType)
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<java.lang.Integer> createIntegerNumberRangeBuilder()
Creates aVariableValueParameters.NumberRangeBuilder
for integer values.- Returns:
- The
VariableValueParameters.NumberRangeBuilder
-
createFloatNumberRangeBuilder
VariableValueParameters.NumberRangeBuilder<java.lang.Float> createFloatNumberRangeBuilder()
Creates aVariableValueParameters.NumberRangeBuilder
for float values.- Returns:
- The
VariableValueParameters.NumberRangeBuilder
-
createDoubleNumberRangeBuilder
VariableValueParameters.NumberRangeBuilder<java.lang.Double> createDoubleNumberRangeBuilder()
Creates aVariableValueParameters.NumberRangeBuilder
for double values.- Returns:
- The
VariableValueParameters.NumberRangeBuilder
-
createLongNumberRangeBuilder
VariableValueParameters.NumberRangeBuilder<java.lang.Long> createLongNumberRangeBuilder()
Creates aVariableValueParameters.NumberRangeBuilder
for long values.- Returns:
- The
VariableValueParameters.NumberRangeBuilder
-
createValidatedStringParameter
ValueParameter<java.lang.String> createValidatedStringParameter(java.util.regex.Pattern pattern)
Creates aValueParameter
that validates its input against aPattern
.- Parameters:
pattern
- ThePattern
- Returns:
- The
ValueParameter
-
-