CodeAntiESP
版本: 1.0.0
作者: CodeTeam
服务端: Paper 1.20+
Java: 17+
一种基于服务端的反作弊数据包过滤器,可在不安装任何客户端插件的情况下中和透视(ESP)、X光、自由视角和结构探测等作弊行为。CodeAntiESP 通过 ProtocolLib 拦截并重写出站数据包,使恶意客户端无法获取作弊所需的数据。
工作原理
CodeAntiESP 以最高优先级挂钩到服务端的数据包管道中,实时按玩家重写或取消出站数据包。它追踪每个玩家的真实位置、视距和地下状态,以确定他们合法可以看到哪些方块、实体和结构——并隐藏其余所有内容。
核心模块
地下方块混淆(防 X-Ray)
- 将低于可配置 Y 轴高度(默认:Y=16)的所有地下方块状态,在出站区块、方块变更和多方块变更数据包中替换为石头
- 两种模式:安全的区块后掩码(默认)在区块加载后发送假的方块变更覆盖层——无客户端断开连接风险。可选的原始地图区块重写用于最大化吞吐量,受安全标志保护
- 从区块数据包中剥离隐藏的方块实体数据(箱子、刷怪笼、金库等),以防止容器透视读取它们
- 对隐藏区域的方块光照数据置零,防止基于光照的透视绘制洞穴地图
- 本地挖掘揭示:当玩家实际在地下破坏方块时,仅发送该方块的真实状态——并在可配置的超时后恢复
- 附近揭示:玩家周围小半径内的真实方块会被还原,以确保正常游戏玩法看起来正常
实体隐藏器(防实体透视)
- 对于低于深板岩 Y 轴高度且玩家无法合法看到的实体,取消所有与实体相关的数据包(生成、移动、元数据、装备、效果、动画等)
- 按刻扫描预算,具有可配置的吞吐量以保持 MSPT(每刻毫秒数)成本较低
- 处理实体销毁、骑乘/乘客引用和标签页列表数据包,以防止幽灵实体
玩家隐藏器(防玩家透视)
- 从实际上看不到其他玩家的观察者那里隐藏其他玩家(没有视线或距离太远)
- 使用服务端
hasLineOfSight 检查,带有可配置的距离阈值
- 按查看者/目标对缓存可见性决策,带有 TTL(生存时间)以避免冗余射线投射
- 将隐藏的玩家保留在标签页列表中(使他们仍然显示在线),同时抑制其世界中的实体数据包
自由视角检测
- 根据服务端缓存的玩家位置验证传入的位置数据包
- 如果移动数据包报告的位置超出配置的失同步阈值(默认:48 个方块),则该玩家被隔离——暂时阻止为该玩家发送新的区块数据包
- 检测针对服务器视图矩阵之外区块的区块、方块变更和多方块变更数据包
- 所有违规行为都会触发管理员警报,并带有单玩家冷却时间以防止垃圾信息
透视诱饵(蜜罐)
- 在每个玩家周围的随机地下位置发送短命的假实体生成数据包(僵尸、骷髅、苦力怕、盔甲架——完全可配置)
- 透视客户端会将这些渲染为真实实体,使透视叠加层不可靠且令人困惑
- 诱饵在可配置的生命周期后自动过期,且从来不是真正的服务端实体——零世界影响
假方块诱饵(蜜罐)
- 在随机地下位置为高价值方块(钻石矿石、远古残骸、箱子、刷怪笼、金库等)发送假的方块变更数据包
- X 光客户端会看到实际上并不存在的假矿石和容器
- 当玩家足够接近时,方块会恢复为其真实状态
- 完全可配置的方块类型、生成速率、生命周期、距离和 Y 范围
紫水晶簇隐藏器
- 在玩家实际上靠近之前,向透视客户端隐藏紫水晶方块、萌芽紫水晶和紫水晶簇/芽
- 扫描可配置的 Y 范围,并在出站数据包中将紫水晶替换为石头
- 当玩家进入渲染距离时揭示真实的紫水晶,离开时再次隐藏
结构隐藏器
- 阻止泄露结构数据的通道上的自定义有效负载数据包:
debug/、structure、worldgen、poi、village、stronghold、mineshaft、monument、fortress、bastion、end_city、ancient_city、trail_ruins、trial_chambers、jigsaw
- 取消可以暴露结构边界框的调试样本有效负载
- 几乎零 MSPT 成本——纯数据包取消
管理员警报
- 当玩家被标记为可疑行为时,拥有
codeantiesp.alerts 权限的工作人员会收到实时游戏内警报
- 所有标记事件的控制台日志记录(可配置)
- 单玩家警报冷却时间以防止聊天垃圾信息
/codeantiesp status 显示实时运行时统计信息(跟踪的玩家、活动模块、配置值)
命令
| 命令 |
描述 |
/codeantiesp |
显示运行时状态和所有活动模块状态 |
/codeantiesp reload |
在不重启服务器的情况下重新加载 config.yml |
/codeantiesp status |
与 /codeantiesp 相同——显示当前配置和跟踪的玩家数量 |
权限
| 权限 |
默认值 |
描述 |
codeantiesp.admin |
op |
管理插件(重新加载、状态) |
codeantiesp.alerts |
op |
在聊天中接收实时可疑玩家警报 |
配置
CodeAntiESP 附带合理的默认设置——将 jar 放入即可工作。每个模块都可以在 config.yml 中单独切换和调整:
deepslate-y-level — 隐藏地下数据的 Y 坐标上限(默认值:16)
post-chunk-mask — 区块加载后的安全假方块遮罩(默认值:开启)
nearby-reveal-radius-blocks — 玩家周围此半径内的真实方块可见(默认值:5)
entity-hider — 向地表玩家隐藏地下实体(默认值:开启)
player-hider — 隐藏无视线接触的在线玩家(默认值:开启)
freecam-detection — 验证移动数据包并屏蔽超出范围的区块(默认值:开启)
esp-decoys — 发送假的实体诱饵以干扰 ESP 透视(默认值:开启)
fake-block-decoys — 发送假的矿石/容器诱饵以干扰 X-Ray 透视(默认值:关闭)
amethyst-cluster-hider — 向 ESP 透视隐藏紫水晶洞(默认值:关闭)
structure-hider — 屏蔽用于揭示结构的数据包通道(默认值:开启)
disabled-worlds — CodeAntiESP 不生效的世界(默认值:spawn, afk)
依赖项
性能优化
- 区块加载后遮罩采用预算机制:通过可配置的每秒区块段数、每步层数和纳秒级时间片预算(默认值:0.75 毫秒),确保遮罩处理不会导致 MSPT(每刻服务器处理时间)飙升
- 实体隐藏采用预算机制:通过可配置的每秒处理玩家数及轮换游标实现均匀分布
- 使用带生存时间(TTL)的可见性缓存,防止重复进行射线检测和距离计算
- 结构隐藏仅通过取消数据包实现——开销几乎为零
CodeAntiESP
Version: 1.0.0
Author: CodeTeam
Server: Paper 1.20+
Java: 17+
A server-side anti-cheat packet filter that neutralizes ESP, X-Ray, Freecam and structure-detection cheats — without installing anything on the client. CodeAntiESP intercepts and rewrites outgoing packets via ProtocolLib so that malicious clients never receive the data they need to cheat.
How It Works
CodeAntiESP hooks into the server's packet pipeline at the highest priority and rewrites or cancels outgoing packets per-player, in real time. It tracks each player's actual position, view distance and underground status to determine exactly which blocks, entities and structures they are legitimately allowed to see — and hides everything else.
Core Modules
Underground Block Obfuscation (Anti-X-Ray)
- Replaces all underground block states below a configurable Y level (default: Y=16) with stone in outgoing chunk, block-change and multi-block-change packets
- Two modes: safe post-chunk masking (default) sends fake block-change overlays after chunk load — no risk of client disconnects. Optional raw map-chunk rewriting for maximum throughput, gated behind a safety flag
- Strips hidden block-entity data (chests, spawners, vaults, etc.) from chunk packets so container ESP cannot read them
- Zeros block-light data for hidden sections to prevent light-based ESP from mapping caves
- Local mining reveal: when a player actually breaks a block underground, only that block's real state is sent back — and it reverts after a configurable timeout
- Nearby reveal: real blocks within a small radius around the player are restored so legitimate gameplay looks normal
Entity Hider (Anti-Entity-ESP)
- Cancels all entity-related packets (spawn, movement, metadata, equipment, effects, animation, etc.) for entities below the deepslate Y level that the player cannot legitimately see
- Budgeted per-tick scanning with configurable throughput to keep MSPT cost low
- Handles entity destroy, mount/passenger references and tab-list packets to prevent ghost entities
Player Hider (Anti-Player-ESP)
- Hides other players from viewers who cannot actually see them (no line-of-sight or too far away)
- Uses server-side
hasLineOfSight checks with a configurable distance threshold
- Caches visibility decisions per viewer/target pair with a TTL to avoid redundant raycasts
- Keeps hidden players in the tab list (so they still appear online) while suppressing their in-world entity packets
Freecam Detection
- Validates incoming position packets against the server's cached player position
- If a movement packet reports a position farther than the configured desync threshold (default: 48 blocks), the player is quarantined — new chunk packets are temporarily blocked for that player
- Detects chunk, block-change and multi-block-change packets targeting chunks outside the server's view matrix
- All violations trigger admin alerts with per-player cooldown to prevent spam
ESP Decoys (Honeypot)
- Sends short-lived fake entity spawn packets (zombies, skeletons, creepers, armor stands — fully configurable) at random underground locations around each player
- ESP clients render these as real entities, making ESP overlays unreliable and confusing
- Decoys auto-expire after a configurable lifetime and are never real server entities — zero world impact
Fake Block Decoys (Honeypot)
- Sends fake block-change packets for high-value blocks (diamond ore, ancient debris, chests, spawners, vaults, etc.) at random underground positions
- X-Ray clients see fake ores and containers that don't actually exist
- Blocks are restored to their real state when the player gets close enough
- Fully configurable block types, spawn rate, lifetime, distance and Y range
Amethyst Cluster Hider
- Hides amethyst blocks, budding amethyst and amethyst clusters/buds from ESP clients until the player is actually nearby
- Scans a configurable Y range and replaces amethyst with stone in outgoing packets
- Reveals real amethyst when the player enters the render distance, then re-hides it when they leave
Structure Hider
- Blocks custom payload packets on channels that leak structure data:
debug/, structure, worldgen, poi, village, stronghold, mineshaft, monument, fortress, bastion, end_city, ancient_city, trail_ruins, trial_chambers, jigsaw
- Cancels debug sample payloads that can expose structure bounding boxes
- Near-zero MSPT cost — pure packet cancellation
Admin Alerts
- Real-time in-game alerts to staff with the
codeantiesp.alerts permission when a player is flagged for suspicious behavior
- Console logging of all flagged events (configurable)
- Per-player alert cooldown to prevent chat spam
/codeantiesp status shows live runtime statistics (tracked players, active modules, config values)
Commands
| Command |
Description |
/codeantiesp |
Shows runtime status and all active module states |
/codeantiesp reload |
Reloads config.yml without restarting the server |
/codeantiesp status |
Same as /codeantiesp — displays current configuration and tracked player count |
Permissions
| Permission |
Default |
Description |
codeantiesp.admin |
op |
Manage the plugin (reload, status) |
codeantiesp.alerts |
op |
Receive real-time suspicious-player alerts in chat |
Configuration
CodeAntiESP ships with sensible defaults — drop the jar in, and it works. Every module can be individually toggled and tuned in config.yml:
deepslate-y-level — Y level below which underground data is hidden (default: 16)
post-chunk-mask — safe fake-block overlay after chunk load (default: on)
nearby-reveal-radius-blocks — real blocks restored within this radius of the player (default: 5)
entity-hider — hide underground entities from surface players (default: on)
player-hider — hide players without line-of-sight (default: on)
freecam-detection — validate movement packets and block out-of-range chunks (default: on)
esp-decoys — send fake entity honeypots to poison ESP (default: on)
fake-block-decoys — send fake ore/container honeypots to poison X-Ray (default: off)
amethyst-cluster-hider — hide amethyst geodes from ESP (default: off)
structure-hider — block structure-revealing payload channels (default: on)
disabled-worlds — worlds where CodeAntiESP does nothing (default: spawn, afk)
Dependencies
- ProtocolLib 5.3.0+ (required)
Performance
- Post-chunk masking is budgeted: configurable sections-per-tick, layers-per-step and a nanosecond tick budget (default: 0.75 ms) ensure masking never spikes MSPT
- Entity hiding is budgeted: configurable players-per-tick with a rotating cursor for even distribution
- Visibility caches with TTLs prevent redundant raycasts and distance checks
- Structure hiding is pure packet cancellation — effectively zero cost
评论 0
登录后参与评分
还没有评论,来抢沙发吧