style: use DecimalFormatter on greplog

from now on i am going to have the types on commits because why not
This commit is contained in:
Chayapak 2024-11-02 14:29:02 +07:00
parent c707309958
commit 71ef35598c
Signed by: ChomeNS
SSH key fingerprint: SHA256:0YoxhdyXsgbc0nfeB2N6FYE60mxMU7DS4uCUMaw2mvA

View file

@ -18,6 +18,7 @@ import java.nio.charset.StandardCharsets;
import java.nio.file.Files; import java.nio.file.Files;
import java.nio.file.NotDirectoryException; import java.nio.file.NotDirectoryException;
import java.nio.file.Path; import java.nio.file.Path;
import java.text.DecimalFormat;
import java.util.Arrays; import java.util.Arrays;
import java.util.Comparator; import java.util.Comparator;
import java.util.regex.Pattern; import java.util.regex.Pattern;
@ -104,10 +105,12 @@ public class GrepLogPlugin {
.queue(message -> { .queue(message -> {
final String url = message.getAttachments().get(0).getUrl(); final String url = message.getAttachments().get(0).getUrl();
final DecimalFormat formatter = new DecimalFormat("#,###");
final Component component = Component.translatable("Found %s matches for %s. You can see the results by clicking %s or in the Discord server.") final Component component = Component.translatable("Found %s matches for %s. You can see the results by clicking %s or in the Discord server.")
.color(ColorUtilities.getColorByString(bot.config.colorPalette.defaultColor)) .color(ColorUtilities.getColorByString(bot.config.colorPalette.defaultColor))
.arguments( .arguments(
Component.text(matches).color(ColorUtilities.getColorByString(bot.config.colorPalette.number)), Component.text(formatter.format(matches)).color(ColorUtilities.getColorByString(bot.config.colorPalette.number)),
Component.text(input).color(ColorUtilities.getColorByString(bot.config.colorPalette.string)), Component.text(input).color(ColorUtilities.getColorByString(bot.config.colorPalette.string)),
Component Component
.text("here") .text("here")