9
0
mirror of https://github.com/Auxilor/EcoBits.git synced 2025-12-19 15:09:19 +00:00

Added %ecobits_<id>_commas%

This commit is contained in:
Auxilor
2023-07-20 13:34:39 +01:00
parent 0231ad6214
commit 69c2f60ac5
2 changed files with 14 additions and 0 deletions

View File

@@ -120,6 +120,15 @@ class Currency(
}
)
PlaceholderManager.registerPlaceholder(
PlayerPlaceholder(
plugin,
"${id}_commas"
) {
it.getBalance(this).formatWithCommas()
}
)
PlaceholderManager.registerPlaceholder(
PlayerPlaceholder(
plugin,
@@ -182,6 +191,10 @@ fun BigDecimal.formatWithExtension(): String {
}
}
fun BigDecimal.formatWithCommas(): String {
return DecimalFormat("#,###.00").format(this)
}
fun OfflinePlayer.getBalance(currency: Currency): BigDecimal {
return this.profile.read(currency.key)
}

View File

@@ -9,6 +9,7 @@
# Placeholders:
# %ecobits_<id>% - The balance of a certain currency
# %ecobits_<id>_commas% - The balance with commas of a certain currency
# %ecobits_<id>_formatted% - The formatted balance of a certain currency
# %ecobits_<id>_max% - The max balance of a certain currency
# %ecobits_<id>_default% - The default balance of a certain currency