mirror of
https://github.com/AppleDash/SaneEconomy.git
synced 2024-11-05 01:59:35 +01:00
Use MessageUtils instead of String.format for currency formatting
This commit is contained in:
parent
2adb136f3d
commit
6015eb7947
@ -1,6 +1,7 @@
|
||||
package org.appledash.saneeconomy.economy;
|
||||
|
||||
import com.google.common.base.Strings;
|
||||
import org.appledash.saneeconomy.utils.MessageUtils;
|
||||
import org.bukkit.configuration.ConfigurationSection;
|
||||
|
||||
import java.text.DecimalFormat;
|
||||
@ -22,7 +23,7 @@ public class Currency {
|
||||
this.nameSingular = nameSingular;
|
||||
this.namePlural = namePlural;
|
||||
this.format = format;
|
||||
this.formatBalance = "%s %s";
|
||||
this.formatBalance = "{1} {2}";
|
||||
}
|
||||
|
||||
public Currency(String nameSingular,String namePlural,DecimalFormat format,String formatBalance){
|
||||
@ -69,10 +70,11 @@ public class Currency {
|
||||
*/
|
||||
public String formatAmount(double amount) {
|
||||
if (amount == 1) {
|
||||
return String.format(formatBalance, format.format(amount), nameSingular);
|
||||
return MessageUtils.indexedFormat(formatBalance, format.format(amount), nameSingular);
|
||||
// return String.format(formatBalance, format.format(amount), nameSingular);
|
||||
}
|
||||
|
||||
return String.format(formatBalance, format.format(amount), namePlural);
|
||||
return MessageUtils.indexedFormat(formatBalance, format.format(amount), namePlural);
|
||||
// return String.format(formatBalance, format.format(amount), namePlural);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -5,7 +5,7 @@ currency:
|
||||
name:
|
||||
singular: dollar
|
||||
plural: dollars
|
||||
balance-format: '%s %s'
|
||||
balance-format: '{1} {2}'
|
||||
format: '0.00'
|
||||
grouping: 3
|
||||
grouping-separator: ','
|
||||
|
Loading…
Reference in New Issue
Block a user