mirror of
https://github.com/EssentialsX/Essentials.git
synced 2024-12-23 09:37:50 +01:00
Format currency correctly by placing negative sign at beginning.
This is forcefully placed at the beginning of the formatted currency because of how `currency` message is customisable. Until a better solution arises this shall stay.
This commit is contained in:
parent
04755cee33
commit
365ae356bd
@ -55,11 +55,23 @@ public class NumberUtil {
|
||||
}
|
||||
|
||||
public static String displayCurrency(final BigDecimal value, final IEssentials ess) {
|
||||
return tl("currency", ess.getSettings().getCurrencySymbol(), formatAsPrettyCurrency(value));
|
||||
String currency = formatAsPrettyCurrency(value);
|
||||
String sign = "";
|
||||
if (value.signum() < 0) {
|
||||
currency = currency.substring(1);
|
||||
sign = "-";
|
||||
}
|
||||
return sign + tl("currency", ess.getSettings().getCurrencySymbol(), currency);
|
||||
}
|
||||
|
||||
public static String displayCurrencyExactly(final BigDecimal value, final IEssentials ess) {
|
||||
return tl("currency", ess.getSettings().getCurrencySymbol(), value.toPlainString());
|
||||
String currency = value.toPlainString();
|
||||
String sign = "";
|
||||
if (value.signum() < 0) {
|
||||
currency = currency.substring(1);
|
||||
sign = "-";
|
||||
}
|
||||
return sign + tl("currency", ess.getSettings().getCurrencySymbol(), currency);
|
||||
}
|
||||
|
||||
public static boolean isInt(final String sInt) {
|
||||
|
Loading…
Reference in New Issue
Block a user