Class Argument
java.lang.Object
net.kyori.adventure.text.minimessage.translation.Argument
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 Summary
Modifier and TypeMethodDescriptionstatic @NotNull ComponentLike
argument
(@NotNull String name, @NotNull TranslationArgument argument) Creates a named translation argument.static @NotNull ComponentLike
argument
(@NotNull String name, @NotNull TranslationArgumentLike argument) Creates a named translation argument.static @NotNull ComponentLike
Creates a named boolean argument.static @NotNull ComponentLike
component
(@NotNull String name, @NotNull ComponentLike value) Creates a named component argument.static @NotNull ComponentLike
Creates a named numeric argument.static @NotNull ComponentLike
Creates a named string argument.static @NotNull ComponentLike
Creates a named tag argument.static @NotNull ComponentLike
tagResolver
(@NotNull Iterable<TagResolver> resolvers) Creates an argument used to add arbitrary tag resolvers to the deserialization process.static @NotNull ComponentLike
tagResolver
(@NotNull TagResolver tagResolver) Creates an argument used to add arbitrary tag resolvers to the deserialization process.static @NotNull ComponentLike
tagResolver
(@NotNull TagResolver @NotNull ... resolvers) Creates an argument used to add arbitrary tag resolvers to the deserialization process.static @NotNull ComponentLike
Creates an argument used to set the target of the deserialization process.
-
Method Details
-
bool
@NotNull public static @NotNull ComponentLike bool(@TagPattern @NotNull @NotNull String name, boolean value) Creates a named boolean argument.- Parameters:
name
- the namevalue
- 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 namevalue
- 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 namevalue
- 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 namevalue
- 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 nameargument
- 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 nameargument
- 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 nametag
- 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
Creates an argument used to set the target of the deserialization process.- Parameters:
target
- the target- Returns:
- the argument
- Since:
- 4.20.0
-