MaceDamageCap
一款轻量级的 Paper 插件,用于限制原版 Minecraft 战锤(Mace)造成的最大伤害。专为 Paper 1.21+ SMP 服务器打造,旨在解决 PvP、刷怪塔或其他场景中因高空坠落伤害过高而导致玩家被一击秒杀或农场瞬间被毁的失衡问题。
由 salatube <3 用心制作
功能特性
- 限制最大战锤伤害:将最大伤害值设定为可配置的值(默认
14.0 = 7颗心),无论坠落距离、附魔(如密度、穿透、克死灵等)、暴击、力量药水效果或其他任何伤害修饰因子如何。
- 保留所有原版战锤机制:击退、音效、粒子效果和附魔效果均正常工作;仅在伤害值超过上限时对其数值进行削减。
- 基于 UUID 存储的逐玩家豁免系统:数据持久化保存于磁盘,重启后依然有效,同时支持在线和离线玩家。
- 热重载配置:在游戏中修改上限后,配置会直接写入
config.yml。
- Tab 补全:支持所有子命令和参数的自动补全。
- 带颜色的专业聊天消息:支持可配置的聊天前缀。
- 零 NMS / 零依赖:仅使用 Paper API 和
net.kyori.adventure。
- 生产就绪且适合 SMP:采用单个高优先级事件监听器,无每刻(per-tick)开销。
安装
- 从 Releases 标签页下载最新的
MaceDamageCap-*.jar。
- 将其放入服务器的
plugins/ 文件夹中。
- 启动(或重启)服务器。
- 编辑
plugins/MaceDamageCap/config.yml 以调整上限、前缀和限制。
需要 Paper 1.21+ 和 Java 21+。
配置
文件路径:plugins/MaceDamageCap/config.yml
# MaceDamageCap - 主配置文件
# Made with love by salatube <3
# 允许的任何原版战锤攻击的最大伤害值。
# 1点伤害 = 0.5颗心。默认值 14 = 7颗心。
damage-cap: 14.0
# 允许的最小上限值。设置低于此值的命令将被拒绝。
min-cap: 0.0
# 允许的最大上限值。设置高于此值的命令将被拒绝。
max-cap: 1000.0
# 所有插件消息使用的聊天前缀。支持 &-颜色代码。
messages-prefix: "&6&lMaceDamageCap &8&l\u00BB &r"
# 是否将上限更改记录到服务器控制台。
log-changes: true
所有设置都会在重启后保持不变。通过 /mdc set 进行的更改会自动保存。
豁免数据存储在一个单独的文件 plugins/MaceDamageCap/bypass.yml 中,格式为玩家 UUID 列表。
命令
| 命令 |
描述 |
权限 |
/macedamagecap |
显示插件信息、当前上限及帮助。 |
macedamagecap.admin |
/macedamagecap help |
显示帮助菜单。 |
macedamagecap.admin |
/macedamagecap get |
显示当前的伤害上限。 |
macedamagecap.admin |
/macedamagecap set <damage> |
更改大锤(Mace)的最大伤害上限。 |
macedamagecap.admin |
/macedamagecap reload |
重新加载 config.yml 和 bypass.yml。 |
macedamagecap.admin |
/macedamagecap bypass add <player> |
授予某玩家豁免权(基于 UUID)。 |
macedamagecap.admin |
/macedamagecap bypass remove <player> |
撤销某玩家的豁免权。 |
macedamagecap.admin |
/macedamagecap bypass list |
列出所有已启用豁免权的玩家。 |
macedamagecap.admin |
/macedamagecap bypass check <player> |
检查某玩家是否启用了豁免权。 |
macedamagecap.admin |
别名:/mdc, /macecap
玩家参数接受玩家名称(在线或曾经加入过的)或原始 UUID。
权限
| 权限 |
描述 |
默认值 |
macedamagecap.admin |
允许使用所有 /macedamagecap 子命令。 |
op |
macedamagecap.bypass |
绕过锤类伤害上限。通过命令自动附加。 |
false |
你也可以通过权限插件(如 LuckPerms 等)手动授予玩家 macedamagecap.bypass 权限,他们将绕过伤害上限——无需使用 /mdc 命令。
工作原理
- 插件以
HIGH 优先级监听 EntityDamageByEntityEvent 事件。
- 如果攻击者是手持
Material.MACE(大锤)作为主手的玩家,则会将最终计算出的伤害(已包含坠落距离、附魔、暴击及其他所有原版修正)与 damage-cap 进行比较。
- 如果该值更高,则调用
event.setDamage(cap) —— 命中保留所有的击退、音效和粒子效果,但造成的伤害恰好为上限值。
- UUID 出现在
bypass.yml 中,或拥有 macedamagecap.bypass 权限的玩家将完全跳过此检查。
示例
damage-cap: 14.0
- 普通重锤攻击:
8.0 伤害 → 保持为 8.0
- 重锤猛击(35 伤害):
35.0 伤害 → 变为 14.0
- 绕过玩家的重锤猛击:
35.0 伤害 → 保持为 35.0
- 拥有 Density V 的绕过玩家的重锤猛击:不受上限限制
从源代码构建
git clone https://github.com/peroxide-dev/macedamagecap
cd MaceDamageCap
mvn clean package
编译后的 jar 文件将位于 target/MaceDamageCap-<version>.jar。
致谢
由 salatube 用心制作 <3
MaceDamageCap
A lightweight Paper plugin that caps the maximum damage dealt by the vanilla Minecraft Mace. Built for Paper 1.21+ SMP servers where Mace smashes are unbalanced in PvP, raid farms, or any scenario where high fall-distance damage can one-shot players or destroy farms instantly.
Made with love by salatube <3
Features
- Caps the maximum Mace damage at a configurable value (default
14.0 = 7 hearts), regardless of fall distance, enchantments (Density, Breach, Smite, etc.), critical hits, Strength effects, or any other damage modifier.
- Preserves all vanilla Mace mechanics —> knockback, sounds, particles, and enchantment effects still work normally; only the damage value is reduced when it exceeds the cap.
- Per-player bypass system stored on disk using UUIDs, so it survives restarts and works for both online and offline players.
- Hot-reloadable configuration —> change the cap in-game and it is written straight to
config.yml.
- Tab completion for every subcommand and argument.
- Colored, professional chat messages with a configurable prefix.
- Zero NMS / zero dependencies —> uses only the Paper API and
net.kyori.adventure.
- Production-ready and SMP-safe —> single high-priority event listener, no per-tick work.
Installation
- Download the latest
MaceDamageCap-*.jar from the Releases tab.
- Drop it into your server's
plugins/ folder.
- Start (or restart) the server.
- Edit
plugins/MaceDamageCap/config.yml to tune the cap, prefix, and limits.
Requires Paper 1.21+ and Java 21+.
Configuration
File: plugins/MaceDamageCap/config.yml
# MaceDamageCap - Main Configuration
# Made with love by salatube <3
# The maximum damage allowed for any vanilla Mace attack.
# 1 damage = 0.5 heart. Default 14 = 7 hearts.
damage-cap: 14.0
# Minimum allowed cap. Commands that would set a value below this are rejected.
min-cap: 0.0
# Maximum allowed cap. Commands that would set a value above this are rejected.
max-cap: 1000.0
# The chat prefix used by all plugin messages. Supports &-color codes.
messages-prefix: "&6&lMaceDamageCap &8&l\u00BB &r"
# Whether to log cap changes to the server console.
log-changes: true
All settings persist across restarts. Changes made via /mdc set are saved automatically.
Bypass data is stored separately in plugins/MaceDamageCap/bypass.yml as a list of player UUIDs.
Commands
| Command |
Description |
Permission |
/macedamagecap |
Show plugin info, current cap, and help. |
macedamagecap.admin |
/macedamagecap help |
Show the help menu. |
macedamagecap.admin |
/macedamagecap get |
Display the current damage cap. |
macedamagecap.admin |
/macedamagecap set <damage> |
Change the maximum Mace damage cap. |
macedamagecap.admin |
/macedamagecap reload |
Reload config.yml and bypass.yml. |
macedamagecap.admin |
/macedamagecap bypass add <player> |
Grant bypass to a player (UUID-based). |
macedamagecap.admin |
/macedamagecap bypass remove <player> |
Revoke bypass from a player. |
macedamagecap.admin |
/macedamagecap bypass list |
List every player with bypass enabled. |
macedamagecap.admin |
/macedamagecap bypass check <player> |
Check whether a player has bypass enabled. |
macedamagecap.admin |
Aliases: /mdc, /macecap
Player arguments accept either a player name (online or previously joined) or a raw UUID.
Permissions
| Permission |
Description |
Default |
macedamagecap.admin |
Grants access to all /macedamagecap subcommands. |
op |
macedamagecap.bypass |
Bypasses the Mace damage cap. Auto-attached via commands. |
false |
You may also grant macedamagecap.bypass to a player manually through your permissions plugin (LuckPerms, etc.) and they will bypass the cap — no /mdc command required.
How it works
- The plugin listens to
EntityDamageByEntityEvent at HIGH priority.
- If the damager is a player holding a
Material.MACE in their main hand, the final computed damage (which already includes fall distance, enchantments, crits, and all other vanilla modifiers) is compared against damage-cap.
- If the value is higher,
event.setDamage(cap) is called — the hit keeps all of its knockback, sound, and particle effects, but deals exactly the capped damage.
- Players whose UUID appears in
bypass.yml, or who have the macedamagecap.bypass permission, are skipped entirely.
Example
damage-cap: 14.0
- Normal Mace hit:
8.0 damage → remains 8.0
- Mace smash (35 damage):
35.0 damage → becomes 14.0
- Mace smash by bypass player:
35.0 damage → remains 35.0
- Mace smash by bypass player with Density V: remains uncapped
Building from source
git clone https://github.com/peroxide-dev/macedamagecap
cd MaceDamageCap
mvn clean package
The compiled jar will be in target/MaceDamageCap-<version>.jar.
Credits
Made with love by salatube <3
评论 0
登录后参与评分
还没有评论,来抢沙发吧