Package dev.velix.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 type.-
Method Summary
Modifier and TypeMethodDescriptionstatic @NotNull ArgumentTypeResolverforHierarchyType(Class<?> type, com.mojang.brigadier.arguments.ArgumentType<?> argumentType) Creates aArgumentTypeResolverthat will return the same argument type for all parameters that match or extend a specific typestatic @NotNull ArgumentTypeResolverCreates aArgumentTypeResolverthat will return the same argument type for all parameters that match a specific type@Nullable com.mojang.brigadier.arguments.ArgumentType<?>resolveArgType(@NotNull dev.velix.imperat.command.parameters.CommandParameter<?> parameter) Returns the argument type 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 type for all parameters that match a specific type- Parameters:
type- Type to check forargumentType- The argument type 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 type for all parameters that match or extend a specific type- Parameters:
type- Type to check forargumentType- The argument type to return- Returns:
- The resolver factory
-
resolveArgType
@Nullable @Nullable com.mojang.brigadier.arguments.ArgumentType<?> resolveArgType(@NotNull @NotNull dev.velix.imperat.command.parameters.CommandParameter<?> parameter) Returns the argument type for the given parameter. If unknown, it returns null- Parameters:
parameter- Parameter to create for- Returns:
- The argument type
-