diff --git a/src/main/java/com/gmail/artemis/the/gr8/playerstats/msg/ComponentFactory.java b/src/main/java/com/gmail/artemis/the/gr8/playerstats/msg/ComponentFactory.java index 1e01f97..dfeaccf 100644 --- a/src/main/java/com/gmail/artemis/the/gr8/playerstats/msg/ComponentFactory.java +++ b/src/main/java/com/gmail/artemis/the/gr8/playerstats/msg/ComponentFactory.java @@ -158,7 +158,6 @@ public class ComponentFactory { .args(subStat)); } - //TODO Add hoverComponent with full number public TextComponent.Builder statNumberBuilder(String prettyNumber, Target selection) { return getComponentBuilder(prettyNumber, getColorFromString(config.getStatNumberDecoration(selection, false)), diff --git a/src/main/java/com/gmail/artemis/the/gr8/playerstats/msg/MessageWriter.java b/src/main/java/com/gmail/artemis/the/gr8/playerstats/msg/MessageWriter.java index f77dee9..48f0f4a 100644 --- a/src/main/java/com/gmail/artemis/the/gr8/playerstats/msg/MessageWriter.java +++ b/src/main/java/com/gmail/artemis/the/gr8/playerstats/msg/MessageWriter.java @@ -116,7 +116,7 @@ public class MessageWriter { .append(space()) .append(getStatNameComponent(request)) .append(getStatUnitComponent(request.getStatistic(), request.getSelection())) - .build(); + .build(); //space is provided by statUnitComponent } public TextComponent formatTopStats(@NotNull LinkedHashMap topStats, @NotNull StatRequest request) { @@ -125,7 +125,7 @@ public class MessageWriter { .append(componentFactory.pluginPrefixComponent(request.isBukkitConsoleSender())).append(space()) .append(componentFactory.titleComponent(config.getTopStatsTitle(), Target.TOP)).append(space()) .append(componentFactory.titleNumberComponent(topStats.size())).append(space()) - .append(getStatNameComponent(request)) + .append(getStatNameComponent(request)) //space is provided by statUnitComponent .append(getStatUnitComponent(request.getStatistic(), request.getSelection())); ArrayList timeUnits = null; @@ -227,7 +227,7 @@ public class MessageWriter { Unit hoverUnit = type == Unit.Type.DISTANCE ? Unit.fromString(config.getDistanceUnit(true)) : Unit.fromString(config.getDamageUnit(true)); String prettyHoverNumber = formatter.format(statNumber, hoverUnit); - MyLogger.logMsg("mainNumber: " + prettyNumber + "\n" + "hoverNumber: " + prettyHoverNumber, DebugLevel.HIGH); + MyLogger.logMsg("mainNumber: " + prettyNumber + ", hoverNumber: " + prettyHoverNumber, DebugLevel.HIGH); if (config.useTranslatableComponents()) { String unitKey = languageKeyHandler.getUnitKey(hoverUnit); if (unitKey == null) { diff --git a/src/main/java/com/gmail/artemis/the/gr8/playerstats/msg/NumberFormatter.java b/src/main/java/com/gmail/artemis/the/gr8/playerstats/msg/NumberFormatter.java index 9f9e26c..a3021fc 100644 --- a/src/main/java/com/gmail/artemis/the/gr8/playerstats/msg/NumberFormatter.java +++ b/src/main/java/com/gmail/artemis/the/gr8/playerstats/msg/NumberFormatter.java @@ -85,34 +85,52 @@ public class NumberFormatter { if (isInRange(max, min, 86400) && leftover >= 86400) { double days = Math.floor(leftover / 86400); leftover = leftover % (86400); - if (smallUnit == Unit.DAY && leftover >= 43200) { - return output.append(format.format(days+1)) + if (smallUnit == Unit.DAY) { + if (leftover >= 43200) { + days++; + } + return output.append(format.format(days)) .append("d").toString(); } output.append(format.format(days)) - .append("d "); + .append("d"); } if (isInRange(max, min, 3600) && leftover >= 3600) { + if (output.toString().contains("d")) { + output.append(" "); + } double hours = Math.floor(leftover / 60 / 60); leftover = leftover % (60 * 60); - if (smallUnit == Unit.HOUR && leftover >= 1800) { - return output.append(format.format(hours+1)) + if (smallUnit == Unit.HOUR) { + if (leftover >= 1800) { + hours++; + } + return output.append(format.format(hours)) .append("h").toString(); } output.append(format.format(hours)) - .append("h "); + .append("h"); } if (isInRange(max, min, 60) && leftover >= 60) { + if (output.toString().contains("h")) { + output.append(" "); + } double minutes = Math.floor(leftover / 60); leftover = leftover % 60; - if (smallUnit == Unit.MINUTE && leftover >= 30) { - return output.append(format.format(minutes+1)) + if (smallUnit == Unit.MINUTE) { + if (leftover >= 30) { + minutes++; + } + return output.append(format.format(minutes)) .append("m").toString(); } output.append(format.format(minutes)) - .append("m "); + .append("m"); } if (isInRange(max, min, 1) && leftover > 0) { + if (output.toString().contains("m")) { + output.append(" "); + } double seconds = Math.ceil(leftover); output.append(format.format(seconds)) .append("s");