Class Formatter
- java.lang.Object
-
- net.kyori.adventure.text.minimessage.tag.resolver.Formatter
-
public final class Formatter extends Object
Tag resolvers producing tags that insert formatted values.These are effectively placeholders.
- Since:
- 4.11.0
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static @NotNull TagResolver
choice(@NotNull String key, Number number)
Creates a replacement that inserts a choice formatted text.static @NotNull TagResolver
date(@NotNull String key, @NotNull TemporalAccessor time)
Creates a replacement that inserts a date or a time as a component.static @NotNull TagResolver
number(@NotNull String key, @NotNull Number number)
Creates a replacement that inserts a number as a component.
-
-
-
Method Detail
-
number
@NotNull public static @NotNull TagResolver number(@NotNull @NotNull String key, @NotNull @NotNull Number number)
Creates a replacement that inserts a number as a component. The component will be formatted by the provided DecimalFormat.This tag accepts a locale, a format pattern, both or nothing as arguments. The locale has to be provided as first argument.
Refer to
Locale
for usable locale tags. Refer toDecimalFormat
for usable patterns.This replacement is auto-closing, so its style will not influence the style of following components.
- Parameters:
key
- the keynumber
- the number- Returns:
- the placeholder
- Since:
- 4.11.0
-
date
@NotNull public static @NotNull TagResolver date(@NotNull @NotNull String key, @NotNull @NotNull TemporalAccessor time)
Creates a replacement that inserts a date or a time as a component. The component will be formatted by the provided Date Format.This tag expects a format as attribute. Refer to
DateTimeFormatter
for usable patterns.This replacement is auto-closing, so its style will not influence the style of following components.
- Parameters:
key
- the keytime
- the time- Returns:
- the placeholder
- Since:
- 4.11.0
-
choice
@NotNull public static @NotNull TagResolver choice(@NotNull @NotNull String key, Number number)
Creates a replacement that inserts a choice formatted text. The component will be formatted by the provided ChoiceFormat.This tag expectes a format as attribute. Refer to
ChoiceFormat
for usable patterns.This replacement is auto-closing, so its style will not influence the style of following components.
- Parameters:
key
- the keynumber
- the number- Returns:
- the placeholder
- Since:
- 4.11.0
-
-