mirror of
https://github.com/CitizensDev/Citizens2.git
synced 2025-02-16 12:21:25 +01:00
Use format instead of manual formatting in MoneyAction
This commit is contained in:
parent
8cc2f0ea48
commit
5620d3373f
@ -19,8 +19,6 @@ import net.milkbowl.vault.economy.Economy;
|
||||
public class MoneyAction extends NPCShopAction {
|
||||
@Persist
|
||||
public double money;
|
||||
@Persist
|
||||
private String formattedMoney;
|
||||
|
||||
public MoneyAction() {
|
||||
}
|
||||
@ -32,11 +30,7 @@ public class MoneyAction extends NPCShopAction {
|
||||
@Override
|
||||
public String describe() {
|
||||
Economy economy = Bukkit.getServicesManager().getRegistration(Economy.class).getProvider();
|
||||
return getFormattedMoney() + " " + economy.currencyNamePlural();
|
||||
}
|
||||
|
||||
private String getFormattedMoney() {
|
||||
return formattedMoney == null || formattedMoney.isEmpty() ? Double.toString(money) : formattedMoney;
|
||||
return economy.format(money);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -93,7 +87,6 @@ public class MoneyAction extends NPCShopAction {
|
||||
return false;
|
||||
|
||||
action.money = result;
|
||||
action.formattedMoney = !Messaging.stripColor(s).equals(s) ? s : null;
|
||||
} catch (NumberFormatException nfe) {
|
||||
return false;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user