? 26.1、26.2 和 26.3 的 Beta 版本现已提供
? 如需任何帮助,请加入我们的 Matrix 频道
? 需要 Forge 版本?请查看 MC Matrix Bridge!
⚠️ 从 v1.5 及以上版本起,不再需要 Fabric Language Kotlin (FLK)。v1.4 及更早版本与 1.13.3+kotlin.2.1.21 之后的 FLK 版本 不兼容
☕ 'Better Than Adventure' 版本需要 Java 11 或更高版本。对于 v1.4 及更早版本,必须覆盖 Fabric Language Kotlin (FLK) 的依赖项。更多信息见下文。
Matrix Bridge
Matrix Bridge 允许用户将 Minecraft 服务器的聊天与 Matrix 房间桥接。此模组使 Matrix 用户无需登录 Minecraft 世界即可与 Minecraft 玩家交谈。
此桥接会发送服务器启动、服务器停止、玩家加入、玩家离开、玩家死亡以及玩家聊天消息。此桥接还包含桥接命令 '!list'、'!ping' 和 '!invite',允许 Matrix 侧的用户分别获取玩家列表、对服务器进行 ping 测试以及将玩家加入白名单。
此模组使用基于密码的登录方式,并支持加密房间和会话验证。此外,还提供基于 YAML 的配置文件,并支持包括 H2(默认)、MariaDB 和 PostgreSQL 在内的多种数据库。
此模组将根据请求移植到不同的游戏版本。如果您希望提交反馈、请求新移植或需要其他一般性帮助,请加入我们的 支持频道。
Matrix Bridge 基于 MatrixSDK 构建,后者使用了 Trixnity。
配置
剧透
config.yaml
# +---------------------------------------------------+
# | |
# | Matrix Bridge Configuration |
# | |
# +---------------------------------------------------+
# 请确保所有值符合 YAML 标准。
# 缩进非常重要!不允许使用制表符。
# 有关详细解释,请参阅 "https://www.tutorialspoint.com/yaml/"。
#
# 设置不当的值将使用默认值。整数 -> 0,布尔值 -> false,验证类型 -> DISABLED,数据库类型 -> H2。
# 请确保您的值设置正确!
#
# 此文件永远不会被修改。仅在生成时写入此文件。
# 此文件对注释安全。它们不会消失。
#
# 如需帮助,请加入我们的 Matrix 频道 "https://matrix.to/#/#sophie.projects:aenead.net"。
# 谢谢! <3
# 请勿修改。用于检测是否需要更新配置。
version: 2
# 显示 Trixnity 日志消息。有助于调试。
verbose: false
# +---------------------------------------------------+
# | |
# | Account |
# | |
# +---------------------------------------------------+
# 用于登录机器人账户的设置。
account:
# Synapse URL。支持委派。
homeserver: "https://matrix.example.org"
# 账户登录用户名。用户的 MXID 的本地部分。
username: "user"
# 账户登录密码。不支持令牌或 SSO。
password: "pass"
# 桥接会话的设备名称。
device_name: "Matrix-Minecraft Bridge"
# 发送消息的内部房间 ID。
room: "!sdfDsdfsA:matrix.example.org"
# +---------------------------------------------------+
# | |
# | Verification |
# | |
# +---------------------------------------------------+
# 用于启用会话验证和加密的设置。
verification:
# 可以是 KEY、PASSPHRASE 或 DISABLED。所有其他值都将被拒绝。
type: "KEY"
# 用于验证桥接会话的令牌(可以是密钥或短语)。
token: "AaAA aaAa AAaa..."
# +---------------------------------------------------+
# | |
# | Database |
# | |
# +---------------------------------------------------+
# 用于数据库配置的设置。
database:
# 可以是 H2、SQLITE、MARIADB 或 POSTGRESQL。所有其他值都将被拒绝。默认为 H2。
type: "H2"
# 数据库名称。如果类型为 H2 或 SQLITE,则代表文件名。否则,代表要连接的数据库。
name: "database"
# 连接数据库的主机和端口。
hostname: "localhost:3306"
# 数据库登录用户名。仅在使用 MARIADB 和 POSTGRESQL 时使用。
username: "user"
# 数据库登录密码。仅在使用 MARIADB 和 POSTGRESQL 时使用。
password: "pass"
+---------------------------------------------------+
| |
| 命令 |
| |
+---------------------------------------------------+
桥接命令的设置。
commands:
'!list' 命令。列出在线玩家。支持的占位符:%players%
list:
format: "? 在线玩家:%players%"
enabled: true
'!ping' 命令。Bridge 会打印消息以确保连接正常。
ping:
format: "? 收到!"
enabled: true
!invite 命令。将玩家加入白名单。支持的占位符:%player%
invite:
format:
success: "? '%player%' 已被加入白名单!"
error: "? 未找到 '%player%'。用法:!invite <用户名>"
already: "? '%player%' 已在白名单中!"
enabled: false
当执行的命令无效时,发送给 Matrix 的消息。支持的占位符:%commands%
invalid_command: "⛔ 未找到命令!可用命令:%commands%"
当执行被禁用的命令时,发送到 Matrix 的消息。
disabled_command: "⛔ 命令已禁用!请联系管理员。"
+---------------------------------------------------+
| |
| 消息 |
| |
+---------------------------------------------------+
消息格式!部分消息使用占位符。可用占位符在注释中说明。
可用占位符:%player%, %message%, %commands%
messages:
服务器启动时发送的消息。
start:
format: "❇ 服务器已启动"
enabled: true
服务器停止时发送的消息。
stop:
format: "? 服务器已停止"
enabled: true
Minecraft 中查看到的聊天消息格式。支持的占位符:%player%
chat_matrix_to_minecraft:
format: "[§e%player%§r] "
enabled: true
Matrix 上查看到的聊天消息格式。支持的占位符:%player%
chat_minecraft_to_matrix:
format: "<%player%> "
enabled: true
玩家加入服务器时发送到 Matrix 的消息。支持的占位符:%player%
player_join:
format: "? %player% 加入了游戏"
enabled: true
玩家退出服务器时发送到 Matrix 的消息。支持的占位符:%player%
player_quit:
format: "? %player% 离开了游戏"
enabled: true
玩家死亡时发送到 Matrix 的消息。支持的占位符:%message%
player_death:
format: "? %message%"
enabled: true
玩家获得进度时发送到 Matrix 的消息。支持的占位符:%player%, %advancement%
player_advancement:
format: "? %player% 获得了进度 '%advancement%'!"
enabled: true
</details>
# 比冒险更精彩
请确保您使用的是 Java 11 或更高版本,因为该模组在 Java 8 上会崩溃。
截至 2025-08-06,需要为 Fabric Language Kotlin (FLK) 设置依赖覆盖。FLK 需要 Fabric Loader 0.16.9+,但 BTA Babric 无法提供此版本的加载器。必须使用这个新版本的 FLK 才能支持最新的 Matrix 功能(例如房间 v12)。
请将以下文件放入服务器的 config 目录中。
<details>
<summary>Spoiler</summary>
**fabric_loader_dependencies.json**
{
"version": 1,
"overrides": {
"fabric-language-kotlin": {
"-depends": {
"fabricloader": "IGNORED"
}
}
}
}
</details>
? Beta versions for 26.1, 26.2 and 26.3 now available
? If you need any assistance, please reach out in our Matrix Room
? Need a version for Forge? Check out MC Matrix Bridge!
⚠️ Fabric Language Kotlin (FLK) is NO LONGER REQUIRED for v1.5 & up. v1.4 & prior are incompatible with FLK versions newer than 1.13.3+kotlin.2.1.21
☕ 'Better Than Adventure' versions require Java 11 or newer. Dependency override for Fabric Language Kotlin (FLK) is necessary for v1.4 & prior. More information available below.
Matrix Bridge
Matrix Bridge allows users to bridge a Minecraft server's chat with a Matrix room. This mod enables Matrix users to talk with Minecraft players, without logging into the Minecraft world.
This bridge will send server start, server stop, player join, player leave, player death and player chat messages. This bridge also includes bridge commands '!list', '!ping' and '!invite', which allows Matrix-side users to retrieve a player list, ping the server and whitelist a player respectively.
This mod uses password-based login, and supports encrypted rooms and session verification. Additionally, a YAML-based configuration file is available, alongside support for various databases including H2 (default), MariaDB and PostgreSQL.
This mod will be ported to different game versions as requested. Should you wish to submit feedback, request a new port or otherwise need general assistance, please join our support room.
Matrix Bridge is built on MatrixSDK, which uses Trixnity.
Configuration
Spoiler
config.yaml
# +---------------------------------------------------+
# | |
# | Matrix Bridge Configuration |
# | |
# +---------------------------------------------------+
# Please ensure that all values follow the YAML standard.
# Indentation is important! Tabs are not allowed.
# Refer to "https://www.tutorialspoint.com/yaml/" for a detailed explanation.
#
# Improperly set values will default. Integers -> 0, Booleans -> false, Verify Type -> DISABLED, Database Type -> H2.
# Please ensure your values are set properly!
#
# This file is never modified. This file is only written to when it is being generated.
# This file is comment-safe. They will not disappear.
#
# If you need assistance, please join our Matrix room "https://matrix.to/#/#sophie.projects:aenead.net".
# Thank you! <3
# DO NOT MODIFY. Used to detect when you need to update config.
version: 2
# Reveals Trixnity log messages. Useful for debugging.
verbose: false
# +---------------------------------------------------+
# | |
# | Account |
# | |
# +---------------------------------------------------+
# Settings used to sign in to the bot account.
account:
# Synapse URL. Supports delegation.
homeserver: "https://matrix.example.org"
# Account login username. Localpart of user's MXID.
username: "user"
# Account login password. Does not support tokens or SSO.
password: "pass"
# Bridge session device name.
device_name: "Matrix-Minecraft Bridge"
# Internal ID of room to send messages to.
room: "!sdfDsdfsA:matrix.example.org"
# +---------------------------------------------------+
# | |
# | Verification |
# | |
# +---------------------------------------------------+
# Settings used to enable session verification and encryption.
verification:
# Either KEY, PASSPHRASE or DISABLED. All other values will be rejected.
type: "KEY"
# Token (either a key or passphrase) to verify bridge session.
token: "AaAA aaAa AAaa..."
# +---------------------------------------------------+
# | |
# | Database |
# | |
# +---------------------------------------------------+
# Settings used for database configuration.
database:
# Either H2, SQLITE, MARIADB or POSTGRESQL. All other values will be rejected. Default is H2.
type: "H2"
# Name of database. If type is H2 or SQLITE, represents file name. Otherwise, represents database to connect to.
name: "database"
# Host and port to connect to database.
hostname: "localhost:3306"
# Database login username. Only used with MARIADB and POSTGRESQL.
username: "user"
# Database login password. Only used with MARIADB and POSTGRESQL.
password: "pass"
# +---------------------------------------------------+
# | |
# | Commands |
# | |
# +---------------------------------------------------+
# Settings for bridge commands.
commands:
# '!list' command. Lists online players. Supported placeholders: %players%
list:
format: "? Online players: %players%"
enabled: true
# '!ping' command. Bridge prints message to ensure connection.
ping:
format: "? Pong!"
enabled: true
# '!invite' command. Whitelists a player. Supported placeholders: %player%
invite:
format:
success: "? '%player%' has been whitelisted!"
error: "? '%player%' could not be found. Usage: !invite <username>"
already: "? '%player%' is already whitelisted!"
enabled: false
# Message sent to Matrix when a performed command is invalid. Supported placeholders: %commands%
invalid_command: "⛔ Command not found! Available commands: %commands%"
# Message sent to Matrix when a performed command is disabled.
disabled_command: "⛔ Command disabled! Please contact an administrator."
# +---------------------------------------------------+
# | |
# | Messages |
# | |
# +---------------------------------------------------+
# Message formats! Some messages use placeholders. Available placeholders are stated in the comments.
# Available placeholders: %player%, %message%, %commands%
messages:
# Message sent when the server starts.
start:
format: "❇ Server started"
enabled: true
# Message sent when the server stops.
stop:
format: "? Server stopped"
enabled: true
# Chat message format as viewed in Minecraft. Supported placeholders: %player%
chat_matrix_to_minecraft:
format: "[§e%player%§r] "
enabled: true
# Chat message format as viewed on Matrix. Supported placeholders: %player%
chat_minecraft_to_matrix:
format: "<%player%> "
enabled: true
# Message sent to Matrix when a player joins the server. Supported placeholders: %player%
player_join:
format: "? %player% joined the game"
enabled: true
# Message sent to Matrix when a player quits the server. Supported placeholders: %player%
player_quit:
format: "? %player% left the game"
enabled: true
# Message sent to Matrix when a player dies. Supported placeholders: %message%
player_death:
format: "? %message%"
enabled: true
# Message sent to Matrix when a player makes an advancement. Supported placeholders: %player%, %advancement%
player_advancement:
format: "? %player% has made the advancement '%advancement%'!"
enabled: true
Better Than Adventure
Please ensure that you are using Java 11 or newer, as this mod will crash on Java 8.
As of 2025-08-06, a dependency override for Fabric Language Kotlin (FLK) is necessary. FLK requires Fabric Loader 0.16.9+, which is unavailable for BTA Babric. Such a new version of FLK is required to support the most recent Matrix features (such as room v12).
Please place the following file in your server's config directory.
Spoiler
fabric_loader_dependencies.json
{
"version": 1,
"overrides": {
"fabric-language-kotlin": {
"-depends": {
"fabricloader": "IGNORED"
}
}
}
}
评论 0
登录后参与评分
还没有评论,来抢沙发吧