java.lang.Object
net.kyori.adventure.text.minimessage.translation.Argument

public final class Argument extends Object
A utility class to create arguments for translatable components. This is intended to be used with a MiniMessageTranslator instance to allow for <name> tags.

Static methods on this class work by creating virtual components that store data about the argument. The MiniMessage translator instance detects these virtual components to use the name provided as tag names to replace the <arg> tag.

As the names provided to all static methods in this class are used to create tags, they must be valid tag names.

Since:
4.20.0
  • Method Details

    • bool

      @NotNull public static @NotNull ComponentLike bool(@TagPattern @NotNull @NotNull String name, boolean value)
      Creates a named boolean argument.
      Parameters:
      name - the name
      value - the value
      Returns:
      the named argument
      Since:
      4.20.0
    • numeric

      @NotNull public static @NotNull ComponentLike numeric(@TagPattern @NotNull @NotNull String name, @NotNull @NotNull Number value)
      Creates a named numeric argument.
      Parameters:
      name - the name
      value - the value
      Returns:
      the named argument
      Since:
      4.20.0
    • numeric

      @NotNull public static @NotNull ComponentLike numeric(@TagPattern @NotNull @NotNull String name, @NotNull @NotNull String value)
      Creates a named string argument.
      Parameters:
      name - the name
      value - the value
      Returns:
      the named argument
      Since:
      4.20.0
    • component

      @NotNull public static @NotNull ComponentLike component(@TagPattern @NotNull @NotNull String name, @NotNull @NotNull ComponentLike value)
      Creates a named component argument.
      Parameters:
      name - the name
      value - the value
      Returns:
      the named argument
      Since:
      4.20.0
    • argument

      @NotNull public static @NotNull ComponentLike argument(@TagPattern @NotNull @NotNull String name, @NotNull @NotNull TranslationArgumentLike argument)
      Creates a named translation argument.
      Parameters:
      name - the name
      argument - the translation argument
      Returns:
      the named argument
      Since:
      4.20.0
    • argument

      @NotNull public static @NotNull ComponentLike argument(@TagPattern @NotNull @NotNull String name, @NotNull @NotNull TranslationArgument argument)
      Creates a named translation argument.
      Parameters:
      name - the name
      argument - the translation argument
      Returns:
      the named argument
      Since:
      4.20.0
    • tag

      @NotNull public static @NotNull ComponentLike tag(@TagPattern @NotNull @NotNull String name, @NotNull @NotNull Tag tag)
      Creates a named tag argument.
      Parameters:
      name - the name
      tag - the tag
      Returns:
      the named argument
      Since:
      4.20.0
    • tagResolver

      @NotNull public static @NotNull ComponentLike tagResolver(@NotNull @NotNull TagResolver @NotNull ... resolvers)
      Creates an argument used to add arbitrary tag resolvers to the deserialization process.
      Parameters:
      resolvers - the resolvers
      Returns:
      the argument
      Since:
      4.20.0
    • tagResolver

      @NotNull public static @NotNull ComponentLike tagResolver(@NotNull @NotNull Iterable<TagResolver> resolvers)
      Creates an argument used to add arbitrary tag resolvers to the deserialization process.
      Parameters:
      resolvers - the resolvers
      Returns:
      the argument
      Since:
      4.20.0
    • tagResolver

      @NotNull public static @NotNull ComponentLike tagResolver(@NotNull @NotNull TagResolver tagResolver)
      Creates an argument used to add arbitrary tag resolvers to the deserialization process.
      Parameters:
      tagResolver - the tag resolver
      Returns:
      the argument
      Since:
      4.20.0
    • target

      @NotNull public static @NotNull ComponentLike target(@NotNull @NotNull Pointered target)
      Creates an argument used to set the target of the deserialization process.
      Parameters:
      target - the target
      Returns:
      the argument
      Since:
      4.20.0