Skip to content

Commit

Permalink
Fix placeholder rounding
Browse files Browse the repository at this point in the history
  • Loading branch information
dlsf committed Sep 4, 2024
1 parent 1cb2f68 commit 0669bed
Showing 1 changed file with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public List<Placeholder> 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))),
Expand Down Expand Up @@ -87,7 +87,7 @@ public List<Placeholder> 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())));
Expand All @@ -99,8 +99,11 @@ public List<Placeholder> getPlaceholders(Island island) {
});
}

private List<Placeholder> initializeDefaultPlaceholders() {
private String formatDouble(double value) {
return IridiumSkyblock.getInstance().getConfiguration().numberFormatter.format(value);
}

private List<Placeholder> initializeDefaultPlaceholders() {
List<Placeholder> placeholderList = new ArrayList<>(Arrays.asList(
new Placeholder("island_name", IridiumSkyblock.getInstance().getMessages().nullPlaceholder),
new Placeholder("island_owner", IridiumSkyblock.getInstance().getMessages().nullPlaceholder),
Expand Down

0 comments on commit 0669bed

Please sign in to comment.