From 7a48e590496ae6be9e081e87933fec80dd4c686e Mon Sep 17 00:00:00 2001 From: Artemis-the-gr8 Date: Wed, 2 Nov 2022 13:33:31 +0100 Subject: [PATCH] Added formatDefaultNumber to StatNumberFormatter for API --- pom.xml | 6 +++--- .../the/gr8/playerstats/api/StatNumberFormatter.java | 2 ++ .../the/gr8/playerstats/core/msg/MessageBuilder.java | 4 ++-- .../gr8/playerstats/core/msg/msgutils/NumberFormatter.java | 3 ++- 4 files changed, 9 insertions(+), 6 deletions(-) diff --git a/pom.xml b/pom.xml index 50b63fd..5e70d4a 100644 --- a/pom.xml +++ b/pom.xml @@ -200,7 +200,7 @@ attach-sources - deploy + deploy jar-no-fork @@ -214,7 +214,7 @@ sign-artifacts - deploy + deploy sign @@ -228,7 +228,7 @@ attach-javadocs - deploy + deploy jar diff --git a/src/main/java/com/artemis/the/gr8/playerstats/api/StatNumberFormatter.java b/src/main/java/com/artemis/the/gr8/playerstats/api/StatNumberFormatter.java index a6c2453..3d871af 100644 --- a/src/main/java/com/artemis/the/gr8/playerstats/api/StatNumberFormatter.java +++ b/src/main/java/com/artemis/the/gr8/playerstats/api/StatNumberFormatter.java @@ -4,6 +4,8 @@ import com.artemis.the.gr8.playerstats.api.enums.Unit; public interface StatNumberFormatter { + String formatDefaultNumber(long number); + String formatDamageNumber(long number, Unit statUnit); String formatDistanceNumber(long number, Unit statUnit); diff --git a/src/main/java/com/artemis/the/gr8/playerstats/core/msg/MessageBuilder.java b/src/main/java/com/artemis/the/gr8/playerstats/core/msg/MessageBuilder.java index 86d65e2..76eeb53 100644 --- a/src/main/java/com/artemis/the/gr8/playerstats/core/msg/MessageBuilder.java +++ b/src/main/java/com/artemis/the/gr8/playerstats/core/msg/MessageBuilder.java @@ -564,7 +564,7 @@ public final class MessageBuilder implements StatTextFormatter { ArrayList unitRange = getTimeUnitRange(statNumber); if (unitRange.size() <= 1 || (useHoverText && unitRange.size() <= 3)) { MyLogger.logWarning("There is something wrong with the time-units you specified, please check your config!"); - return componentFactory.timeNumber(formatter.formatNumber(statNumber), target); + return componentFactory.timeNumber(formatter.formatDefaultNumber(statNumber), target); } else { String mainNumber = formatter.formatTimeNumber(statNumber, unitRange.get(0), unitRange.get(1)); @@ -586,7 +586,7 @@ public final class MessageBuilder implements StatTextFormatter { } private TextComponent getDefaultNumberComponent(long statNumber, Target target) { - return componentFactory.statNumber(formatter.formatNumber(statNumber), target); + return componentFactory.statNumber(formatter.formatDefaultNumber(statNumber), target); } /** diff --git a/src/main/java/com/artemis/the/gr8/playerstats/core/msg/msgutils/NumberFormatter.java b/src/main/java/com/artemis/the/gr8/playerstats/core/msg/msgutils/NumberFormatter.java index efdb677..09c4d29 100644 --- a/src/main/java/com/artemis/the/gr8/playerstats/core/msg/msgutils/NumberFormatter.java +++ b/src/main/java/com/artemis/the/gr8/playerstats/core/msg/msgutils/NumberFormatter.java @@ -25,7 +25,8 @@ public final class NumberFormatter implements StatNumberFormatter { /** * Adds commas in groups of 3. */ - public @NotNull String formatNumber(long number) { + @Override + public @NotNull String formatDefaultNumber(long number) { return format.format(number); }