AFK Clones
On this page(19)
A player who stands still in the mob area of their zone gets clones. Clones are fake players with the player's skin, sword and armor. They walk to the player's zone mobs and hit them for the player. Use it to reward idle time without letting it count as real progress.
| Files | modules/afk/config.yml, modules/afk/guis/afk.yml, modules/afk/lang/messages_en.yml |
| Player command | /afk |
| Admin commands | /dungeons admin afk ... |
| Switch | enabled: (first key of modules/afk/config.yml) + /dungeons reload |
With the module off, /afk goes away and every clone despawns. The upgrades of every player stay stored.
How it works
Going afk
- The player stands in the mob area of their zone without fighting.
- After
detect.idle-seconds(10) without moving, the clones appear at random spots of the mob area. - Each clone walks to one of the player's own zone mobs and hits it from
clones.hit-distanceblocks. - Each clone takes a mob no other clone of that player holds, while one is free.
There is no time limit. The clones keep working until the player stops being afk.
"Standing still" means the position only. Turning the camera never counts as a move.
What a clone deals
Every hit of a clone deals the damage of ONE swing of the player: their sword, boosters and modifiers. Each hit shows the damage hologram, like the player's own hit.
Each clone hits clones.base-swings times per second (0.5). The swings upgrade adds on top. A real player usually swings 2 or more times per second, so clones grind slower than active play.
A hit of a clone may roll the player's sword enchants:
- The chance is the player's own chance times
clones.enchant-proc-factor(1.0 = the same chance, 0 = never). - The enchants in
clones.blocked-enchantsnever roll on a clone's hit. The player's own swings keep rolling them. - A clone's proc is one of the player's procs. It starts their cooldown of that enchant.
- It also takes one of their
enchants.max-sequencesslots of the sword config: one budget for the player and their helpers.
They pay, they never progress
A clone's kill pays the player exactly like their own kill: the stage rewards, the rarity bonus and their boosters. The grind summary lists it as an AFK clones line.
A clone's kill never counts for the player's progress:
- no swings, damage or kills in their stats;
- no aura, armor or totem experience;
- no momentum change from a procced enchant.
The money a clone pays is money the player earned. It counts in their earned:<currency> stat, so milestones and tops built on it still move.
Objectives and hunts never count a clone's kills. The afk-minutes type counts the minutes of afk clones instead.
What ends the afk
Any of these ends the afk at once. The clones go in the same tick, with the effect of clones.spawn-effect:
- moving farther than
detect.move-thresholdblocks from the spot; - hitting a mob, or picking a target;
- a teleport, a world change, or leaving the mob area of the zone;
- mounting something, or the player's autofighter starting;
- switching to spectator, dying or quitting.
The idle time then starts again from that moment. The player does not need to move first.
Only when fully afk
Some activities count as "not afk" (detect.not-while). While one runs, the clones never appear, and running clones go:
| Key | Activity |
|---|---|
heroes | The player's heroes are summoned. |
contest | The player PLAYS a running event: they caught a target within detect.idle-seconds. |
Standing in the mob area while an event runs is not playing it. The clones keep working then.
A running autofighter always counts as "not afk". When the activity ends, the clones come back within a second.
Who sees the clones
The player and the others who see their mobs see the clones, within clones.view-range blocks. The isolated zone worlds keep their rules: solo shows them to the player only, island to their island.
Each player can hide other players' clones with the afk.view-others setting of /settings.
Requirements
A player cannot go afk while the zones module, the sword module or the packet layer (nms.enabled of config.yml) is off.
Configuration
detect
| Key | Default | What it does |
|---|---|---|
detect.idle-seconds | 10 | Seconds a player stands still before their clones appear (1 to 3600). |
detect.move-threshold | 0.1 | Blocks. Moving farther than this from the spot ends the afk at once. |
detect.not-while.heroes | true | true = no clones while the player's heroes are summoned. |
detect.not-while.contest | true | true = no clones while the player plays a running contest. |
A refused start is tried again every second while the player stays still.
clones
| Key | Default | What it does |
|---|---|---|
clones.base-count | 1 | Clones every player gets. The count upgrade adds on top (at most 8). |
clones.base-swings | 0.5 | Hits per second of EACH clone. The swings upgrade adds on top (at most 20). |
clones.base-speed | 3.0 | Blocks per second a clone walks between the mobs. The speed upgrade adds on top. |
clones.enchant-proc-factor | 1.0 | The player's enchant chance times this, on a clone's hit (0 to 1). |
clones.blocked-enchants | [] | Enchant ids (file names of modules/sword/enchants/) that never roll on a clone's hit. |
clones.hit-distance | 2.5 | A clone stops this many blocks from its mob and hits from there. |
clones.name | '&7{player} &8(AFK)' | The name over each clone. {player} is its owner's name. |
clones.name-height | 2.1 | The height of the name above a clone's feet. |
clones.view-range | 48 | How far, in blocks, other players see the clones (8 to 128). |
clones.spawn-effect.particle | CLOUD | Particle when a clone appears and goes. A Particle name that needs no data. '' = none. |
clones.spawn-effect.count | 12 | How many particles. |
clones.spawn-effect.sound | ENTITY_ENDERMAN_TELEPORT | Sound when a clone appears and goes. '' = none. |
clones.spawn-effect.volume | 0.4 | Volume of the sound. |
clones.spawn-effect.pitch | 1.6 | Pitch of the sound. |
An enchant in blocked-enchants also never rolls as a proc-enchants of an enchant a clone procced.
The code caps every player at 8 clones and every clone at 20 hits per second, whatever the config says.
upgrades
Three upgrades, bought in the /afk menu: speed, swings and count. Each one has the same keys:
| Key | Default (speed / swings / count) | What it does |
|---|---|---|
upgrades.<id>.currency | souls | The currency the levels are bought with. |
upgrades.<id>.max-level | 10 / 20 / 4 | The highest level. |
upgrades.<id>.per-level | 0.3 / 0.05 / 1 | What one level adds: blocks per second, hits per second of each clone, or clones. |
upgrades.<id>.cost.type | exponential | exponential or linear. |
upgrades.<id>.cost.starting-cost | 500000 / 500000 / 5000000 | The price of the first level. |
upgrades.<id>.cost.growth | 1.3 / 1.3 / 3.0 | Exponential: each level costs this many times the one before. |
upgrades.<id>.cost.increase-cost-by | 0 | Linear: the amount added per level. |
The price of level L to L + 1 is starting-cost x growth^L (exponential) or starting-cost + increase-cost-by x L (linear). A plain amount written as cost: is the same price for every level.
A purchase while afk changes the clones at once: a new clone appears, or they get faster.
| Key | Default | What it does |
|---|---|---|
upgrade-amounts | [1, 10, 'max'] | The amounts the upgrade buttons may buy. max = every level the balance covers. |
commands.main
| Key | Default | What it does |
|---|---|---|
commands.main.command | afk | Command name. '' = no /afk command (the API keeps working). |
commands.main.aliases | [] | Other names of the command. |
commands.main.permission | '' | Permission for the command and every button of the afk menu. '' = everyone. |
commands.main.menu | afk | The menu /afk opens (a file of modules/afk/guis/). '' = /afk shows your afk in chat. |
SnDungeons takes /afk from another plugin that has it, such as EssentialsX. Rename commands.main.command to keep the other one.
The display-name key ('&7AFK') is the module's name in /dungeons admin modules.
The AFK menu
modules/afk/guis/afk.yml (id afk:afk) is a 6-row menu:
| Letter | Tile |
|---|---|
i | What your clones do now: clones, swings, speed and what they earned. |
S, W, C | The speed, swings and count upgrades. |
a b c, d e f, g h k | Under each upgrade, its x1, x10 and max buttons. |
X | Close. |
# | Filler. |
Each tile has two states, chosen by view-requirements:
ishows the "AFK" look while%sndungeons_afk_state%isafk, else the "Playing" look.- Each upgrade and buy button shows its "MAX LEVEL" look while
%sndungeons_afk_upgrade_<id>_state%ismax.
The buy buttons run [afk] buy <speed|swings|count> <amount|max>. The amount must be one of upgrade-amounts. [afk] open afk opens the menu from any button.
Player settings
| Setting | What it hides (for that player only) |
|---|---|
afk.view-others | Other players' clones and their names. |
afk.effects | The particle and sound of a clone appearing and going. |
afk.messages | The chat lines when your clones appear and go. |
See Player Settings.
Commands
| Command | Permission | Description |
|---|---|---|
/afk | commands.main.permission ('' = everyone) | Opens the AFK menu. The console gets the help. |
/dungeons admin afk upgrade <player> <speed|swings|count> <level> | sndungeons.admin.afk.upgrade | Sets an afk upgrade level of a player, free, also offline. |
/dungeons admin afk force <player> | sndungeons.admin.afk.force | Puts an online player afk now, without the idle time (to test). |
/dungeons admin afk stop <player> | sndungeons.admin.afk.stop | Ends the afk of an online player (their clones go). |
/dungeons admin afk info <player> | sndungeons.admin.afk.info | Shows the afk state, clones, targets and viewers of an online player. |
Full lists: Commands and Permissions.
Placeholders
The afk placeholders are listed in Placeholders. The most useful:
| Placeholder | Value |
|---|---|
%sndungeons_afk_state% | afk or playing (_label for the translated word) |
%sndungeons_afk_clones%, %sndungeons_afk_clones_out% | The clones you get, and the ones out now |
%sndungeons_afk_swings%, %sndungeons_afk_speed% | Hits per second of each clone, and their walk speed |
%sndungeons_afk_session_earned_<currency>% | What your clones earned since you last went afk |
%sndungeons_afk_upgrade_<id>_level%, _max, _cost | An upgrade (speed, swings, count) |
%sndungeons_afk_upgrade_<id>_cost_<amount>% | The price of the next amount levels |
Tips
- Test the clones with
/dungeons admin afk force <player>: it skips the idle time. - Keep
base-swingswell under a real player's swings, so active play stays better than idling. - Lower
enchant-proc-factor, or block your strongest enchants, if clones earn too much. /dungeons admin afk info <player>shows why clones are missing: their state, targets and viewers.
Default modules/afk/config.yml
enabled: true
# ============================================================
# SnDungeons - afk module
# Managed by SnLib: new keys are auto-merged on boot; your values and
# comments are preserved. Re-read on /dungeons reload.
# ============================================================
# Switch of the module (the key above): false turns the afk off on
# /dungeons reload; /afk disappears and every clone goes. The upgrades of
# every player stay stored.
# A player who stands still in the mob area of their zone, without fighting,
# gets clones with their skin, sword and armor: they walk to the player's
# zone mobs and hit them with the damage of ONE swing of the player (their
# enchants roll on each hit, see clones.enchant-proc-factor), at a slow rate
# of their own; each hit shows the damage hologram like the player's. A clone's kill pays the player like
# their own kill (with their boosters) and shows in the grind summary, but it
# never counts for their progress (stats, kills, milestones, auras, armor,
# totems). The clones go the moment the player moves (turning the camera
# does not count). Hard limits whatever is written here: 8 clones per player,
# 20 swings per second per clone.
# Name of the module in /dungeons admin modules (color codes allowed).
display-name: '&7AFK'
detect:
# Seconds a player stands still (without moving from their spot) before
# their clones appear (1 to 3600).
idle-seconds: 10
# Blocks: moving farther than this from the spot ends the afk at once
# (turning the camera does not count).
move-threshold: 0.1
# Activities that count as "not afk": while one runs the clones never appear
# and running clones go (a refused start is tried again every second while
# the player stays still: the clones come back as soon as it ends). A running
# autofighter always counts (its rider sits in a real vehicle). Each true or
# false.
not-while:
# The player's heroes are summoned (heroes module).
heroes: true
# The player PLAYS a running contest (contests module): they caught one of
# its targets within idle-seconds. Standing in the mob area during a
# contest is not playing it: the clones keep working there.
contest: true
clones:
# The clones every player gets; the count upgrade adds on top (at most 8).
base-count: 1
# Hits per second of EACH clone (a player usually swings 2 or more); the
# swings upgrade adds on top (at most 20).
base-swings: 0.5
# Blocks per second a clone walks between the mobs; the speed upgrade adds
# on top.
base-speed: 3.0
# The chance of the player's sword enchants on a hit of a clone: their chance
# times this (0 to 1; 0 = a clone never procs an enchant; 1 = like the player).
# What a procced enchant does is the player's (it pays, never progress).
enchant-proc-factor: 1.0
# Enchants of the player's sword that never roll on a hit of a clone,
# whatever enchant-proc-factor says (their ids: the file names of
# modules/sword/enchants/ without .yml); a proc-enchants of an enchant a
# clone procced never rolls them either. The player's own swings keep
# rolling them. [] = every enchant may roll on a clone's hit. Example:
# blocked-enchants: ['lightning', 'warband']
blocked-enchants: []
# A clone stops this near its mob (blocks) and hits it from there.
hit-distance: 2.5
# The name over each clone; {player} is its owner's name.
name: '&7{player} &8(AFK)'
# The height of the name above a clone's feet.
name-height: 2.1
# How far, in blocks, the other players see the clones (8 to 128). Who
# sees them also follows the zones' isolation (solo: only you; island:
# your island) and the setting afk.view-others of /settings.
view-range: 48
# The particle and sound of a clone appearing and going (each player turns
# them off with afk.effects of /settings). '' = none. The particle is a
# name of org.bukkit.Particle that needs no data (CLOUD, END_ROD, ...).
spawn-effect:
particle: CLOUD
count: 12
sound: ENTITY_ENDERMAN_TELEPORT
volume: 0.4
pitch: 1.6
# The upgrades (the /afk menu). currency: what they are bought with;
# max-level: their highest level; per-level: what one level adds (speed:
# blocks per second; swings: hits per second of each clone; count: clones);
# cost: the price of the level L -> L + 1, starting-cost x growth^L (type:
# exponential) or starting-cost + increase-cost-by x L (type: linear); a
# plain amount is the same price for every level.
upgrades:
speed:
currency: souls
max-level: 10
per-level: 0.3
cost:
type: exponential
starting-cost: 500000
growth: 1.3
increase-cost-by: 0
swings:
currency: souls
max-level: 20
per-level: 0.05
cost:
type: exponential
starting-cost: 500000
growth: 1.3
increase-cost-by: 0
count:
currency: souls
max-level: 4
per-level: 1
cost:
type: exponential
starting-cost: 5000000
growth: 3.0
increase-cost-by: 0
# The amounts the upgrade buttons of the /afk menu may buy ([afk] buy <id>
# <amount>); max = every level the balance covers, up to the max-level.
upgrade-amounts: [1, 10, 'max']
commands:
# /afk opens the afk menu. If another plugin already has this name or an
# alias (EssentialsX's /afk), SnDungeons takes it (command priority):
# rename it here to keep the other one.
main:
# Command name; '' = no /afk command (the API keeps working).
command: afk
# Other names of the command.
aliases: []
# Permission needed to use the command, and every button of the afk
# menu. '' = everyone.
permission: ''
# The menu /afk opens: a file of modules/afk/guis/ without .yml. '' = no
# menu: /afk shows your afk in chat.
menu: afk