Resolved styling issue (#67) and fixed server stat becoming negative (#66)

This commit is contained in:
Artemis-the-gr8 2022-06-23 19:24:43 +02:00
parent 8e0666bceb
commit b6be510462
2 changed files with 4 additions and 6 deletions

View File

@ -205,7 +205,7 @@ public class MessageFactory {
return topList.build();
}
public TextComponent formatServerStat(String statName, String subStatEntry, int stat) {
public TextComponent formatServerStat(String statName, String subStatEntry, long stat) {
return Component.text()
.append(titleComponent(Query.SERVER, config.getServerTitle()))
.append(space())
@ -317,10 +317,8 @@ public class MessageFactory {
.append(text(")"))
.color(getColorFromString(config.getSubStatNameFormatting(selection, false)));
subStat.decorations(TextDecoration.NAMES.values(), false);
if (style != null) subStat.decoration(style, TextDecoration.State.TRUE);
else {
subStat.decorations(TextDecoration.NAMES.values(), false);
}
return subStat.build();
}
else {
@ -328,7 +326,7 @@ public class MessageFactory {
}
}
protected TextComponent statNumberComponent(Query selection, int number) {
protected TextComponent statNumberComponent(Query selection, long number) {
return getComponent(number + "",
getColorFromString(config.getStatNumberFormatting(selection, false)),
getStyleFromString(config.getStatNumberFormatting(selection, true)));

View File

@ -126,7 +126,7 @@ public class StatThread extends Thread {
.limit(config.getTopListMaxSize()).collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue, (e1, e2) -> e1, LinkedHashMap::new));
}
private int getServerTotal() {
private long getServerTotal() {
List<Integer> numbers = getAllStats().values().stream().toList();
return numbers.parallelStream().mapToInt(Integer::intValue).sum();
}