BungeeMessages
将你的 BungeeCord 代理发送的所有消息替换为你自定义的文本。
作者:LucasTHCR -
功能介绍
BungeeCord 使用一套固定的英文字符串与玩家通信:“服务器已满!”、“你已连接到此服务器!”、后端宕机时的踢出原因等。本插件将所有 50 条消息集中到一个 config.yml 配置文件中,支持颜色代码和十六进制颜色,且无需重启代理即可更改它们。
工作原理
代理消息分为两类,需要不同的处理方式。
翻译消息 是根据键值在 BungeeCord 自身的语言文件中进行查找的。插件会用基于你配置文件构建的新表替换该查找表,从而在源头替换 44 个键值。所有经过代理翻译路径的消息都会以你的措辞显示。
硬编码消息 是直接写在 BungeeCord 源代码中的字面量,没有可供替换的键值。共有 6 条,主要涉及连接失败的情况。插件会监控踢出和登录事件,并在这些原因发送给玩家之前重写它们。
任何未在配置中指定的内容都会保留 BungeeCord 的默认设置,因此你可以只修改一条消息而忽略其余 49 条。
Velocity
同一个 JAR 包也可用于 Velocity。它会读取 velocity-config.yml,其中列出了 Velocity 自身的消息及其对应的 Velocity 键值。文本格式为 MiniMessage,同时会将 & 代码、&#RRGGBB 以及 BungeeCord 的 {0}/{1} 占位符进行转换,以便迁移 BungeeCord 的配置。如果你未更改某个键值,它将保留 Velocity 针对每种客户端语言的翻译;若已更改,则向所有玩家显示你的自定义文本。
命令
/bmsgs,也支持 /bmessages 和 /bm。
| 命令 |
功能 |
/bmsgs reload |
重新读取配置并推送到代理 |
/bmsgs info |
显示版本、已加载的消息数、注入的键值数 |
/bmsgs list [page] |
分页浏览所有已配置的消息 |
/bmsgs get <key> |
根据键值显示单条消息 |
/bmsgs help |
查看用法帮助 |
Tab 补全支持子命令,对于 get 命令则支持消息键值的补全。
权限
| 节点 |
授予 |
bungeemessages.admin |
以下所有权限 |
bungeemessages.use |
运行 /bmsgs 的所有功能 |
bungeemessages.reload |
执行 /bmsgs reload |
bungeemessages.info |
执行 /bmsgs info |
bungeemessages.list |
执行 /bmsgs list 和 /bmsgs get |
BungeeCord 从它自己的 config.yml 中读取权限,而不是从插件中读取。
配置
plugins/BungeeMessages/config.yml 包含三个部分。
settings - 插件允许执行的操作
messages - 50 条文本,包括 44 条翻译消息和 6 条硬编码消息
plugin - /bmsgs 命令本身的输出文本
| 设置项 |
默认值 |
含义 |
inject-translations |
true |
替换代理的翻译表 |
intercept-hardcoded |
true |
重写那 6 条字面量消息 |
restore-on-disable |
true |
卸载时将原始设置交还回去 |
metrics |
true |
匿名 bStats 统计信息 |
debug |
false |
记录每次匹配和替换过程 |
list-page-size |
10 |
/bmsgs list 每页显示的条目数 |
颜色使用 &a 代码和 &#FF5500 表示十六进制颜色。{0} 和 {1} 是 BungeeCord 自带的占位符,仅在使用了它们的原始消息中有效。
升级时绝不会覆盖你的文件:新版本中添加的选项会被合并进来,而你已修改的内容将保持原样。
要求
Java 11 或更高版本的 BungeeCord 或其分支,或者 Java 17 上运行的 Velocity 3.3 或更高版本。
翻译替换功能会深入代理的私有字段。如果某个分支重命名了该字段,插件会在控制台中提示,并且硬编码拦截功能仍可独立正常工作。
构建
mvn clean package
JAR 文件将生成在 target/ 目录中。
许可证
GPL-3.0。详见 LICENSE。
BungeeMessages
Replace every message your BungeeCord proxy sends with your own text.
Author: LucasTHCR -
What it does
BungeeCord speaks to players in a fixed set of English strings: "Server is full!",
"You are already connected to this server!", the kick reason when a backend goes
down. This plugin puts all 50 of them in one config.yml, with colour codes and
hex colours, and no proxy restart needed to change them.
How it works
Proxy messages come in two kinds, and they need different handling.
Translated messages are looked up by key in BungeeCord's own language file.
The plugin swaps that lookup table for one built from your config, so 44 keys are
replaced at the source. Every message that goes through the proxy's translation
path comes out in your wording.
Hardcoded messages are written out literally in BungeeCord's sources and have
no key to replace. There are six of them, mostly around connection failures. The
plugin watches the kick and login events and rewrites those reasons on their way
to the player.
Anything you leave out of the config keeps BungeeCord's own default, so you can
change one message and ignore the other 49.
Velocity
The same jar runs on Velocity. There it reads velocity-config.yml, which lists Velocity's own
messages under their Velocity keys. Texts are MiniMessage, and & codes, &#RRGGBB and
BungeeCord's {0}/{1} are converted, so a BungeeCord config can be carried over. A key you do
not change keeps Velocity's translations for every client language; a changed key shows your
text to everyone.
Commands
/bmsgs, also /bmessages and /bm.
| Command |
What it does |
/bmsgs reload |
Re-read the config and push it into the proxy |
/bmsgs info |
Version, messages loaded, keys injected |
/bmsgs list [page] |
Page through every configured message |
/bmsgs get <key> |
Show one message by key |
/bmsgs help |
Usage |
Tab completion covers the subcommands and, for get, the message keys.
Permissions
| Node |
Grants |
bungeemessages.admin |
Everything below |
bungeemessages.use |
Running /bmsgs at all |
bungeemessages.reload |
/bmsgs reload |
bungeemessages.info |
/bmsgs info |
bungeemessages.list |
/bmsgs list and /bmsgs get |
BungeeCord reads permissions from its own config.yml, not from the plugin.
Configuration
plugins/BungeeMessages/config.yml holds three sections.
settings - what the plugin is allowed to do
messages - the 50 texts, 44 translated plus 6 hardcoded
plugin - what /bmsgs itself says
| Setting |
Default |
Meaning |
inject-translations |
true |
Replace the proxy's translation table |
intercept-hardcoded |
true |
Rewrite the six literal messages |
restore-on-disable |
true |
Hand the originals back when unloading |
metrics |
true |
Anonymous bStats statistics |
debug |
false |
Log every match and replacement |
list-page-size |
10 |
Entries per page of /bmsgs list |
Colours use &a codes and &#FF5500 for hex. {0} and {1} are BungeeCord's
own placeholders and only work where the original message had them.
Upgrading never overwrites your file: options added in a new version are merged
in, and anything you changed stays as you wrote it.
Requirements
BungeeCord or a fork of it on Java 11 or newer, or Velocity 3.3 or newer on Java 17.
The translation swap reaches into a private field of the proxy. If a fork renames
it, the plugin says so in the console and the hardcoded interception keeps working
on its own.
Building
mvn clean package
The JAR lands in target/.
License
GPL-3.0. See LICENSE.
评论 0
登录后参与评分
还没有评论,来抢沙发吧