Currencies¶
Defined in config.yml, edited in /coins gui → Currencies.
currencies:
coins:
name: "Coin"
plural: "Coins"
icon: GOLD_INGOT
symbol: ""
decimals: 2
starting-balance: 500
primary: true
payable: true
| Key | |
|---|---|
name / plural |
singular and plural, used in every message |
icon |
the item shown in menus |
symbol |
shown before the number; blank uses the name instead |
decimals |
0–4 |
starting-balance |
what a new player has |
primary |
the one Vault sees. Exactly one currency must be primary |
payable |
whether players can /pay it |
Making your own¶
Renaming a currency and changing what it looks like, in game.
Non-transferable currencies¶
payable: false makes a currency earnable and spendable but never handed
between players. Event tokens are the obvious case — trading them defeats the
point of the event.
Money and rounding¶
Amounts are rounded through BigDecimal at each currency's precision, not by
arithmetic on doubles.
Why this matters
A currency that only exists as a double accumulates fractions of a penny
on every transaction. After a few thousand trades the total money supply
no longer adds up, and nobody can explain why.
Storage¶
Balances are held in memory and written to balances.yml on a timer
(save-interval-minutes, default 5). A shutdown always forces a save, so that
interval is the window you would lose to a hard crash.
The file is written to a temporary name and moved into place. A crash midway through writing a truncated balances file would otherwise wipe the entire economy, and that is not recoverable.