Package ca.stellardrift.colonel.api
Class ServerArgumentType.Builder<T extends com.mojang.brigadier.arguments.ArgumentType<?>>
- java.lang.Object
-
- ca.stellardrift.colonel.api.ServerArgumentType.Builder<T>
-
- Type Parameters:
T- type of argument type
- Enclosing class:
- ServerArgumentType<T extends com.mojang.brigadier.arguments.ArgumentType<?>>
public abstract static class ServerArgumentType.Builder<T extends com.mojang.brigadier.arguments.ArgumentType<?>> extends Object
A builder forServerArgumentTypesAll values except for
ServerArgumentType.fallbackSuggestions()are required.
-
-
Constructor Summary
Constructors Constructor Description Builder()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract ServerArgumentType.Builder<T>fallbackProvider(Function<T,com.mojang.brigadier.arguments.ArgumentType<?>> provider)Set the provider to be sent to clients without this argument type.abstract ServerArgumentType.Builder<T>fallbackSuggestions(@Nullable com.mojang.brigadier.suggestion.SuggestionProvider<?> suggestions)Set the suggestion provider that will be set to clients that don't have this argument type.ServerArgumentType<T>register()Complete the builder and register the argument with the VanillaArgumentTypesregistry.abstract ServerArgumentType.Builder<T>serializer(ArgumentSerializer<T> serial)Set the serializer for the native argument typeabstract ServerArgumentType.Builder<T>type(Class<? super T> type)Set the native argument type.
-
-
-
Constructor Detail
-
Builder
public Builder()
-
-
Method Detail
-
type
public abstract ServerArgumentType.Builder<T> type(Class<? super T> type)
Set the native argument type.A superclass is accepted within the type parameter to allow for parameterized argument types. This does not allow for extensions types.
- Parameters:
type- Native argument type- Returns:
- this
-
serializer
public abstract ServerArgumentType.Builder<T> serializer(ArgumentSerializer<T> serial)
Set the serializer for the native argument type- Parameters:
serial- serializer- Returns:
- this
-
fallbackProvider
public abstract ServerArgumentType.Builder<T> fallbackProvider(Function<T,com.mojang.brigadier.arguments.ArgumentType<?>> provider)
Set the provider to be sent to clients without this argument type.The returned argument type may be provided as
- Parameters:
provider- function taking own argument type and creating a- Returns:
- this
-
fallbackSuggestions
public abstract ServerArgumentType.Builder<T> fallbackSuggestions(@Nullable com.mojang.brigadier.suggestion.SuggestionProvider<?> suggestions)
Set the suggestion provider that will be set to clients that don't have this argument type.By default, this is
SuggestionProviders.ASK_SERVER, in order to use the full argument type's suggestions. However, if the fallback type provides its own suggestions that meet requirements, this can be explicitly set to null- Parameters:
suggestions- Provider for suggestions that will be sent to the client.- Returns:
- this
-
register
public ServerArgumentType<T> register()
Complete the builder and register the argument with the VanillaArgumentTypesregistry.- Returns:
- the constructed argument type data.
-
-