diff --git a/bukkit/src/main/java/dev/xhyrom/lighteco/bukkit/hooks/PlaceholderAPIExpansion.java b/bukkit/src/main/java/dev/xhyrom/lighteco/bukkit/hooks/PlaceholderAPIExpansion.java index 68ce971..a4162ad 100644 --- a/bukkit/src/main/java/dev/xhyrom/lighteco/bukkit/hooks/PlaceholderAPIExpansion.java +++ b/bukkit/src/main/java/dev/xhyrom/lighteco/bukkit/hooks/PlaceholderAPIExpansion.java @@ -40,10 +40,15 @@ public class PlaceholderAPIExpansion extends PlaceholderExpansion { Currency currency = this.plugin.getCurrencyManager().getIfLoaded(currencyIdentifier); if (currency == null) return null; - if (type.equalsIgnoreCase("balance")) { - User user = this.plugin.getUserManager().loadUser(player.getUniqueId()).join(); + User user = this.plugin.getUserManager().loadUser(player.getUniqueId()).join(); - return user.getBalance(currency).toPlainString(); + switch (type.toLowerCase()) { + case "balance" -> { + return user.getBalance(currency).toPlainString(); + } + case "balance_formatted" -> { + return currency.format(user.getBalance(currency)); + } } return null; diff --git a/common/src/main/java/dev/xhyrom/lighteco/common/model/currency/Currency.java b/common/src/main/java/dev/xhyrom/lighteco/common/model/currency/Currency.java index f6595e4..92a3262 100644 --- a/common/src/main/java/dev/xhyrom/lighteco/common/model/currency/Currency.java +++ b/common/src/main/java/dev/xhyrom/lighteco/common/model/currency/Currency.java @@ -24,6 +24,10 @@ public class Currency { return proxy.getType(); } + public String format(BigDecimal amount) { + return proxy.format(amount); + } + public BigDecimal getDefaultBalance() { return proxy.getDefaultBalance(); }