Class RegistryArgumentExtractor

java.lang.Object
io.papermc.paper.command.brigadier.argument.RegistryArgumentExtractor

public final class RegistryArgumentExtractor extends Object
Utilities for extracting registry-related arguments from a CommandContext.
  • 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 type
      S - the sender type
      Parameters:
      context - the command context
      registryKey - the registry key for the typed key
      name - the argument name
      Returns:
      the typed key argument
      Throws:
      IllegalArgumentException - if the registry key doesn't match the typed key