sServerMessages
一款轻量级的 Bukkit/Spigot/Paper/Purpur/Folia 插件,用于控制服务器的广播消息:
加入、退出、踢出、死亡和进度达成。在 config.yml 中为每种消息选择一种模式:
保持原版、隐藏它,或将其替换为你自己的文本。服务器上的所有玩家都会看到
替换后的文本。无依赖项,无 GUI,无针对单个玩家或分组设置。
一个 jar 包涵盖从 1.8.8 到 26.x 的所有服务器版本。
功能
- 每条消息有三种模式:
vanilla(原版)、hide(隐藏)、replace(替换)。空的 message 也会隐藏。
- 针对不同死因(坠落、火焰、生物、玩家等)分别设置死亡文本,并有一个通用回退文本。
- 占位符:
{player} 适用于所有情况,{killer}/{cause} 用于死亡,{reason} 用于踢出,
{advancement} 用于进度达成。
- 支持所有地方的
& 颜色代码,以及在 1.16+ 版本中支持 &#RRGGBB 十六进制颜色。
- 使用
/sservermessages reload 实现热重载。
安装
- 将
sServerMessages-1.0.0.jar 放入服务器的 plugins 文件夹。
- 启动一次服务器以生成
plugins/sServerMessages/config.yml。
- 编辑配置文件并运行
/sservermessages reload。
配置
join:
mode: replace # vanilla | hide | replace
message: "&e{player} &7加入了服务器"
quit:
mode: replace
message: "&e{player} &7离开了服务器"
kick:
mode: replace
message: "&e{player} &7被踢出服务器: &c{reason}"
death:
mode: replace
message: "&c{player} &7死了"
causes:
player: "&c{player} &7被玩家 &c{killer} 击杀"
mob: "&c{player} &7被生物 &c{killer} 击杀"
fall: "&c{player} &7摔死了"
names:
fall: "坠落"
advancement:
mode: replace
message: "&e{player} &7获得了成就 &a{advancement}"
占位符
| 消息类型 |
占位符 |
| join, quit |
{player} |
| kick |
{player}, {reason} |
| death |
{player}, {killer}, {cause} |
| advancement |
{player}, {advancement} |
死亡
死因取自 getLastDamageCause(),该接口在所有支持的版本中都存在。文本选择顺序如下:
- 如果击杀者是玩家,则使用
player;如果是其他实体(例如投射物的射手),则使用 mob。
- 小写的伤害原因名称,如
fall、fire_tick、lava、drowning、void、
explosion、entity_attack。
- 通用的
message。
如果在旧版本中不存在某些死因名称,则永远不会匹配它们。对于某个死因,空字符串会隐藏该死因的消息。{cause} 是 names 中的可读名称,否则回退到美化后的死因名称。当没有击杀者时,{killer} 为空。
踢出
kick 是其他玩家在有人被踢出时看到的消息。被踢玩家在断开连接屏幕上看到的原因不会改变。在大多数版本中,踢出操作后会跟随一个退出事件;插件确保踢出消息优先,因此不会重复播报玩家离开。
进度达成
| 平台 |
替换/隐藏 |
| Paper, Purpur, Folia (1.16+) |
是 |
| Spigot,以及在使用消息 API 之前的 Paper(如 1.12.2) |
否,保留原版消息 |
| 早于 1.12 的服务器 |
无此事件 |
这是通过实际测试验证的,而非凭记忆。Spigot API(26.1.2 及 1.12 时代)拥有
PlayerAdvancementDoneEvent,仅包含 getAdvancement(),无法更改或取消公告。
Paper 添加了 message(Component)(已在 1.16.5、26.1.2 和 Folia 26.1.2 上确认;在 Paper 1.12.2 上缺失)。
插件通过反射调用 Paper 方法,并从带颜色的旧式文本构建 Adventure 组件,因此它仍可与 spigot-api 1.8.8 编译。在不具备该方法的核心上,插件会在启动时记录一条警告,并保留原版消息。插件故意不切换 announceAdvancements 游戏规则,因为插件不应更改服务器状态。
{advancement} 是 API 暴露的进度标题(在 26.x 中),否则是一个美化的键名,例如
"Mine stone"(开采石头)。配方类进度永远不会被公告,因此被忽略。
命令
| 命令 |
描述 |
/sservermessages reload |
重新加载 config.yml。别名:/ssm。 |
权限:sservermessages.reload(默认:op)。插件使用普通的 Bukkit 权限,因此 LuckPerms 和其他权限插件无需任何集成即可配合使用。控制台始终可以执行重载。
如果 config.yml 损坏,之前的设置将继续生效,错误信息将打印到控制台。
兼容性
Spigot, Paper, Purpur 和 Folia (folia-supported: true)。插件不使用调度器,且设置字段为 volatile,因此在 Folia 的区域线程上读取这些字段是安全的。
构建
./gradlew build
需要 JDK 21 进行构建,因为 JDK 25 已不再支持 targeting Java 8。verifyModernApi 任务还会针对 paper-api 26.3 重新编译源代码,并且需要安装 JDK 25 作为其工具链;它作为 check 的一部分运行。bStats 已被着色并重定位至 com.scypter.sservermessages.libs.bstats。
许可证
请参阅 LICENSE。
sServerMessages
A lightweight Bukkit/Spigot/Paper/Purpur/Folia plugin that controls the server's broadcast messages:
join, quit, kick, death and advancement. For each one you pick a mode in config.yml:
leave it vanilla, hide it, or replace it with your own text. Everyone on the server sees the
replaced text. No dependencies, no GUI, no per-player or per-group settings.
One jar covers every server version from 1.8.8 to 26.x.
Features
- Three modes per message:
vanilla, hide, replace. An empty message also hides.
- Separate death texts per cause (fall, fire, mob, player...), with a general fallback.
- Placeholders:
{player} everywhere, {killer}/{cause} for deaths, {reason} for kicks,
{advancement} for advancements.
& color codes everywhere, plus &#RRGGBB hex colors on 1.16+.
- Hot reload with
/sservermessages reload.
Installation
- Drop
sServerMessages-1.0.0.jar into the server's plugins folder.
- Start the server once to generate
plugins/sServerMessages/config.yml.
- Edit the config and run
/sservermessages reload.
Configuration
join:
mode: replace # vanilla | hide | replace
message: "&e{player} &7зашёл на сервер"
quit:
mode: replace
message: "&e{player} &7вышел с сервера"
kick:
mode: replace
message: "&e{player} &7был кикнут с сервера: &c{reason}"
death:
mode: replace
message: "&c{player} &7погиб"
causes:
player: "&c{player} &7был убит игроком &c{killer}"
mob: "&c{player} &7был убит существом &c{killer}"
fall: "&c{player} &7разбился"
names:
fall: "падение"
advancement:
mode: replace
message: "&e{player} &7получил достижение &a{advancement}"
Placeholders
| Message |
Placeholders |
| join, quit |
{player} |
| kick |
{player}, {reason} |
| death |
{player}, {killer}, {cause} |
| advancement |
{player}, {advancement} |
Deaths
The cause is taken from getLastDamageCause(), which exists on every supported version. The text is chosen in
this order:
player if the killer is a player, or mob if it is any other entity (the shooter, for projectiles).
- The damage cause name in lowercase, such as
fall, fire_tick, lava, drowning, void,
explosion, entity_attack.
- The general
message.
Cause names that do not exist on an older version are simply never matched. An empty string for a cause hides
the message for that cause. {cause} is the readable name from names, falling back to the prettified cause
name. {killer} is empty when there is no killer.
Kicks
kick is the message other players see when someone is kicked. The reason shown to the kicked player
on their disconnect screen is not changed. A kick is followed by a quit event on most versions; the plugin
makes the kick message win, so the player is not announced twice.
Advancements
| Platform |
Replace / hide |
| Paper, Purpur, Folia (1.16+) |
Yes |
| Spigot, and Paper before the message API (such as 1.12.2) |
No, the vanilla message stays |
| Servers older than 1.12 |
No such event |
This was checked with a spike rather than from memory. The Spigot API (26.1.2 and 1.12 era) has
PlayerAdvancementDoneEvent with only getAdvancement(), with no way to change or cancel the announcement.
Paper adds message(Component) (confirmed on 1.16.5, 26.1.2 and Folia 26.1.2; absent on Paper 1.12.2).
The plugin reaches the Paper method by reflection and builds the Adventure component from the
legacy-colored text, so it still compiles against spigot-api 1.8.8. On a core without the method the plugin
logs one warning on startup and leaves the vanilla message alone. It deliberately does not toggle the
announceAdvancements gamerule, because the plugin must not change server state.
{advancement} is the advancement title where the API exposes it (26.x), otherwise a prettified key such as
"Mine stone". Recipe advancements are never announced and are ignored.
Commands
| Command |
Description |
/sservermessages reload |
Reloads config.yml. Alias: /ssm. |
Permission: sservermessages.reload (default: op). The plugin uses a plain Bukkit permission, so LuckPerms and
other permission plugins work with it without any integration. The console can always reload.
If config.yml is broken, the previous settings stay active and the error is printed to the console.
Compatibility
Spigot, Paper, Purpur and Folia (folia-supported: true). The plugin uses no scheduler, and the settings
fields are volatile, so event handlers on Folia's region threads read them safely.
Building
./gradlew build
Requires JDK 21 to build, since JDK 25 can no longer target Java 8. The verifyModernApi task additionally
recompiles the sources against paper-api 26.3 and needs a JDK 25 installed for its toolchain; it runs as part
of check. bStats is shaded and relocated to com.scypter.sservermessages.libs.bstats.
License
See LICENSE.
评论 0
登录后参与评分
还没有评论,来抢沙发吧