? Welcome Mod
一款简单、可配置的 Fabric 服务端模组,用于在玩家加入时发送欢迎信息——可以是公开广播、私聊或两者兼有。
轻量级:MidnightLib 已打包在 JAR 文件内部(jar-in-jar),因此无需外部依赖。
目录
功能特性
- ? 广播欢迎消息 向服务器上的所有玩家发送。
- ? 个人欢迎消息 直接发送给加入的玩家。
- ? 可选的覆盖层显示用于广播消息。
- ? 自定义占位符 用于插入玩家/服务器信息。
- ⚙️ 在游戏中编辑配置 通过 MidnightLib GUI 或直接编辑 JSON 文件。
- ? 无外部依赖 — MidnightLib 及其他所需部分已包含在模组 JAR 中。
安装
- 下载
welcome-mod.jar(来自你的构建或发布版本)。
- 将
welcome-mod.jar 放入服务器的 mods/ 文件夹中。
- 启动(或重启)你的 Fabric 服务器。
- 通过游戏内的 MidnightLib 配置 GUI 或编辑位于
config/welcome-mod.json 的配置文件进行配置。
配置
你可以通过在游戏中(MidnightLib GUI)或直接编辑服务器 config/ 文件夹中的 JSON 配置文件来更新模组配置。如果 MidnightLib 支持实时配置更新,更改应立即生效而无需重启服务器。
默认配置 (JSON)
{
"enableBroadcastWelcomeMessage": true,
"enablePersonalWelcomeMessage": true,
"broadcastWelcomeOverlay": true,
"broadcastMessage": "§fEveryone welcome §a%player§f to §a%server§r!",
"personalMessage": "Welcome §9%player§r, to §a%server§r!"
}
注意:消息中支持 Minecraft 颜色代码(例如 §a, §f, §9, §r)。
在游戏中或通过文件更新配置
- 游戏中:打开 MidnightLib 的配置命令,找到 welcome-mod 条目并编辑字段。按回车键即可更新正在运行的配置。
- 配置文件:编辑
config/welcome-mod.json 并保存。如果服务器/模组支持热重载,更改将立即生效。否则,请重启服务器。
占位符
在 broadcastMessage 和 personalMessage 中使用这些占位符。模组将在运行时自动替换它们:
placeholders.put("%player", player.getDisplayName().getString());
placeholders.put("%server", server.getName());
placeholders.put("%permission", String.valueOf(player.getPermissionLevel()));
placeholders.put("%max", String.valueOf(server.getMaxPlayerCount()));
placeholders.put("%cur", String.valueOf(server.getCurrentPlayerCount()));
| 占位符 |
描述 |
输出示例 |
%player |
玩家显示名称 |
Notch |
%server |
服务器名称 |
My Awesome Server |
%permission |
玩家权限等级 (op 等级) |
4 |
%max |
服务器上配置的最大玩家数量 |
100 |
%cur |
当前在线玩家数量 |
12 |
使用占位符的消息示例:
"broadcastMessage": "Welcome %player to %server! There are %cur/%max players online."
使用方法
清单 / 模组元数据 (示例)
将此保存为 fabric.mod.json(或包含在你的构建输出中)。此示例符合你提供的模组结构:
{
"schemaVersion": 1,
"id": "welcome-mod",
"version": "${version}",
"name": "Welcome Mod",
"description": "A simple, server-side mod to greet new players. Configure a custom message to be broadcast server-wide, sent directly to the player, or both.",
"authors": [
"Ben L Martin"
],
"contact": {
"email": "ben@lmartin.dev",
"sources": "https://github.com/tsunddev/welcome-mod"
},
"license": "MIT",
"icon": "assets/welcome-mod/icon.png",
"environment": "*",
"entrypoints": {
"main": [
"dev.lmartin.Main"
]
},
"mixins": [
"welcome-mod.mixins.json"
],
"depends": {
"fabricloader": ">=0.17.3",
"minecraft": "~1.21.10",
"java": ">=21",
"fabric-api": "*"
},
"suggests": {}
}
技术细节
- 模组 ID:
welcome-mod
- 入口点 (主类):
dev.lmartin.Main
- 构建目标: Fabric Loader (版本限制见清单)
- Java: 需要 Java 21 或更高版本(如清单中指定)
- 配置存储: 位于
config/welcome-mod.json 下的 JSON 文件,通过 MidnightLib GUI 暴露。
开发与贡献
欢迎贡献!典型的工作流程如下:
- Fork 仓库。
- 创建功能分支。
- 进行修改并更新测试(如果有)。
- 提交 PR,并清晰描述你的更改。
如果您添加了更改配置格式或占位符的功能,请更新 README 并相应地提升 schema/version。
作者与联系方式
Ben L Martin
许可证
本项目采用 MIT License 发布。详情请参阅 LICENSE。
? “一句温暖的欢迎语能带来深远的影响——即便在 Minecraft 中也是如此。”
— Welcome Mod
? Welcome Mod
A simple, configurable Fabric server-side mod that greets players when they join — publicly, privately, or both.
Lightweight: MidnightLib is bundled inside the JAR (jar-in-jar), so no external dependency required.
Table of Contents
Features
- ? Broadcast Welcome Messages to everyone on the server.
- ? Personal Welcome Messages sent directly to the joining player.
- ? Optional overlay display for broadcast messages.
- ? Custom placeholders for player/server info.
- ⚙️ Edit config in-game via MidnightLib GUI or directly edit the JSON file.
- ? No external dependencies — MidnightLib and other required parts are included inside the mod JAR.
Installation
- Download the
welcome-mod.jar (from your build or release).
- Place
welcome-mod.jar into your server's mods/ folder.
- Start (or restart) your Fabric server.
- Configure via in-game MidnightLib config GUI or edit the config file at
config/welcome-mod.json.
Configuration
You can update the mod configuration either in-game (MidnightLib GUI) or by directly editing the JSON config file in your server's config/ folder. Changes should apply without a server restart where midnightlib supports live config updates.
Default config (JSON)
{
"enableBroadcastWelcomeMessage": true,
"enablePersonalWelcomeMessage": true,
"broadcastWelcomeOverlay": true,
"broadcastMessage": "§fEveryone welcome §a%player§f to §a%server§r!",
"personalMessage": "Welcome §9%player§r, to §a%server§r!"
}
Note: Minecraft color codes (e.g. §a, §f, §9, §r) are supported in the messages.
Update config in-game or via file
- In-game: Open MidnightLib's config commands, find the welcome-mod entry, and edit the fields. Pressing enter will update the running configuration.
- Config file: Edit
config/welcome-mod.json and save. If the server/mod supports live reloads, the changes will take effect immediately. Otherwise, restart the server.
Placeholders
Use these placeholders in broadcastMessage and personalMessage. The mod will replace them automatically at runtime:
placeholders.put("%player", player.getDisplayName().getString());
placeholders.put("%server", server.getName());
placeholders.put("%permission", String.valueOf(player.getPermissionLevel()));
placeholders.put("%max", String.valueOf(server.getMaxPlayerCount()));
placeholders.put("%cur", String.valueOf(server.getCurrentPlayerCount()));
| Placeholder |
Description |
Example output |
%player |
Player display name |
Notch |
%server |
Server name |
My Awesome Server |
%permission |
Player permission level (op level) |
4 |
%max |
Max player count configured on server |
100 |
%cur |
Current online player count |
12 |
Example message using placeholders:
"broadcastMessage": "Welcome %player to %server! There are %cur/%max players online."
Usage
Manifest / mod metadata (example)
Save this as fabric.mod.json (or include in your build output). This example matches the mod schema you provided:
{
"schemaVersion": 1,
"id": "welcome-mod",
"version": "${version}",
"name": "Welcome Mod",
"description": "A simple, server-side mod to greet new players. Configure a custom message to be broadcast server-wide, sent directly to the player, or both.",
"authors": [
"Ben L Martin"
],
"contact": {
"email": "ben@lmartin.dev",
"sources": "https://github.com/tsunddev/welcome-mod"
},
"license": "MIT",
"icon": "assets/welcome-mod/icon.png",
"environment": "*",
"entrypoints": {
"main": [
"dev.lmartin.Main"
]
},
"mixins": [
"welcome-mod.mixins.json"
],
"depends": {
"fabricloader": ">=0.17.3",
"minecraft": "~1.21.10",
"java": ">=21",
"fabric-api": "*"
},
"suggests": {}
}
Technical Details
- Mod ID:
welcome-mod
- Entry point (main):
dev.lmartin.Main
- Built for: Fabric Loader (see manifest for version constraints)
- Java: Requires Java 21 or newer (as specified in manifest)
- Config storage: JSON file under
config/welcome-mod.json, exposed through MidnightLib GUI.
Development & Contributing
Contributions welcome! Typical workflow:
- Fork the repository.
- Create a feature branch.
- Make changes and update tests (if any).
- Open a PR with a clear description of your changes.
If you add features that change config format or placeholders, update the README and bump the schema/version accordingly.
Author & Contact
Ben L Martin
License
This project is released under the MIT License. See LICENSE for details.
? “A warm welcome goes a long way — even in Minecraft.”
— Welcome Mod
评论 0
登录后参与评分
还没有评论,来抢沙发吧