mknockback

插件

· 作者 my-txz

修复了因延迟和原始击退漏洞导致的不公平 PVP 击退问题。

0 本站下载 0 关注 更新于 3 个月前

需要前置:PacketEvents

最新 2.1.0 · 26.2 · Paper / Purpur

一键开服(送7天)

mknockback

  • Spigot / Paper / Purpur
  • Java 8 bytecode, runs 1.7 through 26.2
  • MIT

Purpose

Two things. Fix wrong-direction knockback for laggy players. Do some cheap movement detection that doesn't false-positive on honey blocks. That's it.

Knockback

So the thing is. You're playing. Your ping is whatever. Server thinks you're at one spot, your client thinks you're at another. Someone hits you. Server calculates knockback relative to the server-side position. You fly off sideways. Everyone thinks you're glitching. You're not. The server just used the wrong position.

mknockback looks at where your client actually thinks you are — current position plus your movement vector times ping ticks — and rotates the knockback vector to point at that. Then it fires the corrected velocity at you. Works with PacketEvents for the good path, falls back to a one-tick delayed setVelocity if you don't have it installed.

Has a multiplier. Has a minimum vertical velocity threshold so tiny nudges don't get recalculated. Skips projectiles. Skips things that aren't aimed at you.

Movement checks

Three checks. Speed. Hover. Fall. That's the whole set.

Speed check normalizes your horizontal velocity by elapsed ticks — actual time, not event count — then compares against max-speed plus a ping buffer (pingTicks × 0.3). Needs required-violations consecutive over-limit ticks before it says anything.

Hover check watches for mid-air suspension where vertical velocity stays under 0.05 for hover-ticks — default 30, about 1.5 seconds. Also checks that you were actually falling before that, so you can't just stand on a block and get flagged.

Fall check is similar to speed but downward. max-fall-speed plus ping tolerance, two consecutive violations.

The exemption list is long. Flight, creative, vehicles, elytra, ladders, vines, liquids, riptide, bubble columns, cobwebs, slow-falling, honey blocks, external knockback from attacks or explosions, wind charges, recent jump, recent teleport, recent knockback, recent join. All of it is checked and skipped before any counter increments.

Big displacement over teleport-threshold resets everything.

Config

18 keys, live-reloadable. YAML file. Change anything with /mkb config <path> <value> or the inventory GUI that only OPs see. No restart. Fields are volatile so the network thread reads the latest value without extra locking.

Dependencies

Spigot API 1.12.2 — provided, compile target only. PacketEvents 2.13.0 — soft, provided. If it's there you get the fast path and cross-version ping without NMS reflection. If it's not, the plugin degrades gracefully.

ProtocolLib, ProtocolSupport, ViaVersion, ViaBackwards, ViaRewind, Geyser — soft-declared in plugin.yml, no compile dependency on any of them.

Commands

/mkb is the entry point. Subcommands: status, on, off, restart, reload, gui, config <path> <value>, debug. Permission node is mknockback.admin, defaults to OP.

Architecture

HitInfo only stores primitives — immutable snapshot, main thread writes it, PacketEvents network thread reads it. ConfigManager holds the volatile caches. PacketEventsBridge is loaded via Class.forName() when PacketEvents is present, so the classes never load if the plugin isn't installed. VersionUtils does all the reflection shims for 1.13+ APIs.

Java 7 compatible source, no lambdas, no streams, no diamond operators, no ConcurrentHashMap.merge().

你是这个资源的作者?登录后可认领此资源。

评论 0

0.0
暂无评分
5 星
0
4 星
0
3 星
0
2 星
0
1 星
0
我的评分

登录后参与评分

还没有评论,来抢沙发吧

评论配图

相似资源