WorldEaterNotifier

模组

· 作者 Kisde

一个 Fabric 模组,用于监控世界吞噬者和掘沟者,并在它们停止或被阻塞时发送 Discord 通知,支持按事件配置 @提及(ping)控制。

0 本站下载 0 关注 更新于 3 个月前

最新 1.3.0 · 1.21.11 · Fabric

一键开服(送7天)

WorldEaterNotifier

一款 Fabric 模组,用于监控世界吞噬者(World Eaters)和挖掘者(Trenchers),在它们停止或受阻时发送带有按事件控制提及的 Discord 通知。

WorldEaterGithub_10fps

这是什么?

一款 Fabric 模组,用于监控基于 TNT 的世界吞噬者(World Eaters)、挖掘者(Trenchers)以及基于方块破坏的黑曜石破碎机(Bedrock Breakers),在它们开始、停止或受阻时发送带有按事件控制提及和完全自定义消息的 Discord Webhook 通知。

文档

有关如何配置所有功能的完整指南,请访问文档: WorldEaterNotifier Documentation

功能

  • 实时监控:追踪世界吞噬者(TNT 数量)、挖掘者和黑曜石破碎机(方块破坏情况)。
  • Discord 集成:当机器开始、停止、恢复或被手动停止时,立即发送通知。
  • 可定制的消息:每种机器类型的每条通知消息均可通过 JSON 进行配置——使用 {type} 和 {name} 占位符。
  • 基于角色的通知:提及特定的 Discord 角色,并支持按事件切换(全局、开始、手动停止、卡住、恢复、服务器关闭)。所有设置均可通过游戏内命令进行配置。
  • Discord 机器人模式:基于 JDA 的机器人,具有交互式切换按钮和斜杠命令(/config、/worldeater start|stop|list、/trencher start|stop|list、/bedrockbreaker start|stop|list),并支持自动补全。
  • 可配置的阈值:每种机器类型的停止超时时间、最小 TNT 数量 / 最少破坏方块数。
  • 多世界支持:监控不同维度中的机器。
  • 持久化配置:机器定义、设置和提及开关在服务器重启后依然保留。消息可在 JSON 中编辑。
  • 服务器关闭检测:在服务器关闭时自动停止所有活动机器,并通知 Discord。

安装

  1. 克隆仓库:

    git clone https://github.com/CodeW4VE/WorldEaterNotifier.git
    cd WorldEaterNotifier
    
  2. 构建模组:

    ./gradlew build
    
  3. 将生成的 .jar 文件从 build/libs/ 复制到服务器的 mods 文件夹:

    cp build/libs/worldeaternotifier-*.jar /path/to/server/mods/
    
  4. 在服务器的 config 目录中创建一个 worldeaternotifier-config.json 文件,其中包含 Discord Webhook 和世界吞噬者设置。

配置

模组在首次运行时会在 config/worldeaternotifier.json 创建配置文件。你可以手动编辑它或使用游戏内命令。

示例:

{
  "webhookUrl": "https://discord.com/api/webhooks/...",
  "pingRoleId": "123456789012345678",
  "notificationMode": "webhook",
  "botToken": "",
  "guildId": "",
  "channelId": "",
  "showSubscriptionButton": true,
  "memberDiscordRole": "",
  "worldEaterSettings": {
    "stopTimeoutSeconds": 60,
    "minTntCount": 3,
    "pingSettings": {
      "enabled": true,
      "onStart": true,
      "onStop": true,
      "onStuck": true,
      "onResumed": true,
      "onShutdown": true
    },
    "messages": {
      "start": "{type} **'{name}'** has started.",
      "stuck": "{type} **'{name}'** has stopped due to an obstruction.",
      "resumed": "{type} **'{name}'** has started again.",
      "manualStop": "{type} **'{name}'** was stopped manually.",
      "shutdown": "{type} **'{name}'** was shut down with the server and may have broken."
    }
  },
  "trencherSettings": {
    "stopTimeoutSeconds": 180,
    "minBlocksBroken": 20,
    "pingSettings": {
      "enabled": true,
      "onStart": true,
      "onStop": true,
      "onStuck": true,
      "onResumed": true,
      "onShutdown": true
    },
    "messages": {
      "start": "{type} **'{name}'** has started.",
      "stuck": "{type} **'{name}'** has stopped due to an obstruction.",
      "resumed": "{type} **'{name}'** has started again.",
      "manualStop": "{type} **'{name}'** was stopped manually.",
      "shutdown": "{type} **'{name}'** was shut down with the server and may have broken."
    }
  },
  "bedrockBreakerSettings": {
    "stopTimeoutSeconds": 60,
    "minBlocksBroken": 1,
    "pingSettings": {
      "enabled": true,
      "onStart": true,
      "onStop": true,
      "onStuck": true,
      "onResumed": true,
      "onShutdown": true
    },
    "messages": {
      "start": "{type} **'{name}'** has started.",
      "stuck": "{type} **'{name}'** has stopped due to an obstruction.",
      "resumed": "{type} **'{name}'** has started again.",
      "manualStop": "{type} **'{name}'** was stopped manually.",
      "shutdown": "{type} **'{name}'** was shut down with the server and may have broken."
    }
  },
  "worldEaters": [],
  "trenchers": [],
  "bedrockBreakers": [],
  "whitelist": []
}
  • webhookUrl: Discord webhook URL。
  • pingRoleId: 需要提及的 Discord 角色 ID。留空或设为 "0" 以禁用所有提及。
  • notificationMode: "webhook"(默认)或 "bot" —— 在 webhook 和 JDA 机器人模式之间切换。
  • botToken: Discord 机器人令牌(机器人模式下必需)。
  • guildId / channelId: 用于机器人通知和斜杠命令的 Discord 服务器和频道。
  • showSubscriptionButton: 是否在开始消息中显示“切换 Ping”按钮(机器人模式下)。
  • memberDiscordRole: 通过斜杠命令限制 /worldeater start|stop|list(以及 trencher/bedrockbreaker 等效命令)访问权限的 Discord 角色 ID;管理员始终拥有访问权限。
  • stopTimeoutSeconds: 机器被视为卡住前,无活动状态的秒数。
  • minTntCount / minBlocksBroken: 每次检查时保持机器存活所需的最小活动量。
  • pingSettings: 每种机器类型的 Ping 开关设置(enabled, onStart, onStop, onStuck, onResumed, onShutdown)—— 这些设置现在会在重启后保留。
  • messages: 每种机器类型的自定义 Discord 通知消息。使用 {type} 表示机器类型名称,使用 {name} 表示机器实例名称。

使用方法

  1. 安装模组并启动服务器。
  2. 配置通知发送方式:
    • Webhook 模式(默认):/worldeater settings setWebhookUrl <url>
    • 机器人模式:/worldeater settings setBotToken <token>,设置 setGuildId 和 setChannelId,然后执行 /worldeater settings setNotificationMode bot
  3. 创建机器:
    • /worldeater create <name> <x1> <y1> <z1> <x2> <y2> <z2>
    • /trencher create <name> <x1> <y1> <z1> <x2> <y2> <z2>
    • /bedrockbreaker create <name> <x1> <y1> <z1> <x2> <y2> <z2> (坐标会自动建议你所站立的方块;按 Tab 键补全名称。)
  4. 使用 /worldeater start <name>、/trencher start <name> 或 /bedrockbreaker start <name> 开始监控。
  5. 当机器意外停止(卡住)、恢复运行或被手动停止时,模组会自动发送 Discord 消息。
  6. 在机器人模式下,Discord 斜杠命令与 Minecraft 命令对应:
    • /worldeater start <name>、/worldeater stop <name>、/worldeater list(自动补全会建议现有名称)
    • /trencher 和 /bedrockbreaker 同理
    • /config pings —— 交互式流程,用于切换每种机器类型的 Ping 设置
  7. 动态调整设置:
    • /worldeater settings show、/trencher settings show、/bedrockbreaker settings show
    • /worldeater settings setStopTimeout <seconds>
    • /trencher settings setMinBlocksBroken <count>
    • /worldeater settings discordPings enable true 以及单独的事件如 onStuck false
    • /worldeater settings showSubscriptionButton <true|false>(机器人模式下)
    • /worldeater settings setMemberDiscordRole <roleId>(机器人模式下)
    • 直接在 JSON 文件中编辑通知消息。
    • 使用 Tab 键探索所有子命令。
  8. 管理机器:对所有三种类型均可使用 list、stop、delete。
  9. 当服务器关闭时,所有活跃的机器都会停止,并发送一条关机通知。

依赖项

从源码构建

需要:

  • Gradle 8.10.2 或更高版本(通过 gradlew 自动下载)
  • Java 21 或更高版本

构建命令:

./gradlew clean build

生成的文件:build/libs/worldeaternotifier-*.jar

许可证

MIT © froyln

你是这个资源的作者?登录后可认领此资源。

评论 0

0.0
暂无评分
5 星
0
4 星
0
3 星
0
2 星
0
1 星
0
我的评分

登录后参与评分

还没有评论,来抢沙发吧

评论配图

相似资源