mirror of
https://github.com/xHyroM/lighteco.git
synced 2024-11-12 18:38:07 +01:00
feat(bukkit): add balance_formatted
This commit is contained in:
parent
f0fda5bcbf
commit
97939ff379
2 changed files with 12 additions and 3 deletions
|
@ -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;
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue