Information
OptimalAFKZone features, payouts, commands, permissions, placeholders, actions and displays in one reference.
BattleStudio plugin
OptimalAFKZone
Turn cuboid regions into rewarding AFK zones that pay players on a timer, with shards, boosters, a shard shop, teleports, auto-AFK and live displays.
- Requires
- Paper / FoliaMC 1.21.11+Java 21+OptimalLibraryPlaceholderAPI
OptimalAFKZone turns cuboid regions into rewarding AFK zones. Standing inside a zone accrues time,
and every Reward-Time seconds the player is paid out: a weighted roll from the zone’s own rewards,
a number of shards, or both. Shards are spent in the shard shop, and shard boosters (items or
permissions) multiply what a zone pays.
Zones are created in-game with a selection wand, one file per zone. Every zone has its own payout
timer, rewards, protections, enter and leave actions, action bar and boss bar. Players get there with
/afkzone, which teleports them after a short warmup or opens a menu of zones, and players who idle
in a configured idle area are sent to a zone automatically.
How it works
Section titled “How it works”- Presence is the only requirement. There is no player cap. A player whose feet are inside the region is in the zone.
- One zone at a time. When zones overlap, the one with the highest
Settings.Prioritywins. - Players only see zones with a spawn. A zone is offered in
/afkzoneand the AFK Zones menu when it is enabled and has aSpawn. Players also need itsPermissionto join it. - Progress is tracked in ticks, so the payout timer stays exact whatever
Check-Intervalyou use. Leaving resets progress toward the next payout unless the zone setsReset-Progress-On-Leave: false. - Zone permissions. A zone with a
PermissionsendsZONE-NO-ACCESSonce to a player without it. That player accrues nothing, gets no displays or protections and is not counted as an occupant. - On each payout the zone first rolls its shards (when shards are enabled and the zone’s
Reward-Modeincludes them), then runs itsRewards(when the mode includes commands), then plays theZONE-REWARDsound. - Shards are multiplied by the player’s best multiplier: the highest of their
optimalafkzone.booster.<n>permission and their active booster. They never stack. - Total AFK time is kept per player and survives restarts. It is shown by
/afkzone infoand theafk_timeplaceholders.
Features
Section titled “Features”- Cuboid AFK zones that pay players on a timer, one file per zone
- In-game zone creation with a selection wand and a live particle outline
/afkzoneteleport with a warmup countdown, cancelled on move or damage- AFK Zones menu listing every zone, with a random-zone button
- Auto-AFK: idle players in an idle area are sent to a zone
- Shards currency with its own name, symbol, colors and number formatting
- Shards can be used as a currency by other Optimal plugins
- Weighted reward groups per zone, a flat shard payout, or both, chosen per zone
- Shard shop with item or command rewards, per-item permissions and a confirm menu
- Booster items and permanent permission-based multipliers
- Per-zone action bar and boss bar with a live countdown
- Zone protections: damage, hunger and mob targeting
- Overlapping zones resolved by priority
- SQLite or MySQL storage
- Renameable commands and aliases
- PlaceholderAPI expansion
- Folia-ready, built on OptimalLibrary
Commands
Section titled “Commands”The command names below are the defaults. All three commands, and their aliases, can be renamed in
the Commands section of config.yml (restart
required).
Player - /afkzone (aliases /afk, /afkzones):
/afkzone- go to an AFK zone. With one zone open to you it teleports you there after the warmup; with several it opens the AFK Zones menu; with none it sendsNO-JOINABLE-ZONES·optimalafkzone.use/afkzone info- show your progress in the zone you are standing in ·optimalafkzone.use/afkzone shards(orbalance) - view your shard balance ·optimalafkzone.use/afkzone shards <player>- view another player’s balance, works offline ·optimalafkzone.admin/afkzone shop- open the shard shop ·optimalafkzone.use+optimalafkzone.shop/afkzone booster- view your active booster and its time left ·optimalafkzone.use
Any other argument shows the AFKZONE-HELP panel. From the console, /afkzone shows the help too.
Shop - /shardshop (alias /shardsshop):
/shardshop- open the shard shop, the same as/afkzone shop·optimalafkzone.use+optimalafkzone.shop
Admin - /afkzoneadmin (aliases /afkadmin, /afkzonesadmin) · all optimalafkzone.admin:
/afkzoneadmin wand- get the selection wand/afkzoneadmin create <zone>- create a zone from your selection. If you stand inside the selection, your position becomes the zone’s spawn/afkzoneadmin delete <zone>(orremove) - delete a zone and its file/afkzoneadmin setspawn <zone>- set the zone’s spawn to where you stand (inside the zone)/afkzoneadmin list- list every zone with its world, timer, occupants and whether it has a spawn/afkzoneadmin tp <zone>(orteleport) - teleport to a zone instantly: its spawn, or the top centre of the region when it has none/afkzoneadmin outline <zone>- toggle a zone’s particle outline for yourself/afkzoneadmin idlearea add <area>(orcreate) - save your wand selection as an idle area/afkzoneadmin idlearea remove <area>(ordelete) - remove an idle area/afkzoneadmin idlearea list- list the idle areas/afkzoneadmin shards <give|take|set> <player> <amount>- manage a balance. Works on offline players.addandremoveare accepted forgiveandtake./afkzoneadmin booster give <player> <booster> [amount]- give booster items (online players)/afkzoneadmin booster set <player> <multiplier> [duration]- set an active booster directly (online players). No duration,0or0smeans permanent./afkzoneadmin booster remove <player>- remove a player’s active booster (online players)/afkzoneadmin reload- reload every config, zone, booster and shop file. Players keep their progress, protection and bars.
With no arguments the admin command shows the AFKZONE-ADMIN-HELP panel. Players without
optimalafkzone.admin do not see the admin command or its aliases in tab completion.
Amounts and durations
Section titled “Amounts and durations”shardsamounts accept$,,or_separators andk/m/b/t/qsuffixes (1.5k,2m), up to2147483647.giveandtakeneed at least1;setaccepts0. Taking more than a player has leaves them at0.booster giveamounts must be at least1, and at most what fits in an empty inventory.booster setmultipliers are a plain number such as2or1.5. Durations are a bare number of seconds or a token string like30m,1h30m,1d,2w.
Permissions
Section titled “Permissions”optimalafkzone.use-/afkzoneand/shardshop(default: everyone)optimalafkzone.shop- open the shard shop (default: everyone)optimalafkzone.admin- every admin command, the selection wand and/afkzone shards <player>(default: op)optimalafkzone.bypass.warmup- teleport into a zone without the warmup (default: op)optimalafkzone.bypass.autoafk- never be sent to a zone for idling (default: nobody)optimalafkzone.booster.<n>- permanent shard multiplier, for exampleoptimalafkzone.booster.2= ×2 andoptimalafkzone.booster.1.5= ×1.5. The prefix is configurable. Not declared by default, grant it explicitly (a*wildcard does not count).
Zones, shops, shop items and boosters can each require their own node through a Permission key in
their file.
Placeholders
Section titled “Placeholders”Requires PlaceholderAPI.
| Placeholder | Value |
|---|---|
%optimalafkzone_shards% |
Shard balance, formatted like {shards} but without colors. |
%optimalafkzone_shards_raw% |
Shard balance as a plain number. |
%optimalafkzone_afk_time% |
Total AFK time, formatted (1d, 2h, 5s). |
%optimalafkzone_afk_time_raw% |
Total AFK time in seconds. |
%optimalafkzone_booster% |
The player’s effective shard multiplier (the highest of permission and active booster), for example 2 or 1.5. 1 with none, and for offline players. |
%optimalafkzone_booster_duration% |
Time left on the active booster, Permanent for one without an expiry, None without a booster. |
%optimalafkzone_zone% |
Display name of the zone the player is in, None outside a zone or in a zone they cannot access. |
%optimalafkzone_next_reward% |
Countdown to the next payout, 0s outside a zone. |
%optimalafkzone_zones% |
Number of loaded zones. |
%optimalafkzone_zone_players_<id>% |
Players currently in zone <id>. 0 for an unknown zone. |
zones and zone_players_<id> work without a player (in a scoreboard, hologram or console).
Balances and AFK time are read from loaded player data, so they are meant for online players.
Shards in other plugins
Section titled “Shards in other plugins”OptimalAFKZone registers shards as a currency other Optimal plugins can use, under the type
OPTIMALAFKZONE_SHARDS (for example as an OptimalAuctions currency). Shard balances can only be
changed while the player is online.
Actions
Section titled “Actions”One syntax is shared by Enter-Actions, Leave-Actions, reward Actions, booster
Consume-Actions and shop item Actions. A line with no [tag] runs as a console command, so
- "eco give %player% 25" works as written.
| Action | Does |
|---|---|
[message] <text> |
Send a chat message. [center] centres the line. |
[broadcast] <text> |
Send a message to every player. |
[actionbar] <text> |
Show an action bar message. |
[title] <title>;<subtitle>;<fadeIn>;<stay>;<fadeOut> |
Show a title. Times are in ticks; omitted times default to 10, 40, 10. |
[sound] <NAME>;<volume>;<pitch> |
Play a sound to the player. |
[command] / [console] <cmd> |
Run a command from console. |
[player] <cmd> |
Run a command as the player. |
[shards] <amount> |
Give shards directly (no booster multiplier, no message). |
[close] |
Close the open menu. |
A well-formed tag the plugin does not know does nothing.
Every action resolves {player}, %player%, {uuid} and, with PlaceholderAPI, any %...%
placeholder. Some places add their own tokens:
| Where | Extra tokens |
|---|---|
Zone Enter-Actions, Leave-Actions, Rewards |
{zone}, {zone-id}, {reward-time}, {world}, {players} |
Booster Consume-Actions |
{booster}, {multiplier}, {duration} |
Shop item Actions |
{item}, {price} (the raw price) |
Displays
Section titled “Displays”Each zone has its own Action-Bar-Settings and Boss-Bar-Settings, both rendered on the zone tick.
They accept these tokens:
| Token | Value |
|---|---|
{next} |
Countdown to the next payout. |
{percent} |
Progress toward the next payout, 0 to 100. |
{zone} / {zone-id} |
Zone display name / zone id. |
{reward-time} |
The zone’s Reward-Time in seconds. |
{players} |
Players currently in the zone. |
{session} |
Time spent in the zone this visit. |
{total} |
The player’s total AFK time. |
{shards} / {currency} |
The player’s balance and the currency name. |
{player} |
The player’s name. |
- Boss bar
Color:PINK,BLUE,RED,GREEN,YELLOW,PURPLE,WHITE - Boss bar
Style:PROGRESS,NOTCHED_6,NOTCHED_10,NOTCHED_12,NOTCHED_20(Bukkit’sSOLIDandSEGMENTED_*names are accepted too) Progress: truedrains the bar from full to empty as the payout approaches and refills it on each payout;falsekeeps it full
Formatting
Section titled “Formatting”Every text field supports legacy & codes, &#RRGGBB hex, MiniMessage (<gradient:a,b,c>,
<rainbow>, <bold>, <#RRGGBB>, <solid:HEX>, …) and, with PlaceholderAPI installed, %...%
placeholders. Gradients work in action bar and boss bar formats too, {next} included.
Durations ({next}, {session}, {total}, booster durations, the auto-AFK idle time) are printed
as 1d, 2h, 5s, with zero units dropped and 0s for nothing left.
Reference
Section titled “Reference”- Install: Installation
- Set up a zone: Creating AFK Zones
- Get players there: Teleports & Auto-AFK
- Shards, boosters and the shop: Setting Up the Shard Shop
- Config files: config.yml · zones · messages.yml · boosters · shops · zones.yml · confirm.yml
