StaffChat
专为服务器管理团队的私密聊天频道。 一个命令、一个权限节点、零干扰。开启管理员模式,让接下来的对话脱离公共聊天——或者在不离开全局频道的情况下,通过 @hello 快速发送单条消息。该模组的设计确保秘密对话绝不会泄露到镜像公共聊天的 Discord 桥接模组中。
StaffChat 1.0.0 — 适用于 Minecraft 1.21.1 / Fabric。仅服务端。除 Fabric API 外无硬性依赖。LuckPerms 为可选。放入 mods/ 目录,给予自己 OP 权限即可使用。
功能介绍
有三种方式向管理员频道发送消息,均受单一权限 staffchat.true 控制:
/staffchat 单独使用可切换“管理员聊天模式”——此后你输入的所有普通聊天行都将仅发送给管理员,直到你再次关闭该模式。标题提示脉冲 + 持续显示在动作栏的 ● Staff Chat Mode 会提醒你处于隐身模式,防止你意外泄露给全局频道。
/staffchat <message>(或 /sc <message>)发送一次性消息,且不改变你的切换状态。适合游戏中快速回复。
- 正常聊天中的
@<message> 快捷前缀——输入 @need help at spawn,该消息将仅路由至管理员频道。如果 @ 与你的提及语法冲突,可在配置文件中修改前缀字符。
未处于切换模式的管理员仍会接收所有管理员消息。切换功能纯粹是为了发送便利——它并不限制接收。
提及提醒
在任何管理员消息中,输入 @<playername> 即可提及该管理员成员:
- 其动作栏闪烁显示
★ Mentioned by <you>
- 播放可配置的提示音(默认:经验球拾取音效)
- 忽略自提、离线玩家或非管理员名称
音效 ID、音量、音高以及动作栏模板均可在配置文件中调整。
专为隐私设计
这是一个管理员频道——泄露会非常尴尬。模组架构设计如下:
- 管理员消息绝不会进入全局聊天管道。 我们在
ServerMessageEvents.ALLOW_CHAT_MESSAGE(返回 false)阶段进行抑制,发生在任何聊天广播之前。没有 /say 垃圾信息的回退机制,也没有暴露给自己私聊的情况。
- 其他 Discord 聊天桥接模组不会捕获管理员消息。 Styled Chat、ServerSideUtils、simple-discord-bridge 等桥接模组挂钩的是聊天广播管道。由于我们在 ALLOW 阶段进行抑制,并将消息作为系统消息(而非聊天消息)重新投递,这些桥接模组永远不会观察到管理员消息。你的秘密对话保持秘密。
- 唯一预期的 Discord 镜像是内置 Webhook。 默认关闭。当你确实希望将管理员消息镜像到特定 Discord 频道时,设置
discord.enabled = true 并提供 Webhook URL —— 此时由你决定哪个频道可以看到内容。
- Webhook 发布时使用
allowed_mentions.parse = [],因此管理员输入 @everyone 时不会真正 ping 通整个 Discord 服务器。
内置 Discord Webhook(可选启用)
可选。默认关闭。设置:
discord {
enabled = true
webhook-url = "https://discord.com/api/webhooks/.../..."
username-format = "{sender}"
avatar-url-format = "https://mc-heads.net/avatar/{uuid}"
retries = 1
}
通过 Java 21 的 HttpClient 在专用的单线程池中进行异步 POST 请求——绝不会阻塞服务器主线程(tick)。失败时最多重试 retries 次;配置错误的 Webhook(4xx)将自动静默 5 分钟,以防止过期的令牌向控制台发送垃圾信息。
LuckPerms 元数据前缀(软依赖)
如果存在 LuckPerms,管理员聊天中发送者的名称前会自动添加其 LuckPerms 元数据中的 [Prefix]。如果没有 LuckPerms,则回退到基于配置的映射表,以 staffchat.rank.<id> 权限为键:
prefixes {
owner = "&c[Owner] "
admin = "&4[Admin] "
mod = "&9[Mod] "
}
玩家的前缀是其拥有的第一个按声明顺序匹配的 staffchat.rank.<id>。最终回退:空白。
防御性设计
采用与我们其他服务器模组相同的偏执安全模式:
- 每次发送消息时重新检查权限 —— 如果在两条消息之间某管理员被降级,他将从接收者列表中无声移除,且不会泄露任何错误信息。
- 输入清理器 会剥离控制字符和原始的分节符(section-sign),防止任何人注入格式错误的 Minecraft 文本格式;消息长度限制为
chat.max-length(默认 256);拒绝“仅有格式化、无内容”的有效载荷。
- 速率限制 —— 滑动 30 秒窗口,默认每个窗口 10 条消息,可配置。发送者会收到一条“请慢一点”的回复,消息在服务端丢弃,审计日志记录该限速事件。
staffchat.bypass.rate-limit 使用显式权限解析 —— 除非 LuckPerms 特别授予,否则 OP 不会自动绕过此限制。
- 审计日志 —— 每条管理员发送记录都会追加到
logs/staffchat-audit.log,包含 8 位 base36 事务 ID、时间戳、发送者 UUID + 名称、已清理的内容、接收者数量以及结果(DELIVERED / RATE_LIMITED / SANITIZED / DROPPED)。原子追加操作,便于事件审查。
权限
| 节点 |
默认值 |
用途 |
staffchat.true |
OP 4 回退 |
在管理员频道中发送和接收消息 |
staffchat.bypass.rate-limit |
false(仅显式) |
忽略速率限制 |
staffchat.admin.reload |
OP 3 |
/staffchat reload |
staffchat.admin.list |
OP 3 |
/staffchat list |
staffchat.rank.<id> |
— |
当不存在 LuckPerms 时的回退前缀层级 |
在没有权限插件的情况下:/op <name> 即可满足要求 —— OP 4 满足 staffchat.true 的回退条件。
使用 LuckPerms 时:执行 lp group default permission set staffchat.true false,然后按等级分别授予权限。
命令
/staffchat 切换员工聊天模式 (staffchat.true)
/staffchat <message> 一次性发送(不改变切换状态) (staffchat.true)
/staffchat reload 从磁盘重新加载配置文件 (staffchat.admin.reload)
/staffchat list 列出当前在线的员工 (staffchat.admin.list)
/sc /staffchat toggle 的别名
/sc <message> /staffchat <message> 的别名
配置
config/staffchat/config.conf 是 HOCON 格式。值得注意的配置项:
staffchat {
chat {
format = "&8[&cSTAFF&8] &f{prefix}&7{sender}&8: &f{message}"
quick-prefix = "@" # 设为 "" 以禁用
max-length = 256
toggle-indicator = "&c● Staff Chat Mode"
toggle-on-title = "&c&lStaff Chat ON"
toggle-off-title = "&7&lStaff Chat OFF"
}
mentions {
enabled = true
sound-id = "minecraft:entity.experience_orb.pickup"
sound-volume = 0.7
sound-pitch = 1.2
actionbar-text = "&e★ Mentioned by {sender}"
}
discord {
enabled = false
webhook-url = ""
username-format = "{sender}"
avatar-url-format = "https://mc-heads.net/avatar/{uuid}"
retries = 1
}
prefixes { ... }
security {
rate-limit-per-30s = 10
log-to-file = true
log-file = "logs/staffchat-audit.log"
log-to-console = false
}
persist-toggled-state = true
message-locale = "auto"
messages {}
}
手动编辑后执行 /staffchat reload,或启用热重载以在不重启服务器的情况下实时生效。
i18n
内置英文。放入 config/staffchat/lang/<locale>.json 即可添加其他语言,无需重新编译 jar 包。加载器优先使用配置目录中的覆盖文件,若未找到则回退到内置资源中的 en_us。
依赖要求
硬性依赖:
- Minecraft 1.21.1
- Fabric Loader ≥ 0.16.0
- Fabric API
- Java 21
打包在 jar 内——无需额外安装:
- Fabric Permissions API
- SpongePowered Configurate HOCON
- Typesafe Config
可选软依赖:
- LuckPerms —— 用于在员工消息中显示
[Prefix] 元数据。
明确不包含的功能
- 不是聊天桥接模组 —— 可选的 Discord Webhook 仅镜像员工频道。它不会将全局聊天桥接到 Discord。如需此功能,请使用专门的聊天桥接模组。
- 不是管理工具 —— 没有 /mute、/kick、/ban 命令。请使用原版命令或专门的管理模组。
- 不支持多频道 —— 只有一个员工频道。如果你需要管理员 / 版主 / 建造者等分开的频道,这计划在 v1.1 版本中实现。
- 不是客户端模组 —— 仅在服务器端运行,玩家无需安装任何内容。
目标用户
希望为团队成员提供一种快速、可靠且与 Discord 隔离的游戏内沟通方式的服务器管理员,而无需启动 Slack、侧边语音频道或不必要的管理套件。将 jar 包放入 mods/ 目录,将自己设为 op,输入 /staffchat —— 完成。
许可证: MIT
作者: souljagger
StaffChat
A private chat channel for your server's staff team. One command, one permission node, zero noise. Toggle into staff mode to keep the next conversation off public chat — or quick-fire a single line with @hello without ever leaving the global channel. Built so secret conversations never leak through Discord-bridge mods that mirror public chat.
StaffChat 1.0.0 — for Minecraft 1.21.1 / Fabric. Server-side only. No hard dependencies beyond Fabric API. LuckPerms optional. Drop it in mods/, op yourself, and it works.
What it does
Three ways to send to the staff channel, all gated by a single permission staffchat.true:
/staffchat alone toggles "staff chat mode" — every regular chat line you type now goes to staff only until you toggle off. A title pulse + a persistent ● Staff Chat Mode actionbar reminds you you're in stealth mode so you never accidentally leak to global.
/staffchat <message> (or /sc <message>) sends a one-off without changing your toggle state. Good for a quick reply mid-game.
@<message> quick prefix in normal chat — type @need help at spawn and the message routes to staff only. The prefix character is configurable in case @ clashes with your mention syntax.
Staff who aren't in toggle mode still receive every staff message. Toggle is purely a sending convenience — it doesn't gate reception.
Mention pings
Inside any staff message, drop @<playername> to ping that staff member:
- Their actionbar flashes
★ Mentioned by <you>
- A configurable chime plays (default: experience-orb pickup)
- Self-mentions skipped, offline / non-staff names skipped
Sound id, volume, pitch, and actionbar template are all in the config.
Built for privacy
This is a staff channel — leaks would be embarrassing. The mod is architected so:
- Staff messages NEVER reach the global chat pipeline. We suppress at
ServerMessageEvents.ALLOW_CHAT_MESSAGE (return false) before any chat broadcast happens. No /say-spam fallback, no whispered-to-self exposure.
- Other Discord chat-bridge mods do NOT pick up staff messages. Bridges like Styled Chat, ServerSideUtils, simple-discord-bridge etc. hook the chat-broadcast pipeline. Because we suppress at the ALLOW phase and re-deliver as system messages (not chat messages), those bridges never observe a staff line. Your secret conversations stay secret.
- The only intended Discord mirror is the built-in webhook. Off by default. Set
discord.enabled = true and a webhook URL when you actually want staff mirrored to a specific Discord channel — at which point YOU control which channel sees it.
- The webhook posts with
allowed_mentions.parse = [] so a staff member typing @everyone doesn't actually ping the Discord server.
Built-in Discord webhook (opt-in)
Optional. Off by default. Set:
discord {
enabled = true
webhook-url = "https://discord.com/api/webhooks/.../..."
username-format = "{sender}"
avatar-url-format = "https://mc-heads.net/avatar/{uuid}"
retries = 1
}
Async POST via Java 21's HttpClient on a dedicated single-thread pool — never blocks the server tick. Failures retried up to retries times; misconfigured webhooks (4xx) auto-suppress for 5 minutes so a stale token doesn't spam your console.
LuckPerms metadata prefixes (soft-dep)
If LuckPerms is present, each sender's [Prefix] from LuckPerms metadata is automatically prepended to their name in staff chat. Without LuckPerms, fall back to a config-based map keyed by staffchat.rank.<id> permission:
prefixes {
owner = "&c[Owner] "
admin = "&4[Admin] "
mod = "&9[Mod] "
}
A player's prefix is the first matching staffchat.rank.<id> they hold, in declaration order. Final fallback: blank.
Defensive design
Same paranoid security patterns as our other server mods:
- Permission re-checked on every message send — a staff member demoted between two messages silently drops off the recipient list with no leaking error.
- Input sanitizer strips control chars and the raw section-sign so nobody injects malformed Minecraft formatting; caps message length at
chat.max-length (default 256); rejects "all formatting, no content" payloads.
- Rate limit — sliding 30-second window, default 10 messages per window, configurable. Sender gets a "slow down" reply, message dropped server-side, audit log records the rate-limit event.
staffchat.bypass.rate-limit uses explicit-only permission resolution — OPs don't auto-bypass unless LuckPerms specifically grants it.
- Audit log — every staff send appends to
logs/staffchat-audit.log with an 8-char base36 transaction id, timestamp, sender UUID + name, sanitized content, recipient count, and outcome (DELIVERED / RATE_LIMITED / SANITIZED / DROPPED). Atomic appends, useful for incident review.
Permissions
| Node |
Default |
Purpose |
staffchat.true |
OP 4 fallback |
Send + receive in the staff channel |
staffchat.bypass.rate-limit |
false (explicit only) |
Ignore the rate limit |
staffchat.admin.reload |
OP 3 |
/staffchat reload |
staffchat.admin.list |
OP 3 |
/staffchat list |
staffchat.rank.<id> |
— |
Fallback prefix tier when LuckPerms is absent |
Without a permissions plugin: /op <name> is enough — OP 4 satisfies the staffchat.true fallback.
With LuckPerms: lp group default permission set staffchat.true false then grant per-rank.
Commands
/staffchat Toggle staff chat mode (staffchat.true)
/staffchat <message> One-off send (no toggle change) (staffchat.true)
/staffchat reload Reload config from disk (staffchat.admin.reload)
/staffchat list List currently-online staff (staffchat.admin.list)
/sc Alias for /staffchat toggle
/sc <message> Alias for /staffchat <message>
Configuration
config/staffchat/config.conf is HOCON. Notable knobs:
staffchat {
chat {
format = "&8[&cSTAFF&8] &f{prefix}&7{sender}&8: &f{message}"
quick-prefix = "@" # set to "" to disable
max-length = 256
toggle-indicator = "&c● Staff Chat Mode"
toggle-on-title = "&c&lStaff Chat ON"
toggle-off-title = "&7&lStaff Chat OFF"
}
mentions {
enabled = true
sound-id = "minecraft:entity.experience_orb.pickup"
sound-volume = 0.7
sound-pitch = 1.2
actionbar-text = "&e★ Mentioned by {sender}"
}
discord {
enabled = false
webhook-url = ""
username-format = "{sender}"
avatar-url-format = "https://mc-heads.net/avatar/{uuid}"
retries = 1
}
prefixes { ... }
security {
rate-limit-per-30s = 10
log-to-file = true
log-file = "logs/staffchat-audit.log"
log-to-console = false
}
persist-toggled-state = true
message-locale = "auto"
messages {}
}
Edit by hand and /staffchat reload, or hot-reload to pick up edits live without bouncing the server.
i18n
English bundled. Drop config/staffchat/lang/<locale>.json to add any other language without rebuilding the jar. Loader prefers config-dir overrides over bundled resources, with en_us as the canonical fallback.
Requirements
Hard dependencies:
- Minecraft 1.21.1
- Fabric Loader ≥ 0.16.0
- Fabric API
- Java 21
Bundled inside the jar — no extra installs:
- Fabric Permissions API
- SpongePowered Configurate HOCON
- Typesafe Config
Optional soft dependency:
- LuckPerms — for
[Prefix] metadata in staff messages.
What it intentionally is not
- Not a chat-bridge mod — the optional Discord webhook only mirrors the staff channel. It does not bridge global chat to Discord. Use a real chat-bridge mod for that.
- Not a moderation tool — no /mute, /kick, /ban. Use vanilla or a moderation mod.
- Not multi-channel — one staff channel. If you want admin / mod / builder split channels, that's planned for v1.1.
- Not client-side — runs server-side only, players need nothing installed.
Target audience
Server operators who want a quick, reliable, Discord-isolated way for their staff to talk in-game without spinning up Slack, a side voice channel, or a moderation suite they don't need. Drop the jar in mods/, op yourself, type /staffchat — done.
License: MIT
Author: souljagger
评论 0
登录后参与评分
还没有评论,来抢沙发吧