Dimension Bridge

插件

· 作者 FoucaultLeon

DimensionBridge 通过 Velocity 命令安全地将玩家从一个已注册的后端服务器传输到另一个。它仅适用于服务端,支持协议受限的目标服务器,且无需客户端模组或 /server 命令权限。

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

需要前置:Fabric API

最新 1.2.2+mc1.20.1 · 1.20.1 · Fabric

一键开服(送7天)

重要提示:你需要同时安装 Minecraft 模组和 Velocity 代理插件,该功能才能正常工作

DimensionBridge 由一个 Velocity 插件和一个配套的服务器端 Fabric 模组组成。命令方块可以通过 /dimensionbridge transfer 发出授权的传输请求。Velocity 会在连接玩家之前验证源服务器、目标服务器、玩家、客户端协议、冷却时间和授权窗口。

它专为传送门、维度之门、维度旅行、大厅菜单和其他沉浸式服务器切换而设计。普通玩家无需访问 /server 或任何桥接权限。

因此,这是一种安全的玩家从一个服务器传送到另一个服务器的方法,并且你可以高度配置哪些“运输路线”是可用的。

例如: 玩家可以从大厅服务器移动到任何世界服务器。但是从世界服务器 1 他只能返回到大厅,而从世界服务器 2 他可以返回到大厅服务器和世界服务器 2a。 通过这种方式,你可以设置复杂的服务器结构。

另一个过滤选项是,你可以根据 Minecraft 协议限制对某些服务器的访问。因此,你的大厅服务器可能对任何 Minecraft 版本开放,但它作为一个枢纽,玩家只能从中连接到适合其当前 Minecraft 版本的服务器。

想象一个电话亭,你可以进入其中,它只显示你用当前的 Minecraft 版本实际可以拨打的号码。使用不同版本的其他玩家会看到不同的号码。

选项几乎是无限的,而且它也是一个安全特性,因为即使玩家获得了一些关于你的基础设施和服务器设置的信息,他们也无法使用这些命令,因为这些命令绑定到模组/管理员级别,而普通传送门在用户级别使用它们的命令。

请告诉我你对使用此功能的想法。

我在观看《比尔和泰德出色的冒险》时产生了这个想法,并希望能有一种安全的方式在服务器/时间段之间切换。

问候,

Jan

DimensionBridge – 安装、配置和命令指南

1. 概述

DimensionBridge 是一个仅存在于服务器端的桥接器,用于连接 Fabric 后端服务器和 Velocity 代理。它允许命令方块、服务器控制台和具有适当特权的命令源将玩家传输到已注册的 Velocity 服务器。

玩家不需要访问 Velocity 的 /server 命令或任何桥接权限。因此,受保护的目标服务器只能通过批准的传送门、电话亭或其他命令方块装置进行访问。

架构

Minecraft 客户端
       │
       ▼
Velocity 代理
└─ DimensionBridge Velocity 插件
       │ 通道: dimensionbridge:transfer
       ▼
Fabric 后端
└─ DimensionBridge Fabric 模组
   └─ 命令方块: dimensionbridge transfer <targets> <server>

不需要客户端模组。


2. 支持的版本

为每个原生 Fabric 服务器版本构建单独的 JAR 文件:

1.20.1  1.20.2  1.20.3  1.20.4  1.20.5  1.20.6
1.21    1.21.1  1.21.2  1.21.3  1.21.4  1.21.5
1.21.6  1.21.7  1.21.8  1.21.9  1.21.10 1.21.11
26.1    26.1.1  26.1.2  26.2

始终使用与该后端服务器的原生版本完全匹配的 Fabric JAR。当选择后端 JAR 时,通过 ViaVersion 转换的客户端版本无关紧要。

运行时 Java 版本

Minecraft 版本 Java
1.20.1–1.20.4 17
1.20.5–1.21.11 21
26.1–26.2 25
current Velocity plugin 25

3. 要求

Velocity

  • 一个 Velocity 代理;
  • Java 25;
  • velocity.toml 中注册的所有后端;
  • 可选 LuckPerms 用于权限管理。

Fabric 后端

  • 与 Minecraft 版本匹配的 Fabric Loader;
  • 与 Minecraft 版本匹配的 Fabric API;
  • 匹配的 DimensionBridge Fabric JAR;
  • 在 server.properties 中启用命令方块:
enable-command-block=true

更改 server.properties 后需要完全重启服务器。


4. 下载源代码

如果你有参与开发的兴趣,请联系我。


5. 安装 Velocity 插件

  1. 完全停止 Velocity。
  2. 将 Velocity JAR 复制到以下位置:
velocity/plugins/dimensionbridge-velocity-<VERSION>.jar
  1. 启动 Velocity。
  2. 首次启动会创建:
plugins/dimensionbridge/dimensionbridge.properties
  1. 编辑该文件。然后你可以使用 /dimensionbridge reload 重新加载它。

代理控制台应包含类似以下的消息:

DimensionBridge loaded. Channel: dimensionbridge:transfer

6. 安装 Fabric 后端模组

对每个后端服务器重复以下步骤:

  1. 完全停止后端。
  2. 将精确匹配的 Fabric JAR 复制到 mods 目录。
  3. 确保已安装 Fabric API。
  4. 在 mods 目录中只保留一个 DimensionBridge JAR。
  5. 启动后端。
  6. 首次启动会创建:
config/dimensionbridge-fabric.properties
  1. 编辑文件并重启后端。

后端控制台应包含类似以下的消息:

DimensionBridge backend <VERSION> loaded. Channel: dimensionbridge:transfer

Fabric 配置目前没有重载命令。对 dimensionbridge-fabric.properties 的更改需要重启后端。


7. Fabric 配置

文件:

config/dimensionbridge-fabric.properties

大厅示例:

allowed-destinations=hauptwelt,hardcore,vanilla

游戏服务器示例,仅允许返回大厅:

allowed-destinations=lobby

允许所有语法有效的目标:

allowed-destinations=*

allowed-destinations

这是各个 Fabric 后端的本地白名单。只有在此处允许请求的目标时,才会向 Velocity 发送传输负载。

  • 多个名称之间用逗号分隔;
  • 名称统一转换为小写;
  • 名称可包含小写字母、数字、_ 和 -;
  • * 允许 Velocity 随后接受的所有语法上有效的目标。

出于安全考虑,请尽可能使用严格的白名单而非 *。


8. Velocity 配置

文件:

plugins/dimensionbridge/dimensionbridge.properties

使用服务器 lobby、hauptwelt、hardcore 和 vanilla 的完整示例:

# 服务器名称必须与 velocity.toml 完全匹配。
# * 允许任何来源或协议。

initial-servers=lobby
deny-unlisted-targets=true
cooldown-ms=2500
authorization-window-ms=5000
bypass-permission=dimensionbridge.bypass

destinations=lobby,hauptwelt,hardcore,vanilla

destination.lobby.display-name=Lobby
destination.lobby.protected=false
destination.lobby.allowed-sources=*
destination.lobby.allowed-protocols=*

destination.hauptwelt.display-name=Main World
destination.hauptwelt.protected=true
destination.hauptwelt.allowed-sources=lobby
destination.hauptwelt.allowed-protocols=MINECRAFT_1_20

destination.hardcore.display-name=Hardcore
destination.hardcore.protected=true
destination.hardcore.allowed-sources=lobby
destination.hardcore.allowed-protocols=MINECRAFT_1_20

destination.vanilla.display-name=Vanilla
destination.vanilla.protected=true
destination.vanilla.allowed-sources=lobby
destination.vanilla.allowed-protocols=MINECRAFT_26_2

全局设置

initial-servers

允许作为初始代理登录服务器的服务器列表(逗号分隔)。

initial-servers=lobby

deny-unlisted-targets

deny-unlisted-targets=true
  • true:未列在 destinations 下的服务器将被拒绝;
  • false:未列出的服务器不受 DimensionBridge 保护规则的限制。

对于封闭的传送门网络,请使用 true。

cooldown-ms

同一玩家两次桥接请求之间的延迟:

cooldown-ms=2500

允许范围:0 到 60,000 毫秒。

authorization-window-ms

DimensionBridge 发起的 Velocity 连接请求保持授权状态的时间窗口:

authorization-window-ms=5000

允许范围:500 到 60,000 毫秒。该值应长于正常的代理到后端连接尝试时间。

bypass-permission

绕过所有 DimensionBridge 保护检查的权限:

bypass-permission=dimensionbridge.bypass

仅授予受信任的管理员。

目的地定义

destinations 中的每个条目需要四个属性:

destinations=lobby,hauptwelt

destination.hauptwelt.display-name=Main World
destination.hauptwelt.protected=true
destination.hauptwelt.allowed-sources=lobby
destination.hauptwelt.allowed-protocols=MINECRAFT_1_20

display-name

在玩家消息中使用的易读名称。

protected

  • true:进入目标需要有效的 DimensionBridge 授权。除非玩家拥有绕过权限,否则直接通过 /server 的连接将被拒绝。
  • false:当协议规则匹配时,允许正常连接。

大厅(Lobby)通常应设置为 protected=false,以确保初始登录和返回旅行保持可靠。

allowed-sources

可以请求此目的地的后端服务器:

destination.hauptwelt.allowed-sources=lobby

多个来源:

destination.hauptwelt.allowed-sources=lobby,hardcore

所有来源:

destination.lobby.allowed-sources=*

allowed-protocols

此目的地接受的 Velocity 客户端协议名称:

destination.hauptwelt.allowed-protocols=MINECRAFT_1_20

多个协议:

destination.hauptwelt.allowed-protocols=MINECRAFT_1_20,MINECRAFT_1_21

所有协议:

destination.lobby.allowed-protocols=*

Minecraft 1.20 和 1.20.1 共享 MINECRAFT_1_20 协议组。

使用以下命令获取已连接客户端的确切 Velocity 名称:

/dimensionbridge protocol <player>

9. 权限

dimensionbridge.admin

允许玩家使用 DimensionBridge 的管理 Velocity 命令。

dimensionbridge.bypass

绕过目的地、来源、协议和传送门授权检查。仅授予受信任的管理员。

velocity.command.server

控制 Velocity 的正常 /server 命令。如果传输只能通过传送门进行,则可以向普通玩家拒绝此权限:

/lp group default permission set velocity.command.server false

管理员可以保留它:

/lp group admin permission set velocity.command.server true

DimensionBridge 不需要 velocity.command.server。

后端命令权限

dimensionbridge transfer 仅在 Fabric 上对控制台、命令方块和具有 Moderator/Command 等级 2 的来源可用。普通玩家无法使用它。不要授予普通玩家操作员或 Moderator 权限。


10. 命令参考

Fabric 后端

转移玩家

/dimensionbridge transfer <targets> <Velocity server name>

在命令方块中省略前导斜杠:

dimensionbridge transfer @p hauptwelt

示例:

# 最近的玩家
dimensionbridge transfer @p hauptwelt

# 三格范围内的最近玩家
dimensionbridge transfer @p[distance=..3,limit=1,sort=nearest] hauptwelt

# 位于一个宽一格、高三格的隔间内的所有玩家
dimensionbridge transfer @a[x=10,y=64,z=5,dx=0,dy=2,dz=0] hauptwelt

# 仅未被标记为处于战斗状态的玩家
dimensionbridge transfer @a[x=10,y=64,z=5,distance=..2,tag=!inCombat] hauptwelt

# 返回大厅
dimensionbridge transfer @p[distance=..3,limit=1,sort=nearest] lobby

Velocity

帮助

/dimensionbridge
/db

重新加载 Velocity 配置

/dimensionbridge reload
/db reload

仅重新加载 Velocity 配置。

显示当前配置

/dimensionbridge info
/db info

输出将显示配置文件路径和已加载的目标服务器。

显示客户端协议版本

/dimensionbridge protocol
/dimensionbridge protocol <player>

如果玩家省略名称,命令将显示该玩家自己的协议版本。


11. 基本功能测试

命令方块设置:

脉冲 (Impulse)
无条件 (Unconditional)
需要红石信号 (Needs Redstone)

命令:

dimensionbridge transfer @p[distance=..3,limit=1,sort=nearest] hauptwelt

站在距离命令方块不超过 3 格的位置并按下按钮。

为了排除半径作为潜在原因的可能性:

dimensionbridge transfer @p hauptwelt

命令方块的先前输出应类似于:

DimensionBridge: sent 1 transfer request(s) to 'hauptwelt'.

当前模组可能会以德语显示此消息;数字和目标部分是关键信息。


12. 示例:大厅电话亭

通往主世界的电话亭

dimensionbridge transfer @p[distance=..3,limit=1,sort=nearest] hauptwelt

通往极限生存世界的电话亭

dimensionbridge transfer @p[distance=..3,limit=1,sort=nearest] hardcore

通往原版世界的电话亭

dimensionbridge transfer @p[distance=..3,limit=1,sort=nearest] vanilla

在每个游戏服务器上返回大厅的电话亭

dimensionbridge transfer @p[distance=..3,limit=1,sort=nearest] lobby

后端上的 Fabric 白名单也必须允许访问该目标服务器。


13. 示例:闪烁效果与倒计时

运行一次:

scoreboard objectives add dimensionTarget dummy
scoreboard objectives add dimensionTimer dummy

主世界启动按钮

脉冲型命令方块:

scoreboard players set @p[distance=..3,limit=1,sort=nearest] dimensionTarget 1

随后的链式命令方块:

scoreboard players set @p[distance=..3,limit=1,sort=nearest] dimensionTimer 60

60 刻大约为三秒。

重复执行的效果方块

重复型、无条件、始终激活:

execute as @a[scores={dimensionTimer=1..}] at @s run particle minecraft:portal ~ ~1 ~ 0.3 0.8 0.3 0.1 10 force

随后的所有链式命令方块(均为始终激活状态):

execute as @a[scores={dimensionTimer=1..}] at @s run particle minecraft:reverse_portal ~ ~1 ~ 0.45 0.9 0.45 0.08 5 force
execute as @a[scores={dimensionTimer=1..}] run title @s actionbar {"text":"Opening dimension …","color":"aqua","italic":true}
execute as @a[scores={dimensionTimer=60}] at @s run playsound minecraft:block.beacon.activate master @s ~ ~ ~ 0.8 0.7
execute as @a[scores={dimensionTimer=20}] at @s run playsound minecraft:block.respawn_anchor.charge master @s ~ ~ ~ 0.8 1.3

必须在计时器值减至 1 之前执行传送:

dimensionbridge transfer @a[scores={dimensionTimer=1,dimensionTarget=1}] hauptwelt

然后:

scoreboard players remove @a[scores={dimensionTimer=2..}] dimensionTimer 1
scoreboard players reset @a[scores={dimensionTimer=1}] dimensionTarget
scoreboard players reset @a[scores={dimensionTimer=1}] dimensionTimer

14. 示例:使用 /trigger 的可点击聊天菜单

运行一次:

scoreboard objectives add dimension trigger
scoreboard objectives add dimensionTarget dummy
scoreboard objectives add dimensionTimer dummy

在显示菜单之前为玩家启用触发器:

scoreboard players enable @p[distance=..3,limit=1,sort=nearest] dimension

以下示例基于原生 Minecraft 1.20.1 大厅使用的文本组件语法:

tellraw @p[distance=..3,limit=1,sort=nearest] [{"text":"☎ Select dimension\n","color":"gold","bold":true},{"text":"[ Main World ]","color":"green","clickEvent":{"action":"run_command","value":"/trigger dimension set 1"}},{"text":"\n"},{"text":"[ Hardcore ]","color":"red","clickEvent":{"action":"run_command","value":"/trigger dimension set 2"}},{"text":"\n"},{"text":"[ Vanilla ]","color":"aqua","clickEvent":{"action":"run_command","value":"/trigger dimension set 3"}}]

JSON 文本组件语法可能在 Minecraft 版本更新之间发生变化。请使用执行命令方块的服务器原生版本所支持的语法。

存储选定的目标:

execute as @a[scores={dimension=1}] run scoreboard players set @s dimensionTarget 1
execute as @a[scores={dimension=2}] run scoreboard players set @s dimensionTarget 2
execute as @a[scores={dimension=3}] run scoreboard players set @s dimensionTarget 3
scoreboard players set @a[scores={dimension=1..3}] dimensionTimer 60
scoreboard players reset @a[scores={dimension=1..3}] dimension

在计时器值为 1 时执行传送:

dimensionbridge transfer @a[scores={dimensionTimer=1,dimensionTarget=1}] hauptwelt
dimensionbridge transfer @a[scores={dimensionTimer=1,dimensionTarget=2}] hardcore
dimensionbridge transfer @a[scores={dimensionTimer=1,dimensionTarget=3}] vanilla

15. 故障排除

命令方块没有任何反应

请验证:

enable-command-block=true

此外:

  • 将方块设置为 脉冲 (Impulse)、无条件 (Unconditional)、需要红石信号 (Needs Redstone);
  • 确保按钮能为方块供电;
  • 启用并查看命令方块的先前输出;
  • 简化选择器以便测试:
dimensionbridge transfer @p hauptwelt

“Unknown or incomplete command”(未知或不完整的命令)

可能的原因包括:

  • 使用了错误的适配原生 Minecraft 版本的 Fabric JAR 文件;
  • DimensionBridge 未成功加载;
  • 缺少 Fabric API;
  • 安装后后端未完全重启。

“Target is not locally allowed”(目标未在本地白名单中)

目标服务器未包含在:

config/dimensionbridge-fabric.properties

示例:

allowed-destinations=hauptwelt,hardcore,vanilla

随后重启后端。

“Unknown dimension identifier or destination”

Velocity 的 destinations 列表中缺少该目的地,或其目的地的属性块缺失。

“Destination server is not registered in the proxy”

服务器名称与 velocity.toml 中的条目不完全匹配。

“This portal may not select this destination”

当前后端未包含在 destination.<target>.allowed-sources 中。

Version denied

检查实际的客户端协议:

/dimensionbridge protocol <player>

使用显示的常量填入 allowed-protocols。

Direct /server is denied

对于设置了 protected=true 的目标,这是预期行为。请使用传送门,或向管理员授予 dimensionbridge.bypass 权限。

Configuration changes are not applied

  • Velocity 配置:执行 /dimensionbridge reload
  • Fabric 配置:完整重启后端

No payload reaches Velocity

请验证:

  • 选定的玩家当前正连接至发送端后端;
  • 代理端和后端均安装了匹配的 DimensionBridge 版本;
  • 两端均使用频道 dimensionbridge:transfer;
  • 未残留旧版 TelephoneBridge 或重复安装的 DimensionBridge JAR。

16. Recommended Security Configuration

Velocity:

deny-unlisted-targets=true

游戏世界:

destination.hauptwelt.protected=true
destination.hardcore.protected=true
destination.vanilla.protected=true

大厅:

destination.lobby.protected=false

LuckPerms:

/lp group default permission set velocity.command.server false

保持 Fabric 白名单精简:

# Lobby
allowed-destinations=hauptwelt,hardcore,vanilla
# Game worlds
allowed-destinations=lobby

17. Updating

  1. 停止代理端及所有后端。
  2. 移除旧的 DimensionBridge JAR 文件。
  3. 安装新的 Velocity JAR 文件。
  4. 为每个后端安装与其确切原生 Minecraft 版本匹配的 JAR 文件。
  5. 切勿同时加载两个不同版本的 DimensionBridge。
  6. 备份配置文件。
  7. 重启代理端和所有后端。
  8. 测试 /dimensionbridge info 命令以及一个基本的命令方块传输功能。

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

评论 0

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

登录后参与评分

还没有评论,来抢沙发吧

评论配图

相似资源