From 0669bed8b840b6f85e3c41b70e1ae439cc2d7d16 Mon Sep 17 00:00:00 2001 From: Daniel Scherf Date: Wed, 4 Sep 2024 23:55:16 +0200 Subject: [PATCH] Fix placeholder rounding --- .../placeholders/IslandPlaceholderBuilder.java | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/iridium/iridiumskyblock/placeholders/IslandPlaceholderBuilder.java b/src/main/java/com/iridium/iridiumskyblock/placeholders/IslandPlaceholderBuilder.java index 99435f036..051d53737 100644 --- a/src/main/java/com/iridium/iridiumskyblock/placeholders/IslandPlaceholderBuilder.java +++ b/src/main/java/com/iridium/iridiumskyblock/placeholders/IslandPlaceholderBuilder.java @@ -50,7 +50,7 @@ public List getPlaceholders(Island island) { .orElse(IridiumSkyblock.getInstance().getMessages().nullPlaceholder)), new Placeholder("island_create", () -> island.getCreateTime().format(DateTimeFormatter.ofPattern(IridiumSkyblock.getInstance().getConfiguration().dateTimeFormat))), new Placeholder("island_description", island::getDescription), - new Placeholder("island_value", () -> String.valueOf(IridiumSkyblock.getInstance().getTeamManager().getTeamValue(island))), + new Placeholder("island_value", () -> formatDouble(IridiumSkyblock.getInstance().getTeamManager().getTeamValue(island))), new Placeholder("island_level", () -> String.valueOf(island.getLevel())), new Placeholder("island_experience", String.valueOf(island.getExperience())), new Placeholder("island_experienceToLevelUp", String.valueOf(IridiumSkyblock.getInstance().getIslandManager().getTeamExperienceForNextLevel(island))), @@ -87,7 +87,7 @@ public List getPlaceholders(Island island) { } for (BankItem bankItem : IridiumSkyblock.getInstance().getBankItemList()) { - placeholderList.add(new Placeholder("island_bank_" + bankItem.getName().toLowerCase(), () -> String.valueOf(IridiumSkyblock.getInstance().getTeamManager().getTeamBank(island, bankItem.getName()).getNumber()))); + placeholderList.add(new Placeholder("island_bank_" + bankItem.getName().toLowerCase(), () -> formatDouble(IridiumSkyblock.getInstance().getTeamManager().getTeamBank(island, bankItem.getName()).getNumber()))); } for (XMaterial xMaterial : XMaterial.values()) { placeholderList.add(new Placeholder("island_" + xMaterial.name().toLowerCase() + "_amount", () -> String.valueOf(IridiumSkyblock.getInstance().getTeamManager().getTeamBlock(island, xMaterial).getAmount()))); @@ -99,8 +99,11 @@ public List getPlaceholders(Island island) { }); } - private List initializeDefaultPlaceholders() { + private String formatDouble(double value) { + return IridiumSkyblock.getInstance().getConfiguration().numberFormatter.format(value); + } + private List initializeDefaultPlaceholders() { List placeholderList = new ArrayList<>(Arrays.asList( new Placeholder("island_name", IridiumSkyblock.getInstance().getMessages().nullPlaceholder), new Placeholder("island_owner", IridiumSkyblock.getInstance().getMessages().nullPlaceholder),