跳到正文

unichat-adapter

作者:voguh

用 UniChat 让聊天内容影响 Minecraft。

收藏

截图

介绍

介绍由机器翻译自 Modrinth 原页面,仅供参考。

UniChat 适配器 for Minecraft

你的直播聊天,就在 Minecraft 里。

将你的 Minecraft 连接到 UniChat,让它与世界互动。

sample-screenshot

工作器

事件也可以运行服务器命令。规则位于 <world_folder>/serverconfig/unichat_adapter-workers.jsonc 中。

一个工作器包含四个部分:

  • name – 工作器显示名称;
  • onEvent – 工作器监听事件;
  • conditions – 触发此工作器的事件条件;
  • action.execCommands – 服务器将执行的命令列表;

请提供需要翻译的英文内容。

// Runs server commands when a UniChat event matches every condition.
//[
//    {
//        "name": "Spawn creeper on donate over 100 dollars",
//        "onEvent": "unichat:donate",
//        "conditions": [
//            { "property":  "platform", "operator": "EQUALS", "value": "youtube" },
//            { "property": "value", "operator": "GREATER_THAN_OR_EQUAL", "value": 100 }
//        ],
//        "actions": {
//            "execCommands": [
//                "/execute as @a at @s run summon minecraft:creeper ~ ~ ~"
//            ]
//        }
//    },
//    {
//        "name": "Shoutout raid",
//        "onEvent": "unichat:raid",
//        "conditions": [],
//        "actions": {
//            "execCommands": [
//                "/title @a title [{\"text\":\"${authorDisplayName}\",\"color\":\"${authorDisplayColor}\"}]",
//                "/title @a subtitle [{\"text\":\"Acabou de chegar com seus espectadores\"}]",
//                "/execute as @a at @s run playsound ui.toast.challenge_complete master @s ~ ~ ~ 1 1"
//            ]
//        }
//    },
//    {
//        "name": "Shoutout donation",
//        "onEvent": "unichat:donate",
//        "conditions": [
//            { "property":  "platform", "operator": "NOT_EQUALS", "value": "twitch" }
//        ],
//        "actions": {
//            "execCommands": [
//                "/title @a actionbar [{\"text\":\"${authorDisplayName}\",\"color\":\"${authorDisplayColor}\"}, {\"text\":\" acabou de doar\", \"color\":\"white\"}, {\"text\":\" ${currency} ${value}\", \"color\":\"yellow\"}, {\"text\":\"!\", \"color\":\"white\"}]",
//                "/execute as @a at @s run playsound entity.player.levelup master @s ~ ~ ~ 1 0.8",
//                "/execute as @a at @s run playsound entity.player.levelup master @s ~ ~ ~ 1 1",
//                "/execute as @a at @s run playsound entity.player.levelup master @s ~ ~ ~ 1 1.2",
//                "/execute as @a at @s run playsound entity.player.levelup master @s ~ ~ ~ 1 1.4"
//            ]
//        }
//    },
//    {
//        "name": "Shoutout twitch donation",
//        "onEvent": "unichat:donate",
//        "conditions": [
//            { "property":  "platform", "operator": "EQUALS", "value": "twitch" }
//        ],
//        "actions": {
//            "execCommands": [
//                "/title @a actionbar [{\"text\":\"${authorDisplayName}\",\"color\":\"${authorDisplayColor}\"}, {\"text\":\" acabou de doar\", \"color\":\"white\"}, {\"text\":\" ${round(value)} bits\", \"color\":\"yellow\"}, {\"text\":\"!\", \"color\":\"white\"}]",
//                "/execute as @a at @s run playsound entity.player.levelup master @s ~ ~ ~ 1 0.8",
//                "/execute as @a at @s run playsound entity.player.levelup master @s ~ ~ ~ 1 1",
//                "/execute as @a at @s run playsound entity.player.levelup master @s ~ ~ ~ 1 1.2",
//                "/execute as @a at @s run playsound entity.player.levelup master @s ~ ~ ~ 1 1.4"
//            ]
//        }
//    }
//]

可用的条件运算符有:

  • EQUALS:适用于 numeric、string 和 boolean 属性;
  • NOT_EQUALS:适用于 numeric、string 和 boolean 属性;
  • GREATER_THAN:适用于 numeric 属性
  • GREATER_THAN_OR_EQUAL:适用于 numeric 属性;
  • LESS_THAN:适用于 numeric 属性;
  • LESS_THAN_OR_EQUAL:适用于 numeric 属性;
  • CONTAINS:适用于 string 属性;
  • STARTS_WITH:适用于 string 属性;
  • ENDS_WITH:适用于 string 属性;

完整的 UniChat 事件列表可在此处找到。

命令可以用 ${fieldName} 读取相同的字段,例如 /say ${authorDisplayName} said it。

运行 /unichat reload 以在不重启的情况下应用更改。

许可证

本模组采用 Eclipse Public License 2.0 许可。

常见问题

unichat-adapter 支持哪些 Minecraft 版本?

unichat-adapter 支持 Minecraft Java 版 1.21.1,可用的加载器:NeoForge。下载时注意选择和你游戏版本一致的文件。

unichat-adapter 怎么安装?

先用 PCL2 或 HMCL 启动器安装对应版本的 NeoForge,再把下载的 .jar 文件放进游戏目录的 mods 文件夹,重新启动游戏即可。开启了版本隔离的,mods 文件夹在 versions/版本名 下面。运行环境:客户端和服务端都要装。

评论

登录后评论和评分