Anticheat
On this page(20)
The anticheat module catches cheats through what is abnormal in SnDungeons' own gameplay. The zone fight swings on its own, so an autoclicker gains nothing. A killaura or a bot still shows: far, blind or instant target picks, clicks on a hidden decoy, or inhuman gains. Nothing is punished until you write a threshold.
| Files | modules/anticheat/config.yml, modules/anticheat/lang/messages_en.yml |
| Player command | none |
| Admin commands | /dungeons admin anticheat ... |
| Switch | enabled: (first key of modules/anticheat/config.yml, on by default) + /dungeons reload |
It is not a movement anticheat. Fly, speed, nofall and timer are not its job: use a dedicated anticheat for those.
How it works
What it reads
- The player's own attack clicks on their zone mobs.
- Clicks on an invisible decoy buried under the ground of their mob area.
- Their kills and gains per minute.
- The failed click checks of the contests.
The autofighter, the AFK clones, the heroes, the enchants and the second hand never produce a flag.
With the module off, the zones and the contests behave as without it. The contests then alert their own failed clicks again.
Flags and VL
Each failure of a check is a flag. A counted flag:
- adds the check's
weightto the player's VL (violation level) of that check; - is stored in the history;
- alerts the staff;
- is compared with the check's thresholds.
A check with weight: 0 never counts a flag.
The VL falls by violations.decay-per-minute every minute and never passes max-vl. It outlives a relog until it decays. A restart clears it, but the history stays.
The checks
| Check | Flags when | Weight | Refuses the click |
|---|---|---|---|
reach | The eyes are farther than max-distance (4.5) from the mob's box. | 1 | yes (cancel: true) |
look | The ray of the player's look misses the box grown by tolerance (0.6). | 1 | no (cancel: false) |
walls | A solid block stands between the eyes and the box (loaded chunks only). | 1 | no (cancel: false) |
decoy | The invisible decoy under the ground is clicked. | 10 | - |
reaction | flag-at (5) of the last samples (8) retargets were fast. Fast = within max-ms (150) of a death, turning min-angle (30) degrees or more. | 2 | no |
flood | More than max-per-second (25) attack clicks in one second. Once per second. | 1 | no |
macro | samples (20) re-clicks in a row on the target already fought vary less than max-variation (4%). | 2 | no |
kills | More than per-minute kills in one minute. Off by default (0). | 3 | no |
earnings | More than per-minute.<currency> of a currency gained in one minute. None shipped (off). | 3 | no |
contest-reach, contest-look, contest-decoy | A contest click failed that check. The contest refuses it as always. | 1, 1, 10 | (the contest) |
The reach limit also adds what the player's interaction range attribute reaches past the vanilla 3 blocks.
Only reach refuses by default. The server sees the player's look one tick late, so look and walls can miss by a little on a fast turn. They alert and add VL instead.
- Of the aim checks (
reach,look,walls), only the first that fails is flagged. - A refused click picks no target: the player clicks again.
- Like any manual click, it already made a running autofighter stand down.
macro measures only re-clicks of the mob you already fight. Those do nothing in an auto-swing fight and are typical of an anti-AFK macro. A kill or another target starts it over.
Click times are server ticks (50 ms), so a perfect macro faster than min-interval-ms (500 ms) is not caught.
earnings counts every gain, AFK clones and heroes included. Set each ceiling above your best legit players' peak. /dungeons admin anticheat info <player> shows this minute and the peak minute, per currency.
Thresholds
Each check has thresholds:, shipped empty. Each entry is a vl and its actions:
checks:
reach:
thresholds:
- vl: 20
actions:
- '[console] kick {player} Cheating ({check})'- The lines run ONCE, one tick later, when the VL of that check rises to the
vl. - They run again only after the VL decayed below it and rose again.
- An action line is a tag like
[console]or[player]. An untagged line is a console command. {player},{check}(the check id) and{vl}are replaced. One threshold pervl.- A line with an unknown tag is dropped, with one console warning.
Alerts
Online staff with sndungeons.admin.anticheat.alerts (OP) and their alerts on get alerts.format. One alert per player and check every alerts.cooldown-seconds. alerts.console: true also writes it to the console.
Each staff member switches their own alerts with /dungeons admin anticheat alerts. The choice is kept after a relog and a restart.
Exemptions
| Who or when | Skips |
|---|---|
sndungeons.anticheat.bypass (default false: operators are checked too) | Every check. |
exempt.join-seconds after a join | The click checks (aim, reaction, flood, macro). |
exempt.teleport-seconds after a teleport, a respawn or a world change | The click checks. |
A ping above exempt.max-ping-ms | The aim and reaction checks. |
A Bedrock player (Floodgate, exempt.bedrock: true) | The aim, reaction and macro checks: touch controls attack without facing the mob. |
| A player in creative | The aim checks. |
A mob that landed (a zone NPC throw) less than exempt.landed-ticks ago | The aim checks. |
Kills, earnings and the decoys skip only the bypass. The bypass is read at the join and every exempt.permission-check-seconds.
Decoys
While a player stands in the mob area of their zone, one invisible checks.decoy.entity is buried under its ground. It sits depth blocks down, at a random spot where every block around it is solid. It moves every relocate-seconds.
A vanilla client can never see nor click it. A client that targets through the ground, or shows invisible entities, hits it. It is best effort: a bot that skips invisible entities is not caught. It needs the packet layer.
History
Every counted flag is stored in the database (table sndungeons_anticheat_flags), written in batches every 5 seconds. At most history.max-rows-per-minute rows per player: the rest still counts, alerts and runs thresholds. Rows older than history.retention-days are deleted when the module enables.
Configuration
alerts
| Key | Default | What it does |
|---|---|---|
alerts.format | '&c[AC] &f{player} &7failed &c{check} &7({detail}) &8VL {vl} x{count}' | The staff alert. {check} (its label in the module lang), {detail} (the measured value), {vl}, {count} (flags since the last alert). |
alerts.cooldown-seconds | 5 | One alert per player and check this often (0 to 3600; 0 = every flag). |
alerts.console | true | true = every alert is also written to the console. |
violations
| Key | Default | What it does |
|---|---|---|
violations.decay-per-minute | 1.0 | The VL a check loses per minute (0 to 1000; 0 = never decays). |
violations.max-vl | 1000 | The most VL a check can hold (1 to 1000000). |
exempt
| Key | Default | What it does |
|---|---|---|
exempt.join-seconds | 5 | Seconds after a join without click checks (0 to 300). |
exempt.teleport-seconds | 3 | Seconds after a teleport, respawn or world change without click checks (0 to 300). |
exempt.max-ping-ms | 350 | A ping above this skips the aim and reaction checks (0 to 10000; 0 = never). |
exempt.bedrock | true | true = Bedrock players skip the aim, reaction and macro checks. |
exempt.permission-check-seconds | 30 | How often the bypass permission is read again (5 to 3600). |
exempt.landed-ticks | 10 | Ticks after a mob landed in which the aim checks skip it (0 to 100). |
history
| Key | Default | What it does |
|---|---|---|
history.enabled | true | true = every counted flag is stored. |
history.retention-days | 30 | Rows older than this are deleted at the enable (1 to 3650). |
history.max-rows-per-minute | 30 | The most rows one player adds per minute (1 to 1000). |
checks
Every check has enabled (true), weight (the VL a counted flag adds, 0 to 1000) and thresholds ([]). The other keys:
| Key | Default | What it does |
|---|---|---|
checks.reach.cancel | true | true = a counted failure refuses the click. |
checks.reach.max-distance | 4.5 | Most blocks from the eyes to the mob's box (3 to 32). |
checks.look.cancel | false | true = a counted failure refuses the click. |
checks.look.tolerance | 0.6 | Blocks the box grows by (0 to 2). |
checks.walls.cancel | false | true = a counted failure refuses the click. |
checks.decoy.entity | ZOMBIE | The decoy's mob type. |
checks.decoy.depth | 0.25 | Blocks below the ground (0 to 4). |
checks.decoy.relocate-seconds | 30 | How often the decoy moves (5 to 3600). |
checks.reaction.max-ms | 150 | A new target picked within this many ms of the last one's death is fast (50 to 2000). |
checks.reaction.min-angle | 30 | ...when the turn is at least this many degrees (0 to 180). |
checks.reaction.samples | 8 | The retargets kept (2 to 64). |
checks.reaction.flag-at | 5 | Fast retargets among the samples that flag. |
checks.flood.max-per-second | 25 | Attack clicks per second before a flag (5 to 1000). |
checks.macro.samples | 20 | Re-click intervals in a row (5 to 200). |
checks.macro.min-interval-ms | 500 | The shortest interval that counts. |
checks.macro.max-interval-ms | 10000 | The longest interval that counts. |
checks.macro.max-variation | 0.04 | Flags when the deviation over the mean is below this (0 to 1). |
checks.kills.per-minute | 0 | Kills of progress per minute before a flag (0 = off, up to 1000000). |
checks.earnings.per-minute | {} | Currency id to its most per minute. A currency not listed is not checked. |
Default weights: decoy and contest-decoy 10, reaction and macro 2, kills and earnings 3, every other check 1.
modules/anticheat/config.yml (earnings example)
earnings:
enabled: true
weight: 3.0
thresholds: []
# sn:extensible
per-minute:
souls: 5000000The display-name key ('&cAnticheat') is the module's name in /dungeons admin modules.
Messages
modules/anticheat/lang/messages_en.yml holds the label of each check ({check}) and the unit written after its value ({detail}). admin.time-format (yyyy-MM-dd HH:mm:ss) writes the time of the history lines.
Commands
| Command | Permission | Description |
|---|---|---|
/dungeons admin anticheat alerts | sndungeons.admin.anticheat.alerts | Switches your own anticheat alerts off or on. Holders of this node receive the alerts. |
/dungeons admin anticheat info <player> | sndungeons.admin.anticheat.info | Shows the violations, thresholds, rates, exemptions and last flags of an online player. |
/dungeons admin anticheat history <player> [page] | sndungeons.admin.anticheat.history | Lists the stored flags of a player, also offline, newest first. |
/dungeons admin anticheat reset <player> [check] | sndungeons.admin.anticheat.reset | Clears the violations of a player, or of one check, also offline, and re-arms their thresholds. |
| Permission | Default | What it gives |
|---|---|---|
sndungeons.anticheat.bypass | false | Never checked by the anticheat module. |
history shows 10 flags per page. /dungeons admin inspect player <player> also shows an anticheat section, with the decoy's position. Full lists: Commands and Permissions.
Placeholders
The anticheat placeholders are listed in Placeholders:
| Placeholder | Value |
|---|---|
%sndungeons_anticheat_vl% | The sum of your violation levels, 1 decimal |
%sndungeons_anticheat_vl_<check>% | The violation level of one check (anticheat_vl_reach, anticheat_vl_contest-look) |
%sndungeons_anticheat_alerts% | on or off: your staff alerts (_label for the word) |
%sndungeons_anticheat_exempt% | true while you hold the bypass permission |
Tips
- Run a week with alerts only. Then add thresholds where the history shows clear cheaters.
- Start thresholds on
decoyandreach: a vanilla client cannot hit a decoy, and reach has room for ping. - Before you set
killsorearnings, read the peak minute of your best players withinfo. - Give
sndungeons.anticheat.bypassonly to test accounts: operators are checked on purpose.
Default modules/anticheat/config.yml
enabled: true
# ============================================================
# SnDungeons - anticheat 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 anticheat off on
# /dungeons reload; the zones and the contests then behave as without it
# (the contests alert their own failed clicks again).
# It catches cheats through ABNORMAL play in this plugin only: the player's
# own clicks on their zone mobs (reach, look, walls, reaction, flood,
# macro), clicks on an invisible decoy under the ground of the mob area,
# kills and gains per minute, and the failed clicks of the contests. It is
# not a movement anticheat (fly, speed, timer): use a dedicated one.
# Each counted flag adds the check's weight to the player's VL of that
# check, alerts the staff (sndungeons.admin.anticheat.alerts, toggled with
# /dungeons admin anticheat alerts), is stored in the history and is
# compared with the check's thresholds. Nothing punishes until you write a
# threshold. The autofighter, the afk clones, the heroes and the enchants
# never produce a flag. Players with sndungeons.anticheat.bypass are never
# checked.
# Name of the module in /dungeons admin modules (color codes allowed).
display-name: '&cAnticheat'
alerts:
# The staff alert: {player}, {check} (its label in the module lang),
# {detail} (the measured value), {vl} (the VL after the flag) and {count}
# (the flags since the last alert of that player and check).
format: '&c[AC] &f{player} &7failed &c{check} &7({detail}) &8VL {vl} x{count}'
# One alert per player and check this often, in seconds (0 to 3600; 0 =
# every flag). The flags in between are counted in {count}.
cooldown-seconds: 5
# true = every alert is also written to the console.
console: true
violations:
# The VL a check loses per minute (0 to 1000; 0 = it never decays).
decay-per-minute: 1.0
# The most VL a check can hold (1 to 1000000).
max-vl: 1000
exempt:
# Seconds after a join in which the click checks skip the player (0 to
# 300).
join-seconds: 5
# Seconds after a teleport, a respawn or a world change in which the
# click checks skip the player (0 to 300).
teleport-seconds: 3
# A ping above this (milliseconds) skips the aim and reaction checks (0
# to 10000; 0 = never).
max-ping-ms: 350
# true = a Bedrock player (Floodgate) skips the aim, reaction and macro
# checks: touch controls attack without facing the mob.
bedrock: true
# How often the bypass permission of the online players is read again,
# in seconds (5 to 3600).
permission-check-seconds: 30
# Ticks after a mob landed (a throw of the zone NPC) in which the aim
# checks skip it: the client still moves it (0 to 100).
landed-ticks: 10
history:
# true = every counted flag is stored (/dungeons admin anticheat history).
enabled: true
# Rows older than this many days are deleted at the enable (1 to 3650).
retention-days: 30
# The most rows one player adds per minute (1 to 1000); the flags past it
# still count, alert and run thresholds.
max-rows-per-minute: 30
# The checks. Each has enabled, weight (the VL a counted flag adds, 0 to
# 1000) and thresholds: a list of a vl and its action lines, run ONCE when
# the VL of that check rises to the vl; again only after it decayed below
# and rose again. An action line is a tag like [console] or [player] (an
# untagged line is a console command); {player}, {check} and {vl} are
# replaced. Example:
# thresholds:
# - vl: 20
# actions:
# - '[console] kick {player} Cheating ({check})'
checks:
# The eyes of the player farther from the clicked mob's box than
# max-distance blocks (3 to 32).
reach:
enabled: true
weight: 1.0
# true = a counted failure refuses the click (the mob is not targeted).
cancel: true
max-distance: 4.5
thresholds: []
# The ray of the player's look misses the mob's box grown by tolerance
# blocks (0 to 2). The server's rotation is a tick old at the click, so
# it alerts without refusing by default.
look:
enabled: true
weight: 1.0
cancel: false
tolerance: 0.6
thresholds: []
# A solid block between the eyes and the mob's box (loaded chunks only).
walls:
enabled: true
weight: 1.0
cancel: false
thresholds: []
# An invisible mob under the ground of the player's mob area, moved every
# relocate-seconds (5 to 3600); a normal client can never see nor click
# it. entity: a mob type; depth: blocks below the ground (0 to 4).
decoy:
enabled: true
weight: 10.0
entity: ZOMBIE
depth: 0.25
relocate-seconds: 30
thresholds: []
# A new target picked within max-ms (50 to 2000) of the last one's death,
# after turning at least min-angle degrees (0 to 180): flagged when
# flag-at of the last samples retargets (2 to 64) were that fast.
reaction:
enabled: true
weight: 2.0
max-ms: 150
min-angle: 30
samples: 8
flag-at: 5
thresholds: []
# More attack clicks on the player's mobs in one second than
# max-per-second (5 to 1000); once per second.
flood:
enabled: true
weight: 1.0
max-per-second: 25
thresholds: []
# samples (5 to 200) intervals in a row between re-clicks of the same live
# target, each from min-interval-ms to max-interval-ms, varying less than
# max-variation (0 to 1; the deviation over the mean): an anti-afk bot.
# A kill or a new target starts the count again.
macro:
enabled: true
weight: 2.0
samples: 20
min-interval-ms: 500
max-interval-ms: 10000
max-variation: 0.04
thresholds: []
# More kills of progress in one minute than per-minute (0 = off, up to
# 1000000); once per minute.
kills:
enabled: true
weight: 3.0
per-minute: 0
thresholds: []
# More of a currency gained in one minute than its amount in per-minute
# (the afk clones' and heroes' payouts count too); once per minute and
# currency. A currency not listed is not checked. Set each amount above
# your best legit minute (/dungeons admin anticheat info shows the
# current and the peak minute). Example:
# per-minute:
# souls: 5000000
earnings:
enabled: true
weight: 3.0
thresholds: []
# sn:extensible
per-minute: {}
# The failed clicks of the contests (their own reach, look and decoy
# checks; the contest still refuses the click). With this module on they
# are alerted by it, in the format above.
contest-reach:
enabled: true
weight: 1.0
thresholds: []
contest-look:
enabled: true
weight: 1.0
thresholds: []
contest-decoy:
enabled: true
weight: 10.0
thresholds: []