Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix placeholder rounding #896

Merged
merged 2 commits into from
Dec 27, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading