Class RegistryArgumentExtractor
java.lang.Object
io.papermc.paper.command.brigadier.argument.RegistryArgumentExtractor
Utilities for extracting registry-related arguments from a
CommandContext
.-
Method Summary
Modifier and TypeMethodDescriptionstatic <T,
S> @NonNull TypedKey <T> getTypedKey
(@NonNull com.mojang.brigadier.context.CommandContext<S> context, @NonNull RegistryKey<T> registryKey, @NonNull String name) Gets a typed key argument from a command context.
-
Method Details
-
getTypedKey
public static <T,S> @NonNull TypedKey<T> getTypedKey(@NonNull com.mojang.brigadier.context.CommandContext<S> context, @NonNull RegistryKey<T> registryKey, @NonNull String name) Gets a typed key argument from a command context.- Type Parameters:
T
- the value typeS
- the sender type- Parameters:
context
- the command contextregistryKey
- the registry key for the typed keyname
- the argument name- Returns:
- the typed key argument
- Throws:
IllegalArgumentException
- if the registry key doesn't match the typed key
-