关于 HardcoreDeathBan
一个轻量级的 Paper 插件,用于在玩家死亡时将其封禁,支持自定义生命次数、消息以及 PlaceholderAPI (PAPI) 支持。专为极限生存(Hardcore)服务器设计。HardcoreDeathBan 最初是为我朋友的社区极限生存服务器创建的,当时我找不到一款支持 26.1.x 版本且允许自定义封禁信息的硬核封禁插件。该插件从服务器运营的第一天起就一直在使用,以实现其独特的“3条命=封禁”机制。我立刻意识到我想将这个插件公开,以帮助其他需要具有自定义封禁信息的极限生存生命系统的用户。
生命系统
该插件可选地支持多生命模式。在 config.yml 中设置 lives.enabled: true,每个玩家初始拥有 lives.default 条生命(默认为 3)。每次死亡会减少 1 条生命。只有当生命值归零时,他们才会被永久封禁。
生命数据存储在 plugins/HardcoreDeathBan/lives.yml 中,以 UUID 为键。它们在服务器重启后依然存在。生命只能通过手动方式恢复:管理员通过 /hcdb lives 命令授予它们。
当玩家死亡但仍有剩余生命时,插件会发送可配置的通知(个人消息、标题/副标题、全服广播)。每一项都可以独立开关并在 lives.notifications 配置部分进行配置,支持 MiniMessage 格式以显示颜色和样式。
安装
- 将 jar 文件放入服务器的
plugins/ 目录。
- 启动服务器一次以生成
plugins/HardcoreDeathBan/config.yml。
- 根据你的喜好编辑
ban-message。
- 在游戏中或从控制台运行
/hcdb reload。
命令
/hcdb reload: 重新加载 config.yml 而无需重启服务器。需要 hardcoredeathban.reload 权限(默认为 OP)。别名:/hardcoredeathban reload。
/hcdb lives <player>: 显示玩家剩余的生命次数。
/hcdb lives <player> set <amount>: 设置确切的生命次数。
/hcdb lives <player> add <amount>: 增加额外的生命次数。
/hcdb lives <player> remove <amount>: 扣除生命次数。
/hcdb lives <player> reset: 重置为配置的默认值。
/hcdb lives reset-all: 清除所有玩家的生命数据(例如用于新赛季)。
lives 子命令需要 hardcoredeathban.lives.manage 权限(默认为 OP),并且生命系统必须已启用(lives.enabled: true 在配置文件中)。
配置
编辑 plugins/HardcoreDeathBan/config.yml。它带有大量注释,因此每个选项都应该直观易懂:
ban-message: "{death-message} on {date} at {time} after %statistic_time_played% of survival. RIP, {player}."
ban-message: 封禁屏幕上显示的文字。支持占位符(见下文)。
timezone, timestamp-format, date-format, time-format: 控制 {timestamp}、{date} 和 {time} 的渲染方式。
lives.*: 参见上面的“生命系统”部分。
更多详细信息请参阅 config.yml
内置占位符
这些占位符可在 ban-message 以及任何生命通知(lives.notifications.message.text、title、subtitle、broadcast.text)中使用:
| 占位符 |
描述 |
{player} |
玩家的用户名。 |
{world} |
玩家死亡的维度(例如 world、world_nether)。 |
{cause} |
简短的伤害类型(例如 fall、lava、mob_attack)。 |
{death-message} |
完整的原版死亡信息(例如 "Notch was blown up by Creeper")。 |
{timestamp} |
通过 timestamp-format 格式化的完整时间戳。 |
{date} |
通过 date-format 格式化的日期。 |
{time} |
通过 time-format 格式化的时间。 |
{lives_remaining} |
玩家剩余的生命次数(仅限生命系统)。 |
{lives_max} |
配置的起始生命次数(仅限生命系统)。 |
{lives_lost} |
lives_max - lives_remaining(仅限生命系统)。 |
PlaceholderAPI 支持
如果安装了 PlaceholderAPI,则 ban-message 和生命通知中的所有 %papi_placeholders% 都会被解析。有用的扩展包括 Statistic(用于 %statistic_time_played%)和 Player:使用 /papi ecloud download <Name> 安装。
此插件还注册了自己的 PAPI 扩展,暴露生命计数以供记分板、标签列表和其他消耗 PAPI 占位符的插件使用:
| 占位符 |
描述 |
%hcdb_lives_remaining% |
玩家当前的生命次数。如果玩家尚未被追踪,则返回配置的默认值。 |
%hcdb_lives_max% |
配置的起始生命次数(lives.default)。 |
%hcdb_lives_lost% |
max - remaining。 |
当 lives.enabled: false 时,这些占位符返回空字符串。仅当加载了 PlaceholderAPI 时才会注册此扩展。
豁免玩家
默认情况下,OP 被豁免(plugin.yml 中的 default: op)。要豁免非 OP 玩家,请使用任何权限插件(如 LuckPerms 等)。例如,使用 LuckPerms:
/lp user <username> permission set hardcoredeathban.exempt true
解封
使用你熟悉的解封命令。
原版的解封命令是:/pardon <username>(从控制台或任何 OP 执行)。
注意事项
- 封禁是由控制台发出的,因此插件本身不需要任何权限设置。
- 监听器以
MONITOR 优先级运行。它不会修改死亡事件,仅在其它所有插件表达完意见后作出反应。如果你有一个取消死亡事件的插件(例如“第二次机会”插件),它将首先运行,玩家实际上不会死亡,因此不会触发封禁。
/ban 是通过调度程序在下一个刻(tick)分发的。这避免了从玩家自身的死亡事件中踢出玩家所带来的细微问题。
支持 Discord
如果你需要关于 HardcoreDeathBan 的任何支持,请加入我的 Software & Support Discord。你可以在 #?get-roles 频道中使用相应的 ❤️ 按钮访问 HardcoreDeathBan 板块。
About HardcoreDeathBan
A tiny Paper plugin that bans players on death, with configurable lives, messages and PAPI support. Built for Hardcore servers. HardcoreDeathBan was originally created for my friend's community Hardcore server when I couldn't find a 26.1.x Hardcore ban plugin with customizable ban messages. This plugin was in use from Day 1 of the server to facilitate it's unique gimmick of 3 lives = ban. I immediately knew I wanted to make this public to help any others who needed hardcore lives with custom ban messages.
Lives system
The plugin optionally supports a multi-life mode. With lives.enabled: true in config.yml, each player starts with lives.default lives (default 3). Each death decrements their count by 1. They're only permanently banned when they hit 0.
Lives are stored in plugins/HardcoreDeathBan/lives.yml, keyed by UUID. They persist across server restarts. Lives only regenerate manually: admins grant them via the /hcdb lives commands.
When a player dies but has lives left, the plugin sends configurable notifications (personal message, title/subtitle, server broadcast). Each is independently toggleable and configurable in the lives.notifications config section, with MiniMessage formatting support for colors and styles.
Install
- Drop the jar into your server's
plugins/ directory.
- Start the server once to generate
plugins/HardcoreDeathBan/config.yml.
- Edit
ban-message to your liking.
- Run
/hcdb reload in-game or from the console.
Commands
/hcdb reload: reloads config.yml without restarting the server. Requires the hardcoredeathban.reload permission (op by default). Alias: /hardcoredeathban reload.
/hcdb lives <player>: show how many lives a player has left.
/hcdb lives <player> set <amount>: set exact lives count.
/hcdb lives <player> add <amount>: grant additional lives.
/hcdb lives <player> remove <amount>: take lives away.
/hcdb lives <player> reset: reset to the configured default.
/hcdb lives reset-all: wipe everyone's lives data (e.g. for a new season).
The lives subcommands require the hardcoredeathban.lives.manage permission (op by default) and the lives system to be enabled (lives.enabled: true in config).
Configuration
Edit plugins/HardcoreDeathBan/config.yml. It's heavily documented, so every option should be intuitive:
ban-message: "{death-message} on {date} at {time} after %statistic_time_played% of survival. RIP, {player}."
ban-message: the text shown on the ban screen. Supports placeholders (see below).
timezone, timestamp-format, date-format, time-format: control how {timestamp}, {date}, and {time} render.
lives.*: see "Lives system" section above.
More info in the config.yml
Built-in placeholders
These work in ban-message and in any lives notification (lives.notifications.message.text, title, subtitle, broadcast.text):
| Placeholder |
Description |
{player} |
The player's username. |
{world} |
World the player died in (e.g. world, world_nether). |
{cause} |
Short damage type (e.g. fall, lava, mob_attack). |
{death-message} |
Full vanilla death message (e.g. "Notch was blown up by Creeper"). |
{timestamp} |
Full timestamp formatted via timestamp-format. |
{date} |
Date formatted via date-format. |
{time} |
Time formatted via time-format. |
{lives_remaining} |
Lives the player has left (lives system only). |
{lives_max} |
Configured starting lives (lives system only). |
{lives_lost} |
lives_max - lives_remaining (lives system only). |
PlaceholderAPI support
If PlaceholderAPI is installed, all %papi_placeholders% are resolved in ban-message and lives notifications. Useful expansions include Statistic (for %statistic_time_played%) and Player: install with /papi ecloud download <Name>.
This plugin also registers its own PAPI expansion exposing the lives count for use in scoreboards, tab lists, and other plugins that consume PAPI placeholders:
| Placeholder |
Description |
%hcdb_lives_remaining% |
The player's current lives. Returns the configured default if the player isn't tracked yet. |
%hcdb_lives_max% |
Configured starting lives (lives.default). |
%hcdb_lives_lost% |
max - remaining. |
These return empty strings when lives.enabled: false. The expansion is only registered if PlaceholderAPI is loaded.
Exempting players
By default, ops are exempt (default: op in plugin.yml). To exempt non-op players, use any permission plugin (LuckPerms, etc.). For example, with LuckPerms:
/lp user <username> permission set hardcoredeathban.exempt true
Unbanning
Use the same unban command you're used to.
The vanilla command for unbanning is: /pardon <username> (from console or any op).
Notes
- The ban is issued from the console, so the plugin doesn't need any permission setup itself.
- The listener runs on
MONITOR priority. It does not modify the death event, only reacts after every other plugin has had its say. If you have a plugin that cancels deaths (e.g. a "second chance" plugin), it will run first and the player won't actually die, so no ban.
- The
/ban is dispatched on the next tick via the scheduler. This avoids subtle issues with kicking a player from inside their own death event.
Support Discord
If you need any support with HardcoreDeathBan, please join my Software & Support Discord. You can access the HardcoreDeathBan section using the corresponding ❤️ button in #?get-roles
评论 0
登录后参与评分
还没有评论,来抢沙发吧