1
0
Fork 0
mirror of https://github.com/xHyroM/lighteco.git synced 2024-09-19 21:03:18 +02:00

feat(bukkit): add balance_formatted

This commit is contained in:
Jozef Steinhübl 2023-08-30 13:53:27 +02:00
parent f0fda5bcbf
commit 97939ff379
2 changed files with 12 additions and 3 deletions

View file

@ -40,11 +40,16 @@ public class PlaceholderAPIExpansion extends PlaceholderExpansion {
Currency currency = this.plugin.getCurrencyManager().getIfLoaded(currencyIdentifier); Currency currency = this.plugin.getCurrencyManager().getIfLoaded(currencyIdentifier);
if (currency == null) return null; 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();
switch (type.toLowerCase()) {
case "balance" -> {
return user.getBalance(currency).toPlainString(); return user.getBalance(currency).toPlainString();
} }
case "balance_formatted" -> {
return currency.format(user.getBalance(currency));
}
}
return null; return null;
} }

View file

@ -24,6 +24,10 @@ public class Currency {
return proxy.getType(); return proxy.getType();
} }
public String format(BigDecimal amount) {
return proxy.format(amount);
}
public BigDecimal getDefaultBalance() { public BigDecimal getDefaultBalance() {
return proxy.getDefaultBalance(); return proxy.getDefaultBalance();
} }