Skip to content

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.

  • 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.Priority wins.
  • Players only see zones with a spawn. A zone is offered in /afkzone and the AFK Zones menu when it is enabled and has a Spawn. Players also need its Permission to join it.
  • Progress is tracked in ticks, so the payout timer stays exact whatever Check-Interval you use. Leaving resets progress toward the next payout unless the zone sets Reset-Progress-On-Leave: false.
  • Zone permissions. A zone with a Permission sends ZONE-NO-ACCESS once 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-Mode includes them), then runs its Rewards (when the mode includes commands), then plays the ZONE-REWARD sound.
  • 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 info and the afk_time placeholders.
  • 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
  • /afkzone teleport 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

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 sends NO-JOINABLE-ZONES · optimalafkzone.use
  • /afkzone info - show your progress in the zone you are standing in · optimalafkzone.use
  • /afkzone shards (or balance) - 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> (or remove) - 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> (or teleport) - 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> (or create) - save your wand selection as an idle area
  • /afkzoneadmin idlearea remove <area> (or delete) - 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. add and remove are accepted for give and take.
  • /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, 0 or 0s means 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.

  • shards amounts accept $, , or _ separators and k/m/b/t/q suffixes (1.5k, 2m), up to 2147483647. give and take need at least 1; set accepts 0. Taking more than a player has leaves them at 0.
  • booster give amounts must be at least 1, and at most what fits in an empty inventory.
  • booster set multipliers are a plain number such as 2 or 1.5. Durations are a bare number of seconds or a token string like 30m, 1h30m, 1d, 2w.
  • optimalafkzone.use - /afkzone and /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 example optimalafkzone.booster.2 = ×2 and optimalafkzone.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.

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.

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.

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)

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’s SOLID and SEGMENTED_* names are accepted too)
  • Progress: true drains the bar from full to empty as the payout approaches and refills it on each payout; false keeps it full

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.