Economy Costs
EzAfk can charge players a currency fee when they go AFK or while they remain AFK. Both one-time entry costs and recurring interval costs are supported. Costs are deducted via Vault, so any Vault-compatible economy plugin (EssentialsX Economy, CMI, etc.) will work.
Requirements
- Vault installed and enabled.
- A Vault-compatible economy plugin providing balances.
economy.enabled: trueinconfig.yml.
Configuration
In your config.yml:
economy:
enabled: false
bypass-permission: "ezafk.economy.bypass"
cost:
enter:
enabled: true
amount: 25.0 # currency deducted when a player first goes AFK
require-funds: true # if true, prevent going AFK when the player cannot afford it
retry-delay: 60 # seconds before re-trying if require-funds blocked the transition
recurring:
enabled: false
amount: 5.0 # currency deducted every interval while AFK
interval: 300 # seconds between each deduction
require-funds: true # if true, apply kick-on-fail behaviour when funds are insufficient
kick-on-fail: false # kick the player when they can no longer afford the recurring cost
economy.enabled: Master switch. Whenfalse, no economy activity occurs. Default:false.economy.bypass-permission: Permission node that exempts a player from all economy costs. Default:"ezafk.economy.bypass".
Entry Cost (cost.enter)
cost.enter.enabled: Charge a one-time fee when the player is first marked AFK. Default:true.cost.enter.amount: Amount to deduct. Uses the economy plugin’s default currency.cost.enter.require-funds: Whentrue, EzAfk checks the player’s balance before marking them AFK. If they cannot afford the fee, they are not marked AFK and receive an error message.cost.enter.retry-delay: Ifrequire-fundsblocked the AFK transition, EzAfk waits this many seconds before trying again. This prevents the check from firing on every movement event.
Recurring Cost (cost.recurring)
cost.recurring.enabled: Deduct currency periodically while the player remains AFK. Default:false.cost.recurring.amount: Amount deducted per interval.cost.recurring.interval: How often (in seconds) the deduction fires.cost.recurring.require-funds: Whentrue, a failed deduction (insufficient balance) triggers thekick-on-failbehaviour instead of silently skipping.cost.recurring.kick-on-fail: Whentrue, a player who can no longer afford the recurring cost is kicked from the server. Whenfalse, the recurring deduction is simply skipped.
Customising Messages
Edit your active language file in messages/ (e.g. messages/en.yml):
economy:
enter-cost: "&eGoing AFK costs &6{amount}&e."
insufficient-funds: "&cYou don't have enough funds to go AFK."
recurring-cost: "&eAFK cost: &6{amount} &ededucted."
kicked-no-funds: "&cYou were kicked because you ran out of AFK funds."
See the Messages page for the full reference.
How It Works
- When a player is about to be marked AFK, EzAfk checks whether
cost.enteris enabled. - If
require-fundsistrueand the player cannot affordcost.enter.amount, the AFK transition is blocked and a message is sent. The check retries afterretry-delayseconds. - If the player can afford it (or
require-fundsisfalse), the amount is deducted and the player is marked AFK. - Once AFK, a recurring task fires every
cost.recurring.intervalseconds ifcost.recurring.enabledistrue. - On each interval, EzAfk deducts
cost.recurring.amount. If the deduction fails andrequire-funds + kick-on-failare bothtrue, the player is kicked. - Players with the bypass permission (or WorldGuard region bypass) skip all economy checks.
Related
- Economy / Vault Integration: setup guide
- AFK Zones: grant economy rewards for being AFK in specific areas
- Permissions:
ezafk.economy.bypass