MultiFabricServer
实验性的 Fabric 服务端模组,用于在一个 JVM 内运行多个按需加载的 Minecraft 服务器实例(称为集群)。
玩家可使用 /cluster travel <目标> 或 /cluster tp <目标> 在主机与集群节点之间移动。节点按需启动,并在空闲时间超过配置的延迟后自动停止运行。玩家列表、在线人数、聊天内容、加入/离开提示、进度解锁消息以及命令反馈会在所有正在运行的集群间共享。
Velocity 模式与独立模式
该模组可以在没有 Velocity 的情况下运行。在独立模式下,使用 Minecraft 传输数据包;对于公共服务器,则使用内置网关:
{
"enabled": true,
"gatewayEnabled": true,
"transferHost": "play.example.com",
"gatewayBindHost": "0.0.0.0",
"gatewayBindPort": 25565,
"nodeIdleStopSeconds": 300,
"nodes": [
{
"id": "creative",
"worldName": "creativeworld",
"enabled": true
}
]
}
通过此配置,网关将在 gatewayBindPort 端口监听,并将玩家转发至主机或其目标惰性集群。主机 Minecraft 服务器必须监听不同的端口(例如 25566),因为网关占用公共端口。
Velocity 仍可用于扩展功能,例如在切换时保留聊天界面/历史记录。安装本仓库构建的 Velocity 配套插件后,velocity.toml 中只需配置主机服务器即可。
当启用 seamlessProxySwitchEnabled 时,Fabric 模组会在发送 Velocity 的常规 Connect 插件消息之前,立即向配套插件发送动态后端注册信息。这使得新创建的集群无需手动将每个集群添加到 velocity.toml 中即可正常工作。
如果没有配套的 Velocity 插件,seamlessProxySwitchEnabled 仍需要在 Velocity 中注册每个目标集群的名称。如果 Velocity 仅配置了主机服务器且你不需要配套插件,请禁用 seamlessProxySwitchEnabled 并改用 transfer/gateway 路径。
配置文件
首次启动服务器时,此文件将在活动世界根目录生成:
multifabricserver-cluster.json
默认内容为禁用状态,可安全编辑:
{
"enabled": false,
"gatewayEnabled": false,
"seamlessProxySwitchEnabled": false,
"proxyHostServerName": "host",
"transferHost": "127.0.0.1",
"gatewayBindHost": "0.0.0.0",
"gatewayBindPort": 25565,
"nodeIdleStopSeconds": 300,
"nodes": [
{
"id": "creative",
"worldName": "creativeworld",
"enabled": true
}
]
}
proxyServerName 对每个节点而言是可选的。若省略,无缝 Velocity 模式将回退使用节点 ID 作为 Velocity 服务器名称。
Velocity 配套插件
构建 Fabric 模组和 Velocity 配套插件:
./gradlew clean build
安装:
build/libs/multifabricserver-mc26.1-1.0.0.jar -> Fabric server mods/
velocity/build/libs/multifabricserver-velocity-1.0.0.jar -> Velocity plugins/
然后在 velocity.toml 中仅保留后端主机,例如:
[servers]
host = "127.0.0.1:25566"
try = ["host"]
集群节点可以省略 proxyServerName;节点 ID 将成为动态 Velocity 服务器名称。
命令
/cluster status
/cluster players
/cluster reload
/cluster enable
/cluster enable <node>
/cluster disable
/cluster disable <node>
/cluster start <node>
/cluster stop <node>
/cluster remove <node>
/cluster travel <host|node>
/cluster tp <host|node>
管理员命令需要命令级别的 GAMEMASTERS 权限。
开发
构建:
./gradlew clean build
当前本地测试循环:
./gradlew clean build && cp build/libs/multifabricserver-mc26.1-1.0.0.jar server-test/mods/ && cp velocity/build/libs/multifabricserver-velocity-1.0.0.jar server-test/velocity/plugins/ && docker compose -f server-test/docker-compose.yml down && docker compose -f server-test/docker-compose.yml up
MultiFabricServer
Experimental Fabric server-side mod for running multiple lazy-loaded Minecraft server instances, called clusters, inside one JVM.
Players use /cluster travel <target> or /cluster tp <target> to move between the host and cluster nodes. Nodes start on demand and stop after they have been empty for the configured idle delay. Player list, player count, chat, join/leave messages, advancement messages, and command feedback are shared across running clusters.
Velocity And Standalone Modes
The mod can run without Velocity. In standalone mode, use Minecraft transfer packets and, for a public server, the built-in gateway:
{
"enabled": true,
"gatewayEnabled": true,
"transferHost": "play.example.com",
"gatewayBindHost": "0.0.0.0",
"gatewayBindPort": 25565,
"nodeIdleStopSeconds": 300,
"nodes": [
{
"id": "creative",
"worldName": "creativeworld",
"enabled": true
}
]
}
With this setup, the gateway listens on gatewayBindPort and forwards players to the host or their target lazy cluster. The host Minecraft server must listen on a different port, for example 25566, because the gateway owns the public port.
Velocity can still be used for extended behavior such as preserving chat UI/history during switches. Install the companion Velocity plugin built by this repo and Velocity only needs the host server in velocity.toml.
When seamlessProxySwitchEnabled is enabled, the Fabric mod sends the companion plugin a dynamic backend registration immediately before it sends Velocity's normal Connect plugin message. That lets newly-created clusters work without manually adding each cluster to velocity.toml.
Without the companion Velocity plugin, seamlessProxySwitchEnabled still requires each target cluster name to be registered in Velocity. If Velocity only has the host server configured and you do not want the companion plugin, disable seamlessProxySwitchEnabled and use the transfer/gateway path instead.
Config File
On first server start, this file is generated in the active world root:
multifabricserver-cluster.json
Default content is disabled and safe to edit:
{
"enabled": false,
"gatewayEnabled": false,
"seamlessProxySwitchEnabled": false,
"proxyHostServerName": "host",
"transferHost": "127.0.0.1",
"gatewayBindHost": "0.0.0.0",
"gatewayBindPort": 25565,
"nodeIdleStopSeconds": 300,
"nodes": [
{
"id": "creative",
"worldName": "creativeworld",
"enabled": true
}
]
}
proxyServerName is optional per node. If omitted, seamless Velocity mode falls back to the node id as the Velocity server name.
Velocity Companion Plugin
Build both the Fabric mod and Velocity companion plugin:
./gradlew clean build
Install:
build/libs/multifabricserver-mc26.1-1.0.0.jar -> Fabric server mods/
velocity/build/libs/multifabricserver-velocity-1.0.0.jar -> Velocity plugins/
Then keep only the host backend in velocity.toml, for example:
[servers]
host = "127.0.0.1:25566"
try = ["host"]
Cluster nodes can omit proxyServerName; the node id becomes the dynamic Velocity server name.
Commands
/cluster status
/cluster players
/cluster reload
/cluster enable
/cluster enable <node>
/cluster disable
/cluster disable <node>
/cluster start <node>
/cluster stop <node>
/cluster remove <node>
/cluster travel <host|node>
/cluster tp <host|node>
Admin commands require command-level GAMEMASTERS.
Development
Build:
./gradlew clean build
Current local test loop:
./gradlew clean build && cp build/libs/multifabricserver-mc26.1-1.0.0.jar server-test/mods/ && cp velocity/build/libs/multifabricserver-velocity-1.0.0.jar server-test/velocity/plugins/ && docker compose -f server-test/docker-compose.yml down && docker compose -f server-test/docker-compose.yml up
评论 0
登录后参与评分
还没有评论,来抢沙发吧