模组列表
一个 Fabric 服务端模组,用于强制执行严格的整合包白名单或黑名单——运行未授权模组的玩家将被自动踢出。
功能说明
Minecraft 原生并未向服务器暴露客户端已安装的模组列表。Mod Whitelist 填补了这一空白:每当有玩家加入时,其客户端(也必须安装此模组)会向服务器发送其所加载的所有模组列表。服务器会将该列表与管理员定义的白名单进行比对,若有任何不匹配之处,便会断开该玩家的连接。
这对于希望确保所有连接玩家均运行完全一致的经批准整合包的服务端所有者非常有用——防止出现破坏平衡的额外性能优化模组或客户端漏洞利用。
安装方法
服务端
- 将
mod-whitelist-1.0.0.jar 放入服务端的 mods/ 文件夹中。
- 启动服务器一次。这将自动生成配置文件
config/mod-whitelist.json。
- 编辑该文件以列出你的整合包使用的所有模组 ID(详见下方的配置)。
- 在游戏中或控制台执行
/modwhitelist reload,或者重启服务器,以应用更改。
客户端
将 mod-whitelist-1.0.0.jar 添加到每个客户端实例的 mods/ 文件夹中,与其他整合包模组放在一起。如果你通过 Modrinth、CurseForge 或 packwiz 分发整合包,只需将此模组包含在打包定义中,即可为所有人自动安装。
白名单检查机制
这是一个严格白名单——任何未明确列出的内容均被视为未授权,即使它是无害的。存在两种导致玩家被踢出的情况:
1. 玩家安装了模组,但检测到未授权的模组
加入时,客户端会发送其完整的模组列表。服务器会将每一项与配置文件中的 allowed_mods 进行比较。如果列表中甚至有一个模组不在允许名单上,玩家将被立即断开连接,并显示可自定义的踢出消息,明确指出导致失败的模组。
2. 玩家完全没有安装 Mod Whitelist
这种情况涵盖原版客户端,或任何试图移除该模组本身以逃避检测的玩家。由于他们永远无法发送所需的数据包,服务器会在他们加入后等待 10 秒,然后将其踢出,并提示需要安装该模组。
重要提示: 每次向整合包添加新模组时,你也必须将其模组 ID 添加到 allowed_mods 中并重新加载配置——否则,下次玩家使用更新后的整合包连接时,都会被踢出。
配置
文件位置:config/mod-whitelist.json(首次启动时自动生成,带有合理的默认值)。
{
"enabled": true,
"kick_message": "§c检测到未授权模组:\n§f%mods%\n§7请安装官方整合包。",
"allowed_mods": [
"minecraft",
"fabricloader",
"fabric-api",
"java",
"modwhitelist",
"sodium",
"iris",
"lithium",
"ferrite-core",
"modmenu"
]
}
| 字段 |
类型 |
描述 |
enabled |
boolean |
开启或关闭整个检查功能,无需移除模组。 |
kick_message |
string |
踢出时显示的消息。使用 %mods% 作为占位符——它将被违规模组的逗号分隔列表替换。支持 \n 换行。 |
allowed_mods |
字符串数组 |
允许连接的精确模组 ID。不是显示名称——请使用每个模组 fabric.mod.json 中的 id 字段,或通过游戏内的 Mod Menu 查看。 |
kick_message 中的颜色代码
支持标准的 Minecraft 格式化代码:§a 绿色、§c 红色、§e 黄色、§f 白色、§7 灰色等。
命令
| 命令 |
效果 |
所需权限 |
/modwhitelist reload |
从磁盘重新加载 mod-whitelist.json,无需重启服务器。 |
管理员(相当于 OP 等级 3) |
/modwhitelist status |
显示检查是否启用、白名单中有多少模组以及当前的超时持续时间。 |
管理员(相当于 OP 等级 3) |
服务器控制台日志
该模组记录每次加入尝试,以便管理员一目了然地审核活动:
[ModWhitelist] 就绪 — 12 个允许模组,超时=10秒
[ModWhitelist] ✔ Steve — 12 个模组已验证
[ModWhitelist] ✘ Hacker 被踢出 — 未授权模组: wurst, xaeroplus
[ModWhitelist] ✘ VanillaPlayer 被踢出 — 缺少 ModWhitelist (超时)
技巧与最佳实践
- 保持白名单与整合包同步。 对整合包的每次更新(添加/移除模组)都需要相应地更新
allowed_mods。
- 始终在白名单中包含模组自身的 ID (
modwhitelist) —— 否则服务器会将自身所需的模组标记为未授权。
- 先在较小范围内测试更改。 编辑配置后,重新加载它,并让测试账号重新加入,然后再向整个社区推广,以避免因拼写错误导致合法玩家被大规模踢出。
- 性能/QoL 模组(Sodium、Lithium、Iris、ModMenu 等)通常与游戏玩法模组一起列入白名单,因为它们不影响游戏平衡,但能极大改善客户端体验。
故障排除
| 症状 |
可能原因 |
| 即使玩家已安装模组,所有人都因“缺少 ModWhitelist”被踢出 |
服务器和客户端的模组版本不匹配,或者服务器未在所需版本下运行 Fabric API —— 数据包未能正确注册。 |
| 合法玩家因“未授权模组”被踢出 |
allowed_mods 中的模组 ID 与该模组 fabric.mod.json 中的 ID 不完全匹配。ID 区分大小写。 |
| 配置更改未生效 |
运行 /modwhitelist reload,或确认你在服务器的 config/mod-whitelist.json 下编辑了正确的文件(而非客户端)。 |
Mod List
A Fabric server-side mod that enforces a strict modpack whitelist or blacklist — players running unauthorized mods are automatically kicked.
What it does
Minecraft doesn't natively expose a client's installed mod list to the server. Mod Whitelist fixes that gap: every time a player joins, their client (which must also have this mod installed) sends the server a list of every mod it has loaded. The server checks that list against an admin-defined whitelist and disconnects the player if anything doesn't match.
This is useful for server owners who want to guarantee every connected player is running the exact approved modpack — no extra performance mods that break balance, no client-side exploits.
Installation
Server
- Place
mod-whitelist-1.0.0.jar in your server's mods/ folder.
- Start the server once. This auto-generates the config file at
config/mod-whitelist.json.
- Edit that file to list every mod ID your modpack uses (see Configuration below).
- Run
/modwhitelist reload in-game/console, or restart the server, to apply changes.
Client
Add mod-whitelist-1.0.0.jar to the mods/ folder of every client instance, alongside the rest of the modpack. If you distribute your modpack via Modrinth, CurseForge, or packwiz, simply include this mod in the pack definition so it installs automatically for everyone.
How the whitelist check works
This is a strict whitelist — anything not explicitly listed is treated as unauthorized, even if it's harmless. There are two distinct scenarios that result in a kick:
1. Player has the mod, but an unauthorized mod is detected
On join, the client sends its full mod list. The server compares every entry against allowed_mods in the config. If even one mod isn't on the list, the player is disconnected immediately with a customizable kick message listing exactly which mod(s) caused the failure.
2. Player doesn't have Mod Whitelist installed at all
This covers vanilla clients, or anyone who removed the mod itself to dodge detection. Since they can never send the required packet, the server waits 10 seconds after they join and then kicks them with a message explaining that the mod is required.
Important: Every time you add a new mod to your pack, you must also add its mod ID to allowed_mods and reload the config — otherwise every player will be kicked the next time they connect with the updated pack.
Configuration
File location: config/mod-whitelist.json (auto-created on first launch with sensible defaults).
{
"enabled": true,
"kick_message": "§cUnauthorized mods detected:\n§f%mods%\n§7Please install the official modpack.",
"allowed_mods": [
"minecraft",
"fabricloader",
"fabric-api",
"java",
"modwhitelist",
"sodium",
"iris",
"lithium",
"ferrite-core",
"modmenu"
]
}
| Field |
Type |
Description |
enabled |
boolean |
Turns the whole check on/off without removing the mod. |
kick_message |
string |
Message shown on kick. Use %mods% as a placeholder — it's replaced with the comma-separated list of offending mods. Supports \n for line breaks. |
allowed_mods |
array of strings |
The exact mod IDs permitted to connect. Not display names — use the id field from each mod's fabric.mod.json, or check in-game via Mod Menu. |
Color codes in kick_message
Standard Minecraft formatting codes work: §a green, §c red, §e yellow, §f white, §7 gray, etc.
Commands
| Command |
Effect |
Required permission |
/modwhitelist reload |
Reloads mod-whitelist.json from disk without restarting the server. |
Admin (OP level 3 equivalent) |
/modwhitelist status |
Shows whether the check is enabled, how many mods are whitelisted, and the current timeout duration. |
Admin (OP level 3 equivalent) |
Server console logging
The mod logs every join attempt so admins can audit activity at a glance:
[ModWhitelist] Ready — 12 allowed mods, timeout=10s
[ModWhitelist] ✔ Steve — 12 mods verified
[ModWhitelist] ✘ Hacker kicked — unauthorized mods: wurst, xaeroplus
[ModWhitelist] ✘ VanillaPlayer kicked — ModWhitelist missing (timeout)
Tips & best practices
- Keep the whitelist in sync with your modpack. Every update to the pack (adding/removing a mod) requires a matching update to
allowed_mods.
- Always include the mod's own ID (
modwhitelist) in the whitelist — otherwise the server will flag its own required mod as unauthorized.
- Test changes on a small scale first. After editing the config, reload it and have a test account rejoin before rolling out to your whole community, to avoid mass-kicking legitimate players over a typo.
- Performance/QoL mods (Sodium, Lithium, Iris, ModMenu, etc.) are common to whitelist alongside your gameplay mods, since they don't affect game balance but greatly improve client experience.
Troubleshooting
| Symptom |
Likely cause |
| Everyone gets kicked for "ModWhitelist missing" even though they have the mod |
Server and client mod versions mismatch, or the server isn't running Fabric API at the required version — the packet never registers correctly. |
| A legitimate player gets kicked for an "unauthorized mod" |
The mod ID in allowed_mods doesn't exactly match the ID in that mod's fabric.mod.json. IDs are case-sensitive. |
| Config changes don't apply |
Run /modwhitelist reload, or confirm you edited the correct file under config/mod-whitelist.json on the server (not the client). |
评论 0
登录后参与评分
还没有评论,来抢沙发吧