diff --git a/src/main/java/com/gmail/artemis/the/gr8/playerstats/msg/MessageFactory.java b/src/main/java/com/gmail/artemis/the/gr8/playerstats/msg/MessageFactory.java index e411bc9..17580e7 100644 --- a/src/main/java/com/gmail/artemis/the/gr8/playerstats/msg/MessageFactory.java +++ b/src/main/java/com/gmail/artemis/the/gr8/playerstats/msg/MessageFactory.java @@ -4,6 +4,7 @@ import com.gmail.artemis.the.gr8.playerstats.enums.Query; import com.gmail.artemis.the.gr8.playerstats.config.ConfigHandler; import com.gmail.artemis.the.gr8.playerstats.utils.EnumHandler; import com.gmail.artemis.the.gr8.playerstats.utils.MyLogger; +import com.gmail.artemis.the.gr8.playerstats.utils.NumberFormatter; import net.kyori.adventure.text.Component; import net.kyori.adventure.text.TextComponent; import net.kyori.adventure.text.TranslatableComponent; @@ -327,7 +328,7 @@ public class MessageFactory { } protected TextComponent statNumberComponent(Query selection, long number) { - return getComponent(number + "", + return getComponent(NumberFormatter.format(number), getColorFromString(config.getStatNumberFormatting(selection, false)), getStyleFromString(config.getStatNumberFormatting(selection, true))); } diff --git a/src/main/java/com/gmail/artemis/the/gr8/playerstats/utils/NumberFormatter.java b/src/main/java/com/gmail/artemis/the/gr8/playerstats/utils/NumberFormatter.java new file mode 100644 index 0000000..406be31 --- /dev/null +++ b/src/main/java/com/gmail/artemis/the/gr8/playerstats/utils/NumberFormatter.java @@ -0,0 +1,20 @@ +package com.gmail.artemis.the.gr8.playerstats.utils; + +import java.text.DecimalFormat; + +public class NumberFormatter { + + private static final DecimalFormat format; + + static{ + format = new DecimalFormat(); + format.setGroupingUsed(true); + format.setGroupingSize(3); + } + private NumberFormatter(){ + } + + public static String format(long number) { + return format.format(number); + } +}