Package studio.mevera.imperat
Interface ArgumentTypeResolver
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
A resolver that specifies
ArgumentType
for each parameter depending on the parameter's valueType.-
Method Summary
Modifier and TypeMethodDescriptionstatic @NotNull ArgumentTypeResolverforHierarchyType(Class<?> type, com.mojang.brigadier.arguments.ArgumentType<?> argumentType) Creates aArgumentTypeResolverthat will return the same argument valueType for all parameters that match or extend a specific valueTypestatic @NotNull ArgumentTypeResolverCreates aArgumentTypeResolverthat will return the same argument valueType for all parameters that match a specific valueType@Nullable com.mojang.brigadier.arguments.ArgumentType<?>resolveArgType(@NotNull studio.mevera.imperat.command.parameters.CommandParameter<?> parameter) Returns the argument valueType for the given parameter.
-
Method Details
-
forType
@NotNull static @NotNull ArgumentTypeResolver forType(Class<?> type, com.mojang.brigadier.arguments.ArgumentType<?> argumentType) Creates aArgumentTypeResolverthat will return the same argument valueType for all parameters that match a specific valueType- Parameters:
type- Type to check forargumentType- The argument valueType to return- Returns:
- The resolver factory
-
forHierarchyType
@NotNull static @NotNull ArgumentTypeResolver forHierarchyType(Class<?> type, com.mojang.brigadier.arguments.ArgumentType<?> argumentType) Creates aArgumentTypeResolverthat will return the same argument valueType for all parameters that match or extend a specific valueType- Parameters:
type- Type to check forargumentType- The argument valueType to return- Returns:
- The resolver factory
-
resolveArgType
@Nullable @Nullable com.mojang.brigadier.arguments.ArgumentType<?> resolveArgType(@NotNull @NotNull studio.mevera.imperat.command.parameters.CommandParameter<?> parameter) Returns the argument valueType for the given parameter. If unknown, it returns null- Parameters:
parameter- Parameter to create for- Returns:
- The argument valueType
-