public static @NotNull TagResolver number(@TagPattern final @NotNull String key, final @NotNull Number number) {
    return TagResolver.resolver(key, (argumentQueue, context) -> {
      final NumberFormat decimalFormat;
      if (argumentQueue.hasNext()) {
        final String locale = argumentQueue.pop().value();
        if (argumentQueue.hasNext()) {
          final String format = argumentQueue.pop().value();
          decimalFormat = new DecimalFormat(format, new DecimalFormatSymbols(Locale.forLanguageTag(locale)));
        } else {
          if (locale.contains(".")) {
            decimalFormat = new DecimalFormat(locale, DecimalFormatSymbols.getInstance());
          } else {
            decimalFormat = DecimalFormat.getInstance(Locale.forLanguageTag(locale));
          }
        }
      } else {
        decimalFormat = DecimalFormat.getInstance();
      }
      return Tag.inserting(context.deserialize(decimalFormat.format(number)));
    });
  }
Creates a replacement that inserts a number as a component. The component will be formatted by the provided DecimalFormat.

<p>This tag accepts a locale, a format pattern, both or nothing as arguments. The locale has to be provided as first argument.</p>

<p>Refer to {@link Locale} for usable locale tags. Refer to {@link DecimalFormat} for usable patterns.</p>

<p>This replacement is auto-closing, so its style will not influence the style of following components.</p>

@param key the key
@param number the number
@return the placeholder
@since 4.11.0
text-minimessage/src/main/java/net/kyori/adventure/text/minimessage/tag/resolver/Formatter.java