Class Argument

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

      public static ComponentLike bool(@TagPattern 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

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

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

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

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

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

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

      public static ComponentLike tagResolver(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

      public static ComponentLike tagResolver(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

      public static ComponentLike tagResolver(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

      public static ComponentLike target(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