Class KeyArgumentType

java.lang.Object
net.kyori.adventure.platform.fabric.KeyArgumentType
All Implemented Interfaces:
com.mojang.brigadier.arguments.ArgumentType<Key>

public final class KeyArgumentType extends Object implements com.mojang.brigadier.arguments.ArgumentType<Key>
An argument that will be decoded as a Key.

For this argument type to fully function, adventure-platform-fabric must also be present on the client. Clients without the mod will receive fallback types existing in the base game.

Since:
4.0.0
  • Method Summary

    Modifier and Type
    Method
    Description
    static @NotNull KeyArgumentType
    key()
    Get an argument type instance for Keys.
    static @NotNull Key
    key(@NotNull com.mojang.brigadier.context.CommandContext<?> ctx, @NotNull String id)
    Get a Key-typed value from a parsed CommandContext.
    @NotNull Key
    parse(@NotNull com.mojang.brigadier.StringReader reader)
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface com.mojang.brigadier.arguments.ArgumentType

    getExamples, listSuggestions
  • Method Details

    • key

      @NotNull public static @NotNull KeyArgumentType key()
      Get an argument type instance for Keys.
      Returns:
      key argument type
      Since:
      4.0.0
    • key

      @NotNull public static @NotNull Key key(@NotNull @NotNull com.mojang.brigadier.context.CommandContext<?> ctx, @NotNull @NotNull String id)
      Get a Key-typed value from a parsed CommandContext.
      Parameters:
      ctx - context to get the value from
      id - id the argument was taken from
      Returns:
      provided argument
      Since:
      4.0.0
    • parse

      @NotNull public @NotNull Key parse(@NotNull @NotNull com.mojang.brigadier.StringReader reader) throws com.mojang.brigadier.exceptions.CommandSyntaxException
      Specified by:
      parse in interface com.mojang.brigadier.arguments.ArgumentType<Key>
      Throws:
      com.mojang.brigadier.exceptions.CommandSyntaxException