Class RegistryArgumentExtractor

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

@NullMarked public final class RegistryArgumentExtractor extends Object
Utilities for extracting registry-related arguments from a CommandContext.
  • Method Details

    • getTypedKey

      public static <T, S> TypedKey<T> getTypedKey(com.mojang.brigadier.context.CommandContext<S> context, RegistryKey<T> registryKey, 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