VelocityFailover
当你的后端服务器崩溃或重启时,其上的玩家会被转移到一个临时服务器(limbo),待服务器恢复后,他们会被移回。没有人会看到断开连接的画面。
工作原理
- 某台服务器宕机。Velocity 会以“Server closed”等理由踢出该服务器的玩家。
- 插件检测到这次踢人操作,将该服务器标记为宕机状态,并将玩家转移到 limbo 服务器。
- 在等待期间,玩家的动作栏(action bar)中会显示一个小型旋转加载动画。
- 插件会对宕机的服务器进行 ping 检测,直到其连续响应多次,然后稍作等待,以便其插件完成加载。
- 玩家逐个被移回,以免刚启动的服务器瞬间承受所有玩家连接的压力。
- 任何尝试在服务器宕机期间加入的玩家会收到提示信息。
仅对宕机的服务器进行 ping 检测。当一切正常运行时,插件不会执行任何操作。
正常的踢人操作(如封禁、反作弊拦截等)不受影响。只有匹配 shutdown-keywords 中定义的理由才会被视为服务器崩溃。
要求
- Velocity 4.x
- Java 25
- 在
velocity.toml 中注册的 limbo 服务器,例如 PicoLimbo 或一个空的 Paper 服务器
设置
- 将 jar 文件放入代理服务器的
plugins/ 文件夹,并启动一次代理。
- 打开
plugins/velocityfailover/config.yml,填写你的 limbo 服务器名称以及需要监控的服务器列表。
- 运行
/failoverreload 命令(权限 velocityfailover.reload)或重启代理服务器。
配置
limbo-server: "limbo"
# 需要监控的服务器。分组仅用于保持列表整洁。
groups:
lobby:
servers: ["lobby1", "lobby2"]
spawn:
servers: ["spawn1", "spawn2"]
recovery:
ping-interval-ms: 2000 # 对宕机服务器进行 ping 的频率
pings-to-ready: 3 # 连续响应次数,达到此数值即视为服务器已恢复
grace-period-ms: 5000 # 额外等待时间,供服务器插件完成加载
transfer-interval-ms: 50 # 移动单个玩家之间的间隔时间
ping-timeout-ms: 2000
# 表示服务器宕机的踢人理由,使用“包含”逻辑进行匹配。
shutdown-keywords:
- "Server closed"
- "Server shutting down"
# MiniMessage 格式。动作栏中的 {spinner} 会被替换为当前帧。
messages:
sent-to-limbo: "<red>服务器暂时不可用。返回时将自动为您重新连接。"
reconnecting: "<green>服务器已上线!正在重新连接..."
connection-blocked: "<red>当前服务器不可用。请稍后再试。"
waiting-action-bar: "<yellow>正在连接至服务器 <gray>{spinner}"
action-bar:
interval-ms: 400
spinner-frames: ["[|]", "[/]", "[-]", "[\\]"]
服务器名称必须与 velocity.toml 中的名称完全一致。请勿将 limbo 服务器本身列入监控列表。
注意事项
- 如果在等待期间玩家主动离开,插件会忘记该玩家。当他们再次回来时,由你通常的中枢或回退插件接管处理。
- 如果玩家在等待期间自行前往其他服务器,同样会被忽略。
- 如果在转移过程中服务器再次崩溃,已经转移的玩家将回到 limbo 服务器,整个循环重新开始。
- 这不是中枢插件。它仅处理崩溃和重启情况。
许可证
MIT
VelocityFailover
When one of your backend servers crashes or restarts, players on it are moved to a limbo server, and once the server is back they are moved back. Nobody gets the disconnect screen.
How it works
- A server goes down. Velocity kicks its players with a reason like "Server closed".
- The plugin sees that kick, marks the server as down and sends the player to limbo instead.
- While they wait, a small spinner shows in their action bar.
- The plugin pings the downed server until it answers a few times in a row, then waits a moment so its plugins can load.
- Players are moved back one at a time, so a freshly started server is not hit all at once.
- Anyone trying to join the server while it is down gets a message instead.
Only downed servers are pinged. When everything is running, the plugin does nothing.
Normal kicks (bans, anticheat and so on) are left alone. Only reasons that match shutdown-keywords count as a crash.
Requirements
- Velocity 4.x
- Java 25
- A limbo server registered in
velocity.toml, for example PicoLimbo or an empty Paper server
Setup
- Drop the jar into the proxy's
plugins/ folder and start the proxy once.
- Open
plugins/velocityfailover/config.yml and fill in your limbo server and the servers to watch.
- Run
/failoverreload (permission velocityfailover.reload) or restart the proxy.
Config
limbo-server: "limbo"
# Servers to watch. Groups are only for keeping the list tidy.
groups:
lobby:
servers: ["lobby1", "lobby2"]
spawn:
servers: ["spawn1", "spawn2"]
recovery:
ping-interval-ms: 2000 # how often a downed server is pinged
pings-to-ready: 3 # answers in a row before it counts as back
grace-period-ms: 5000 # extra wait so its plugins finish loading
transfer-interval-ms: 50 # pause between moving one player and the next
ping-timeout-ms: 2000
# Kick reasons that mean the server went down, matched with "contains".
shutdown-keywords:
- "Server closed"
- "Server shutting down"
# MiniMessage. {spinner} in the action bar is replaced with the current frame.
messages:
sent-to-limbo: "<red>The server is temporarily unavailable. You will be moved back automatically when it returns."
reconnecting: "<green>The server is back online! Reconnecting..."
connection-blocked: "<red>This server is currently unavailable. Please try again in a moment."
waiting-action-bar: "<yellow>Connecting to the server <gray>{spinner}"
action-bar:
interval-ms: 400
spinner-frames: ["[|]", "[/]", "[-]", "[\\]"]
Server names must match velocity.toml exactly. Do not list the limbo server itself.
Good to know
- A player who leaves while waiting is forgotten. When they come back, your usual hub or fallback plugin takes over.
- A player who goes somewhere else on their own while waiting is forgotten too.
- If the server dies again mid-transfer, players already moved land back on limbo and the whole cycle starts over.
- This is not a hub plugin. It only handles crashes and restarts.
License
MIT
评论 0
登录后参与评分
还没有评论,来抢沙发吧