9
0
mirror of https://github.com/Auxilor/EcoBits.git synced 2025-12-20 15:39:29 +00:00
This commit is contained in:
Auxilor
2023-07-20 17:51:06 +01:00
parent d0968397c0
commit bab1a6fc47

View File

@@ -192,8 +192,9 @@ fun BigDecimal.formatWithExtension(): String {
} }
fun BigDecimal.formatWithCommas(): String { fun BigDecimal.formatWithCommas(): String {
val decimalFormat = if (this.scale() > 0) DecimalFormat("#,###.00") else DecimalFormat("#,###") val stripped = this.stripTrailingZeros()
return decimalFormat.format(this) val decimalFormat = if (stripped.scale() > 0) DecimalFormat("#,##0.00") else DecimalFormat("#,##0")
return decimalFormat.format(stripped)
} }
fun OfflinePlayer.getBalance(currency: Currency): BigDecimal { fun OfflinePlayer.getBalance(currency: Currency): BigDecimal {