Added formatDefaultNumber to StatNumberFormatter for API

This commit is contained in:
Artemis-the-gr8 2022-11-02 13:33:31 +01:00
parent c4b963a057
commit 7a48e59049
4 changed files with 9 additions and 6 deletions

View File

@ -200,7 +200,7 @@
<executions> <executions>
<execution> <execution>
<id>attach-sources</id> <id>attach-sources</id>
<phase>deploy</phase> <phase>deploy</phase> <!-- change to verify when deploying -->
<goals> <goals>
<goal>jar-no-fork</goal> <goal>jar-no-fork</goal>
</goals> </goals>
@ -214,7 +214,7 @@
<executions> <executions>
<execution> <execution>
<id>sign-artifacts</id> <id>sign-artifacts</id>
<phase>deploy</phase> <phase>deploy</phase> <!-- change to verify when deploying -->
<goals> <goals>
<goal>sign</goal> <goal>sign</goal>
</goals> </goals>
@ -228,7 +228,7 @@
<executions> <executions>
<execution> <execution>
<id>attach-javadocs</id> <id>attach-javadocs</id>
<phase>deploy</phase> <phase>deploy</phase> <!-- change to verify when deploying -->
<goals> <goals>
<goal>jar</goal> <goal>jar</goal>
</goals> </goals>

View File

@ -4,6 +4,8 @@ import com.artemis.the.gr8.playerstats.api.enums.Unit;
public interface StatNumberFormatter { public interface StatNumberFormatter {
String formatDefaultNumber(long number);
String formatDamageNumber(long number, Unit statUnit); String formatDamageNumber(long number, Unit statUnit);
String formatDistanceNumber(long number, Unit statUnit); String formatDistanceNumber(long number, Unit statUnit);

View File

@ -564,7 +564,7 @@ public final class MessageBuilder implements StatTextFormatter {
ArrayList<Unit> unitRange = getTimeUnitRange(statNumber); ArrayList<Unit> unitRange = getTimeUnitRange(statNumber);
if (unitRange.size() <= 1 || (useHoverText && unitRange.size() <= 3)) { if (unitRange.size() <= 1 || (useHoverText && unitRange.size() <= 3)) {
MyLogger.logWarning("There is something wrong with the time-units you specified, please check your config!"); 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 { else {
String mainNumber = formatter.formatTimeNumber(statNumber, unitRange.get(0), unitRange.get(1)); 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) { private TextComponent getDefaultNumberComponent(long statNumber, Target target) {
return componentFactory.statNumber(formatter.formatNumber(statNumber), target); return componentFactory.statNumber(formatter.formatDefaultNumber(statNumber), target);
} }
/** /**

View File

@ -25,7 +25,8 @@ public final class NumberFormatter implements StatNumberFormatter {
/** /**
* Adds commas in groups of 3. * Adds commas in groups of 3.
*/ */
public @NotNull String formatNumber(long number) { @Override
public @NotNull String formatDefaultNumber(long number) {
return format.format(number); return format.format(number);
} }