better formatting for numbers

This commit is contained in:
hyperdefined
2022-10-12 13:04:35 -04:00
parent 2b75ea094d
commit 7639943fea
5 changed files with 33 additions and 29 deletions

View File

@@ -110,6 +110,7 @@ public class SheepShear implements Listener {
}
List<String> lore;
String newLine = sheepShearedLoreRaw.replace("{sheep}", toolStats.commaFormat.format(sheepSheared));
if (meta.hasLore()) {
lore = meta.getLore();
boolean hasLore = false;
@@ -118,18 +119,18 @@ public class SheepShear implements Listener {
for (int x = 0; x < lore.size(); x++) {
if (lore.get(x).contains(sheepShearedLore)) {
hasLore = true;
lore.set(x, sheepShearedLoreRaw.replace("{sheep}", toolStats.commaFormat.format(sheepSheared)));
lore.set(x, newLine);
break;
}
}
// if the item has lore but doesn't have the tag, add it
if (!hasLore) {
lore.add(sheepShearedLoreRaw.replace("{sheep}", toolStats.commaFormat.format(sheepSheared)));
lore.add(newLine);
}
} else {
// if the item has no lore, create a new list and add the string
lore = new ArrayList<>();
lore.add(sheepShearedLoreRaw.replace("{sheep}", toolStats.commaFormat.format(sheepSheared)));
lore.add(newLine);
}
if (toolStats.config.getBoolean("enabled.sheep-sheared")) {
meta.setLore(lore);