-
Notifications
You must be signed in to change notification settings - Fork 0
Currencies
This page explains how currencies work in Coffers and Coffers Legacy, including default currency selection, formatting rules, and multi-currency setup.
Coffers supports configurable currencies.
Each currency can define:
- an internal currency ID
- a singular display name
- a plural display name
- a symbol
- fractional digits
- a starting balance
- formatting rules
This gives Coffers a more flexible economy model than older single-currency-only designs.
Currencies are defined in config.yml under the currencies section.
Modern line example:
currencies:
default: coins
definitions:
coins:
singular: coin
plural: coins
symbol: $
fractional-digits: 2
starting-balance: 100.00
format:
symbol-first: true
space-between-symbol-and-amount: false
space-between-amount-and-name: true
use-grouping: true
show-trailing-zeros: trueLegacy line example:
currencies:
default: coins
definitions:
coins:
singular: coin
plural: coins
symbol: $
fractional-digits: 2
starting-balance: 100.00
format:
symbol-first: true
space-between-symbol-and-amount: false
space-between-amount-and-name: true
use-grouping: true
show-trailing-zeros: trueEach currency is defined under a key such as:
coinsgems
That key becomes the currency ID used internally.
Example:
definitions:
coins:
singular: coin
plural: coinsIn this example:
- the currency ID is
coins
Currency IDs are used in:
- config
- commands
- internal economy handling
- plugin integrations
The default currency is configured here:
currencies:
default: coinsImportant:
- the default currency must exist in
currencies.definitions - Coffers validates this at startup
- if the default currency is missing, startup fails instead of silently using a broken configuration
This protects server owners from accidentally launching with an invalid currency setup.
Each currency supports:
singularplural
Example:
coins:
singular: coin
plural: coinsThese names are used when Coffers formats balances for display.
Each currency can define a symbol.
Example:
coins:
symbol: $Modern default sample currencies:
-
coinsuses$ -
gemsuses◆
Legacy default sample currencies:
-
coinsuses$ -
gemsuses*
This difference exists because the legacy line uses more conservative sample defaults.
Each currency defines how many decimal places it supports.
Example:
coins:
fractional-digits: 2Common examples:
-
2for currencies like dollars or coins with decimals -
0for currencies like gems or tokens with whole-number balances only
This affects:
- storage normalization
- display formatting
- command output
- Vault-facing fractional behavior for the default currency
Each currency can define the starting balance new accounts receive.
Example:
coins:
starting-balance: 100.00This is applied when Coffers creates an account for a player that does not already exist.
Each currency can define its own formatting rules.
Example:
format:
symbol-first: true
space-between-symbol-and-amount: false
space-between-amount-and-name: true
use-grouping: true
show-trailing-zeros: trueThese settings control how balances are displayed.
Controls whether the symbol comes before the amount.
Example:
$100 coins100 $ coins
Controls whether there is a space between the symbol and the numeric amount.
Example:
$100$ 100
Controls whether there is a space between the formatted amount and the currency name.
Example:
$100 coins$100coins
Controls whether large numbers use grouping separators.
Example:
10001,000
Controls whether trailing decimal zeroes are shown.
Example:
10.0010
The default config ships with two example currencies:
coinsgems
Example:
currencies:
default: coins
definitions:
coins:
singular: coin
plural: coins
symbol: $
fractional-digits: 2
starting-balance: 100.00
format:
symbol-first: true
space-between-symbol-and-amount: false
space-between-amount-and-name: true
use-grouping: true
show-trailing-zeros: true
gems:
singular: gem
plural: gems
symbol: ◆
fractional-digits: 0
starting-balance: 0
format:
symbol-first: false
space-between-symbol-and-amount: true
space-between-amount-and-name: true
use-grouping: true
show-trailing-zeros: falseMany Coffers commands can accept a currency argument.
Examples:
/coffers balance Kai coins/coffers pay Kai 50 gems/coffers set Kai 500 coins
Legacy examples:
/cofferslegacy balance Kai coins/cofferslegacy pay Kai 50 gems/cofferslegacy set Kai 500 coins
If no currency is specified, Coffers uses the default currency.
Coffers supports multiple currencies internally.
However, Vault compatibility is primarily centered on the default currency.
That means:
- direct Coffers usage can work with multiple configured currencies
- Vault-aware third-party plugins generally interact through the default Coffers currency
- advanced multi-currency behavior is better handled through Coffers-native integrations
Recommended currency setup habits:
- keep IDs simple and lowercase
- make sure the default currency is defined
- use
0fractional digits for whole-number currencies - use readable symbols and names
- keep formatting rules consistent with the style of your server
Avoid these common currency problems:
- setting a default currency that is not defined
- using confusing or inconsistent currency IDs
- mixing decimal and whole-number expectations without checking fractional digits
- assuming Vault-aware plugins will automatically support every Coffers currency
Coffers currencies are designed to be flexible, configurable, and more expressive than the old single-currency approach common in older economy systems.
You can control:
- what currencies exist
- how they display
- how many decimals they use
- what starting balances they assign
- how commands and formatted output present them