McGuard (插件)
一款轻量级的、基于事件的 Bukkit 系列服务端反作弊。
一个 jar 包即可运行于 CraftBukkit、Spigot、Paper、Purpur、Pufferfish、Folia,以及混合核心(Arclight、Mohist)。无需 mixins,无需数据包拦截,无需 NMS —— 玩家使用未修改的客户端加入服务器,且在下一个版本更新时不会出现兼容性问题。
它是什么——以及诚实地说它不是什么
McGuard 响应 Bukkit 事件(移动、攻击、破坏、放置)并读取服务端权威状态——位置增量、服务端速度、服务端坠落距离、延迟。它不会像 Grim 或 Vulcan 那样逐包模拟玩家的移动数据包。
因此请明确其范围: McGuard 在细微的移动作弊检测上无法与基于数据包模拟的反作弊相媲美。但它能做的是,以低成本和稳定性捕获绝大多数服务器实际遇到的作弊行为——飞行、加速、超距、杀戮光环、自动点击器、炸矿、计时器、快速放置——并通过延迟补偿保护合法的高延迟玩家,同时在整个 Minecraft/Forge/Paper 补丁版本间保持零维护成本。它可以独立运行于中小型服务器,也可以作为廉价的第二意见和审计日志与数据包反作弊并行运行。
所有默认设置都经过调整以最小化误报。对真实玩家进行错误封禁比让作弊者多存活 30 秒对服务器的伤害更大。
13 项检测
| 检测项 |
信号 |
在 Bukkit 上的强度 |
| Speed |
穿过感知修改器的包络线后的水平方块/刻,受 streak 限制 |
强 |
| Flight |
在没有合法来源的情况下持续滞空 |
强 |
| NoFall |
服务端观察到大幅下落,但服务端记录的坠落距离仍约为 0 |
启发式 |
| InvalidMove |
无传送缓冲期的传送级位移增量 |
强 |
| Reach |
眼点到命中盒的距离超出原版 + 延迟奖励 |
强 |
| KillAura |
视角与目标角度无合法瞄准可达,连续 3 次命中 |
强 |
| AutoClicker |
CPS 上限 且 点击节奏规律性(标准差) |
强 |
| Timer |
每秒动作数超过刻率上限 |
强 |
| NoSlow |
进食/喝水/举盾/拉弓时全速移动 |
良好(Paper),仅限盾牌(Spigot) |
| FastPlace |
每秒放置方块数超过人类速率 |
强 |
| FastBreak |
方块破坏速度快于优化后的合法操作所能达到 |
近似值 |
| Nuker |
每秒破坏大量方块 |
强 |
| X-Ray |
在大样本中有价值矿石的比例高得离谱 |
统计性 |
较弱的检查项(NoFall, FastBreak, X-Ray)是纯服务端反作弊的固有局限——客户端是一个黑盒。将它们保留作为可疑信号的呈现手段是有价值的,最好配合用于 X-Ray 的矿石混淆插件一起使用。
跨平台设计
- 基于 Paper API 编译(它是 Spigot/Bukkit 的超集),因此所有事件类型均可解析。仅 Paper 调用的代码受到保护,使得该 jar 包也能在纯 Spigot 上加载。
- 兼容 Folia。
folia-supported: true。每个玩家的状态存储在 ConcurrentHashMap 中;每个玩家的事件在其各自的区域线程上运行;惩罚在该线程上内联执行;唯一的共享状态写入(封禁列表)通过全局区域调度器路由。
- 优雅降级。
isHandRaised()(用于 NoSlow)通过反射解析并在缺失时回退到仅盾牌模式。getPing() 被封装,以便没有该接口的平台简单地禁用延迟补偿而不是报错。启动行会打印检测到的平台和物品使用 API。
延迟补偿
反作弊误报的最大来源是信号看起来像作弊的卡顿玩家。McGuard 读取每个玩家的延迟,并在超过可配置阈值时,按比例放宽距离容忍度和杀戮光环的角度判定。默认开启;调整 latency.pingThresholdMs。
命令与权限
/mcguard(别名 /mcg, /anticheat)— 需要 mcguard.admin 权限:
status — 查看当前所有携带违规等级的玩家
vl <player> — 单个玩家的各检测项详细分解
reset <player> — 清除玩家的违规记录
exempt <player> — 切换豁免状态(测试 / 信任的工作人员)
checks — 列出所有检测项及其描述
reload — 重新读取 config.yml
| 权限 |
默认值 |
含义 |
mcguard.admin |
op |
运行命令,接收违规警报 |
mcguard.bypass |
false |
使持有者豁免所有检测项 |
安装
- 将
mcguard-<version>.jar 放入服务端的 plugins/ 文件夹。
- 启动服务器一次 —— 生成
plugins/McGuard/config.yml。
- 在正常游戏和轻度 PvP 期间观察
/mcguard status。
- 调整阈值,然后可选地将
violations.banEnabled 设为 true。
需要 Java 17+ 和 Minecraft 1.20.x,适用于任何基于 Bukkit 的服务器。
标志位以 CSV 格式追加到 plugins/McGuard/violations.log(timestamp,player,uuid,check,vl,detail),供外部仪表盘使用。
发布前 / 上线前
- 首先在自己的服务器上测试,设置
violations.banEnabled: false。这些阈值只是一个起点,并非绝对真理。
- 如果你已经运行了基于数据包的 anticheat(Grim, Vulcan),仅启用它未覆盖的检测项,或者纯粹将 McGuard 用作审计日志——不要在同一个信号上堆叠两个自动封禁系统。
- 在上传到 CurseForge/Modrinth 之前,设置真实的许可证和问题追踪器 URL。
从源代码构建(如果你下载了源代码)
./gradlew build # -> build/libs/mcguard-<version>.jar
./gradlew installToServer # 同时将 jar 复制到 ../../server/plugins
McGuard (plugin)
A lightweight, event-based server-side anticheat for the whole Bukkit family.
One jar runs on CraftBukkit, Spigot, Paper, Purpur, Pufferfish, Folia, and
hybrids (Arclight, Mohist). No mixins, no packet interception, no NMS —
players join with an unmodified client and nothing to break on the next update.
What it is — and honestly what it is not
McGuard reacts to Bukkit events (move, attack, break, place) and reads
server-authoritative state — position deltas, server velocity, server fall
distance, ping. It does not simulate the player's movement packet-by-packet
the way Grim or Vulcan do.
So be clear-eyed about scope: McGuard will not match a packet-simulation
anticheat on subtle movement cheats. What it does do is catch the cheats the
overwhelming majority of servers actually see — flight, speed, reach, kill-aura,
auto-clicker, nuker, timer, fast-place — cheaply and stably, with lag
compensation to keep legitimate high-ping players safe, and with zero
maintenance across Minecraft/Forge/Paper patch versions. Run it standalone on a
small/medium server, or alongside a packet AC as a cheap second opinion and
audit log.
Every default is tuned to under-flag. A false ban on a real player hurts a
server more than a cheater surviving another 30 seconds.
The 13 checks
| Check |
Signal |
Strength on Bukkit |
| Speed |
horizontal blocks/tick past a modifier-aware envelope, streak-gated |
strong |
| Flight |
sustained airtime without a legitimate source |
strong |
| NoFall |
large server-observed descent while server fall distance stayed ~0 |
heuristic |
| InvalidMove |
teleport-sized delta with no teleport grace |
strong |
| Reach |
eye-to-hitbox distance beyond vanilla + ping bonus |
strong |
| KillAura |
look-vs-target angle no legit aim reaches, 3-hit streak |
strong |
| AutoClicker |
CPS ceiling and click-rhythm regularity (std-dev) |
strong |
| Timer |
actions/second above the tick-rate ceiling |
strong |
| NoSlow |
full speed while eating/drinking/blocking/bow-drawing |
good (Paper), shield-only (Spigot) |
| FastPlace |
blocks placed/second past a human rate |
strong |
| FastBreak |
block broken faster than an optimised legit setup could |
approximate |
| Nuker |
many blocks/second |
strong |
| X-Ray |
valuable-ore ratio implausibly high over a large sample |
statistical |
Weaker checks (NoFall, FastBreak, X-Ray) are inherent limits of a pure
server-side AC — the client is a black box. They are worth keeping as
suspect-surfacing signals, best paired with an ore-obfuscation plugin for X-Ray.
Cross-platform design
- Compiled against the Paper API (a superset of Spigot/Bukkit), so all
event types resolve. Paper-only calls are guarded so the jar loads on plain
Spigot too.
- Folia-safe.
folia-supported: true. Per-player state is a
ConcurrentHashMap; each player's events run on their own region thread;
punishment happens inline on that thread; the only shared-state write (the ban
list) is routed through the global region scheduler.
- Graceful degradation.
isHandRaised() (for NoSlow) is resolved
reflectively and falls back to shield-only where absent. getPing() is
wrapped so a platform without it simply disables lag compensation instead of
erroring. The startup line prints which platform and item-use API were
detected.
Lag compensation
The single biggest source of anticheat false positives is a laggy player whose
signals look like a cheat. McGuard reads each player's ping and, above a
configurable threshold, widens reach tolerance and the kill-aura angle
proportionally. On by default; tune latency.pingThresholdMs.
Commands & permissions
/mcguard (aliases /mcg, /anticheat) — requires mcguard.admin:
status — everyone currently carrying a violation level
vl <player> — per-check breakdown for one player
reset <player> — clear a player's violations
exempt <player> — toggle exemption (testing / trusted staff)
checks — list every check and its description
reload — re-read config.yml
| Permission |
Default |
Meaning |
mcguard.admin |
op |
run commands, receive violation alerts |
mcguard.bypass |
false |
exempt the holder from every check |
Install
- Drop
mcguard-<version>.jar into your server's plugins/ folder.
- Start the server once —
plugins/McGuard/config.yml is generated.
- Watch
/mcguard status during normal play and light PvP.
- Tune thresholds, then optionally raise
violations.banEnabled to true.
Requires Java 17+ and Minecraft 1.20.x on any Bukkit-based server.
Flags are appended to plugins/McGuard/violations.log as CSV
(timestamp,player,uuid,check,vl,detail) for external dashboards.
Before publishing / going live
- Test on your own server first with
violations.banEnabled: false. These
thresholds are a starting point, not gospel.
- If you already run a packet-based anticheat (Grim, Vulcan), enable only the
checks it does not cover, or run McGuard purely for its audit log — do not
stack two auto-banners on the same signal.
- Set a real license and issue-tracker URL before uploading to
CurseForge/Modrinth.
Build from source (If u download source code)
./gradlew build # -> build/libs/mcguard-<version>.jar
./gradlew installToServer # also copies the jar into ../../server/plugins
评论 0
登录后参与评分
还没有评论,来抢沙发吧