Interface CustomArgumentType.Converted<T,N>

Type Parameters:
T - custom type
N - type with an argument native to vanilla Minecraft (from ArgumentTypes)
All Superinterfaces:
com.mojang.brigadier.arguments.ArgumentType<T>, CustomArgumentType<T,N>
Enclosing interface:
CustomArgumentType<T,N>

@Experimental public static interface CustomArgumentType.Converted<T,N> extends CustomArgumentType<T,N>
An argument type that wraps around a native-to-vanilla argument type. This argument receives special handling in that the native argument type will be sent to the client for possible client-side completions and syntax validation.

The parsed native type will be converted via convert(Object). Implement CustomArgumentType if you want to handle parsing the type manually.

  • Nested Class Summary

    Nested classes/interfaces inherited from interface io.papermc.paper.command.brigadier.argument.CustomArgumentType

    CustomArgumentType.Converted<T,N>
  • Method Summary

    Modifier and Type
    Method
    Description
    convert(N nativeType)
    Converts the value from the native type to the custom argument type.
    default T
    parse(com.mojang.brigadier.StringReader reader)
    Parses the argument into the custom type (T).

    Methods inherited from interface io.papermc.paper.command.brigadier.argument.CustomArgumentType

    getExamples, getNativeType, listSuggestions
  • Method Details

    • parse

      @NonExtendable default T parse(com.mojang.brigadier.StringReader reader) throws com.mojang.brigadier.exceptions.CommandSyntaxException
      Description copied from interface: CustomArgumentType
      Parses the argument into the custom type (T). Keep in mind that this parsing will be done on the server. This means that if you throw a CommandSyntaxException during parsing, this will only show up to the user after the user has executed the command not while they are still entering it.
      Specified by:
      parse in interface com.mojang.brigadier.arguments.ArgumentType<T>
      Specified by:
      parse in interface CustomArgumentType<T,N>
      Parameters:
      reader - string reader input
      Returns:
      parsed value
      Throws:
      com.mojang.brigadier.exceptions.CommandSyntaxException - if an error occurs while parsing
    • convert

      T convert(N nativeType) throws com.mojang.brigadier.exceptions.CommandSyntaxException
      Converts the value from the native type to the custom argument type.
      Parameters:
      nativeType - native argument provided value
      Returns:
      converted value
      Throws:
      com.mojang.brigadier.exceptions.CommandSyntaxException - if an exception occurs while parsing