Astral Realms Documentation Help

Commands

AstralEconomy registers three commands: the admin edit command /eco (alias /economy), the player-to-player transfer /pay, and the self-service /balance (alias /bal). Admin edits made through /eco ignore each currency's transferable flag — only /pay enforces it, since that's a player moving money rather than an operator directly writing a balance. Every mutation runs through the same guarded database transaction described in Overview, so an overdraft is structurally impossible regardless of which command triggers it.

/eco (/economy)

Base permission: economy.command, set at the class level — every subcommand below requires it in addition to its own permission.

Subcommand

Syntax

Permission

Description

set

/eco set <player> <currency> <amount>

economy.command.balance.set

Set a balance to an exact value.

add (give)

/eco add <player> <currency> <amount>

economy.command.balance.deposit

Deposit into a balance.

take

/eco take <player> <currency> <amount>

economy.command.balance.withdraw

Withdraw from a balance.

balance

/eco balance <player> <currency>

economy.command.balance.check

Check another player's balance.

reload

/eco reload

economy.command.reload

Reload config.yml, currencies.yml, and messages.yml.

<player> tab-completes against @offlinePlayers. <currency> tab-completes against every registered currency id (@currencies, backed by CurrencyCompletionHandler) and is resolved by CurrencyContextResolver — an unknown id fails the command immediately with Currency with id '...' not found. before the subcommand handler runs.

set

/eco set <player> <currency> <amount>

Sets the account's balance to exactly <amount>. <amount> must be finite and >= 0; a negative or non-finite value is rejected with amount-negative before touching the database. The accepted value is then normalized to the money column's scale (4 decimal places) by rounding down, never up, so a set can never mint fractional money. A set has no meaningful before/after delta, so unlike add/take it never triggers the action-bar balance notification (see Overview).

The write fails as ACCOUNT_NOT_FOUND if the target has no account row for that currency yet — the ledger never provisions one. On success: set-success; on failure: set-failure with %reason%.

add/give

/eco add <player> <currency> <amount> /eco give <player> <currency> <amount>

Deposits <amount> into the account. <amount> must be finite and strictly > 0; zero, negative, or non-finite is rejected with amount-not-positive. The amount is then rounded down to the money column's scale — if that rounds it to zero (a sub-tick amount), the command fails as INVALID_AMOUNT rather than silently succeeding as a no-op. A missing account row fails as ACCOUNT_NOT_FOUND. On success: deposit-success; on failure: deposit-failure with %reason%.

take

/eco take <player> <currency> <amount>

Withdraws <amount> from the account, with the same > 0, rounding, and account-existence rules as add. An overdrawn withdrawal fails at the database's guarded-update floor as INSUFFICIENT_FUNDS — the balance can never go negative. On success: withdraw-success; on failure: withdraw-failure with %reason%.

balance

/eco balance <player> <currency>

Reports <player>'s balance for <currency> to the sender (balance-other), reading through the authoritative asynchronous path — it loads from the database on a cache miss rather than trusting a possibly-stale cached figure. On a read failure the sender gets balance-error and the error is logged.

reload

/eco reload

Calls AstralEconomy.loadConfiguration(), which re-reads config.yml, currencies.yml, and messages.yml in that order and replaces the in-memory configuration objects. Sends reloading immediately, then either reload-success or reload-failure (with a stack trace logged to console on failure). See Configuration for what reload does and does not pick up (database.properties is excluded — the connection pool is only rebuilt on a full restart).

/pay

/pay <player> <amount>

Player-only. Transfers <amount> of the default currency (the entry with default: true in currencies.yml) from the sender to <player>. No permission node is required. <player> tab-completes against @offlinePlayers.

Validated in order:

  1. <amount> must be finite and > 0 — otherwise amount-not-positive.

  2. Sender and target must differ — paying yourself is rejected with pay-self.

  3. A default currency must be configured — otherwise pay-no-default-currency.

  4. The default currency must be transferable — otherwise pay-untransferable. This is the one check /eco skips: an admin edit bypasses transferable, but /pay respects it because a player, not an operator, is the one moving the money.

On success the transfer runs through the same guarded transaction as every other mutation: the sender receives pay-success-sender and the recipient is sent pay-received through ChatService, delivered network-wide regardless of which server the recipient is on. On failure: pay-insufficient-funds (INSUFFICIENT_FUNDS), pay-account-not-found (ACCOUNT_NOT_FOUND — the recipient has no account row for that currency yet), or pay-failed with %reason% for anything else (e.g. INVALID_AMOUNT, a sub-tick amount that rounds to zero at the column scale).

/balance (/bal)

Player-facing self and other-player balance check.

Invocation

Sender

Permission

Description

/balance

player

none

Report the sender's balance in the default currency. If none is configured, balance-no-default-currency.

/balance <currency>

player

none

Report the sender's balance in <currency> (tab-completes @currencies).

/balance others <player> <currency>

any

economy.balance.others

Report <player>'s balance in <currency> to the sender.

/balance and /balance <currency> both read through the authoritative asynchronous path — loading from the database on a cache miss — so the figure is always current even for an account this server has never cached. On a self-read failure: balance-self-error. others mirrors /eco balance: success sends balance-others, failure balance-others-error, and unlike the two self-service forms it accepts any CommandSender, not just a player.

Permission summary

Node

Grants

economy.command

Base node for /eco (/economy) — required for every subcommand, in addition to its own node below.

economy.command.balance.set

/eco set.

economy.command.balance.deposit

/eco add//eco give.

economy.command.balance.withdraw

/eco take.

economy.command.balance.check

/eco balance.

economy.command.reload

/eco reload.

economy.balance.others

/balance others.

/pay, /balance, and /balance <currency> require no permission node.

Last modified: 25 July 2026