NotifyMe
NotifyMe 是一款轻量级的 Fabric 服务端模组,适用于 Minecraft 1.21.1。它监控常见的服务器事件并向游戏外发送通知。
该模组专为希望在不保持 Minecraft 客户端开启的情况下了解重要事件发生的服务器所有者而构建。NotifyMe 可以向游戏内操作员发出警报、通过 Postfix/sendmail 发送邮件、发送 Telegram 机器人消息、调用通用 JSON Webhook,或发布到 ntfy 主题。
功能特性
- 服务器启动和停止通知
- 玩家加入和离开通知
- 玩家死亡通知,包含死亡信息、维度、位置、生命值和伤害元数据
- 可选的聊天、命令广播和游戏内消息通知
- 针对操作员或指定接收者的游戏内通知
- 通过兼容 Postfix 的
sendmail 二进制文件进行邮件投递
- Telegram 机器人投递
- 通用 Webhook 投递,支持可选的秘密标头
- ntfy 主题投递,支持可选的身份验证令牌、优先级和标签
- 玩家过滤器,用于监视和忽略特定玩家
- 消息前缀过滤器,用于过滤敏感聊天或命令内容
- 运行时管理命令,用于重载配置、测试通知和状态检查
要求
- Minecraft 1.21.1
- Fabric Loader 0.18.4 或更高版本
- Fabric API
- Java 21 或更高版本
NotifyMe 仅作用于服务端。玩家无需在客户端安装此模组。
安装
- 在你的 Minecraft 1.21.1 服务器上安装 Fabric Loader 和 Fabric API。
- 将 NotifyMe 的 jar 文件放入服务器的
mods 文件夹中。
- 启动服务器一次。
- 编辑生成的配置文件
config/notifymemod.json。
- 运行
/notifyme reload 或重启服务器。
- 运行
/notifyme test 以验证已配置的通知渠道。
通知渠道
游戏内
游戏内通知默认启用。默认情况下,NotifyMe 仅向服务器操作员发送消息。
将 inGame.opsOnly 设置为 false 可向所有在线玩家发送,或将 inGame.recipients 设置为确切玩家名称列表。
Postfix / sendmail
NotifyMe 可以将电子邮件传递给本地的 sendmail 命令,这与 Postfix 配合良好。
启用 postfix.enabled,配置 postfix.from,并在 postfix.to 中添加一个或多个地址。
示例:
"postfix": {
"enabled": true,
"sendmailPath": "/usr/sbin/sendmail",
"from": "minecraft@example.com",
"to": ["admin@example.com"],
"timeoutSeconds": 10
}
Postfix 必须在服务器上预先配置好。NotifyMe 仅负责将消息交给 sendmail;它不会配置 SMTP、DNS、DKIM、SPF 或中继设置。
Telegram
使用 BotFather 创建机器人,将其添加到目标聊天频道,并配置机器人令牌和聊天 ID。
示例:
"telegram": {
"enabled": true,
"botToken": "123456:bot-token",
"chatId": "123456789",
"messageThreadId": 0,
"disableNotification": false,
"timeoutSeconds": 10
}
对于论坛主题或超级群组线程,请设置 messageThreadId。
Webhook
Webhook 后端发送包含事件名称、标题、消息、紧凑消息、玩家名称、时间戳和元数据的 JSON 负载。
示例:
"webhook": {
"enabled": true,
"url": "https://example.com/minecraft-webhook",
"secretHeaderName": "X-NotifyMe-Secret",
"secretHeaderValue": "change-me",
"timeoutSeconds": 10
}
ntfy
NotifyMe 可以直接发布到 ntfy 主题 URL。
示例:
"ntfy": {
"enabled": true,
"topicUrl": "https://ntfy.sh/my-minecraft-topic",
"token": "",
"priority": "default",
"tags": ["minecraft"],
"timeoutSeconds": 10
}
对于受保护的 ntfy 主题,请设置 token。
配置
NotifyMe 在首次运行时创建 config/notifymemod.json。
默认事件设置:
"events": {
"serverStarted": true,
"serverStopping": true,
"playerJoined": true,
"playerLeft": true,
"playerDied": true,
"chatMessage": false,
"commandMessage": false,
"gameMessage": false,
"test": true
}
聊天、命令和游戏消息通知默认禁用,因为它们可能会产生噪音,且可能包含私人或敏感信息。仅在符合你的服务器策略时才启用它们。
过滤选项:
"filters": {
"watchedPlayers": [],
"ignoredPlayers": [],
"ignoreMessagesStartingWith": ["/login", "/register"]
}
watchedPlayers:如果非空,则仅发送这些玩家的事件。
ignoredPlayers:跳过这些玩家的事件。
ignoreMessagesStartingWith:跳过具有匹配前缀的聊天或命令消息通知。
常规选项:
"serverName": "Minecraft Server",
"timezone": "system",
"subjectPrefix": "[Minecraft]"
serverName 显示在通知正文中。
timezone 接受 system 或 Java 时区 ID,如 Europe/Berlin 或 America/New_York。
subjectPrefix 添加在通知标题前。
命令
NotifyMe 命令需要权限等级 2。
/notifyme reload
/notifyme test
/notifyme status
/notifyme reload 重新加载 config/notifymemod.json。
/notifyme test 通过启用的渠道排队发送测试通知。
/notifyme status 显示配置路径、启用的事件类型以及后端就绪状态。
隐私说明
外部通知服务可能会接收玩家名称、聊天内容(如果启用)、死亡信息、坐标、服务器元数据和时间戳。
在公共服务器上启用聊天、命令消息、游戏消息、Webhook、Telegram、ntfy 或邮件投递之前,请仔细审查你的配置。
兼容性
NotifyMe 使用 Fabric API 事件钩子,不需要 mixins。除非其他模组以异常方式更改相同的事件,否则它应与大多数服务端 Fabric 模组兼容。
许可证
NotifyMe 采用 CC0-1.0 许可证授权。
NotifyMe
NotifyMe is a lightweight Fabric server-side mod for Minecraft 1.21.1 that watches common server events and sends notifications outside the game.
It is built for server owners who want to know when important things happen without keeping the Minecraft client open. NotifyMe can alert operators in-game, send email through Postfix/sendmail, post Telegram bot messages, call a generic JSON webhook, or publish to an ntfy topic.
Features
- Server started and server stopping notifications
- Player join and leave notifications
- Player death notifications with death message, dimension, position, health, and damage metadata
- Optional chat, command broadcast, and game message notifications
- In-game notifications for operators or named recipients
- Email delivery through a Postfix-compatible
sendmail binary
- Telegram bot delivery
- Generic webhook delivery with optional secret header
- ntfy topic delivery with optional bearer token, priority, and tags
- Player filters for watched and ignored players
- Message-prefix filters for sensitive chat or command content
- Runtime admin commands for reloads, test notifications, and status checks
Requirements
- Minecraft 1.21.1
- Fabric Loader 0.18.4 or newer
- Fabric API
- Java 21 or newer
NotifyMe is server-side. Players do not need to install it on their clients.
Installation
- Install Fabric Loader and Fabric API on your Minecraft 1.21.1 server.
- Put the NotifyMe jar into the server
mods folder.
- Start the server once.
- Edit the generated config file at
config/notifymemod.json.
- Run
/notifyme reload or restart the server.
- Run
/notifyme test to verify your configured notification channels.
Notification Channels
In-Game
In-game notifications are enabled by default. By default, NotifyMe sends messages only to server operators.
Set inGame.opsOnly to false to send to all online players, or set inGame.recipients to a list of exact player names.
Postfix / sendmail
NotifyMe can pass email to a local sendmail command, which works well with Postfix.
Enable postfix.enabled, configure postfix.from, and add one or more addresses to postfix.to.
Example:
"postfix": {
"enabled": true,
"sendmailPath": "/usr/sbin/sendmail",
"from": "minecraft@example.com",
"to": ["admin@example.com"],
"timeoutSeconds": 10
}
Postfix must already be configured on the server. NotifyMe only hands the message to sendmail; it does not configure SMTP, DNS, DKIM, SPF, or relay settings.
Telegram
Create a bot with BotFather, add it to the target chat, and configure the bot token and chat id.
Example:
"telegram": {
"enabled": true,
"botToken": "123456:bot-token",
"chatId": "123456789",
"messageThreadId": 0,
"disableNotification": false,
"timeoutSeconds": 10
}
For forum topics or supergroup threads, set messageThreadId.
Webhook
The webhook backend sends a JSON payload with the event name, title, message, compact message, player name, timestamp, and metadata.
Example:
"webhook": {
"enabled": true,
"url": "https://example.com/minecraft-webhook",
"secretHeaderName": "X-NotifyMe-Secret",
"secretHeaderValue": "change-me",
"timeoutSeconds": 10
}
ntfy
NotifyMe can publish directly to an ntfy topic URL.
Example:
"ntfy": {
"enabled": true,
"topicUrl": "https://ntfy.sh/my-minecraft-topic",
"token": "",
"priority": "default",
"tags": ["minecraft"],
"timeoutSeconds": 10
}
For protected ntfy topics, set token.
Configuration
NotifyMe creates config/notifymemod.json on first run.
Default event settings:
"events": {
"serverStarted": true,
"serverStopping": true,
"playerJoined": true,
"playerLeft": true,
"playerDied": true,
"chatMessage": false,
"commandMessage": false,
"gameMessage": false,
"test": true
}
Chat, command, and game-message notifications are disabled by default because they can be noisy and may contain private or sensitive information. Enable them only when that fits your server policy.
Filtering options:
"filters": {
"watchedPlayers": [],
"ignoredPlayers": [],
"ignoreMessagesStartingWith": ["/login", "/register"]
}
watchedPlayers: if non-empty, only events for these players are sent.
ignoredPlayers: events for these players are skipped.
ignoreMessagesStartingWith: skips chat or command-message notifications with matching prefixes.
General options:
"serverName": "Minecraft Server",
"timezone": "system",
"subjectPrefix": "[Minecraft]"
serverName appears in notification bodies.
timezone accepts system or a Java time zone id such as Europe/Berlin or America/New_York.
subjectPrefix is added to notification titles.
Commands
NotifyMe commands require permission level 2.
/notifyme reload
/notifyme test
/notifyme status
/notifyme reload reloads config/notifymemod.json.
/notifyme test queues a test notification through enabled channels.
/notifyme status shows the config path, enabled event types, and backend readiness.
Privacy Notes
External notification services can receive player names, chat content if enabled, death messages, coordinates, server metadata, and timestamps.
Review your configuration before enabling chat, command-message, game-message, webhook, Telegram, ntfy, or email delivery on public servers.
Compatibility
NotifyMe uses Fabric API event hooks and does not require mixins. It should be compatible with most server-side Fabric mods unless another mod changes the same events in unusual ways.
License
NotifyMe is licensed under CC0-1.0.
评论 0
登录后参与评分
还没有评论,来抢沙发吧