VelocityPteroPower
<br>
<i>如果您有问题或需要支持,请加入 Discord 服务器!</i>
[!NOTE]
关于本项目中的 AI 使用。 我构建了自动化测试套件(即 e2e/ 下的单元测试和实时面板 E2E 设置),并在 AI 的帮助下撰写了大部分文档。我已阅读并检查了所有内容,且测试针对真实的 Pterodactyl、Pelican 和 Calagopus 面板运行。该插件本身仍是我的项目,如果测试或文档中有任何错误,请提交 Issue。
Agents Cursor 和 Clause 之所以只提交了这么多行代码,是因为我使用它们来提交我在过去几个月里编写但未自行提交的代码块,结果后来迷失了进度。
VelocityPteroPower (VPP) 将您的 Velocity 代理与 Pterodactyl、Pelican Panel、Calagopus 或 Mc Server Soft 连接起来。当玩家尝试加入时启动游戏服务器,并在一段时间无人游玩后停止它。
您的代理上需要 Velocity 4.3+ 和 Java 25。自 0.9.6 版本起不再支持 Velocity 3.x。
文档页面 详细介绍了配置、命令和权限。
功能
面板
- Pterodactyl (
ptlc_ 键)、Pelican (plcn_ / pacc_)、Calagopus (c7sp_) 和 Mc Server Soft(任何其他键)。VPP 从键前缀中识别面板类型。
- 通过面板 WebSocket 获取实时服务器状态,因此 VPP 无需为每次检查轮询 API。您可以通过
panelWebSocketEnabled: false 关闭此功能。
- 尊重面板的速率限制。在 HTTP 429 响应时,VPP 会等待
Retry-After 头,并优先暂停后台请求。
- 三种判断服务器就绪状态的方式:
VELOCITY_PING、PANEL_API 或 HYBRID(两者兼用)。您可以全局设置或按服务器单独设置。
启动与停止
- 玩家连接到离线服务器时会触发启动。他们会在 limbo 或大厅等待,直到服务器上线且经过
startupJoinDelay 时间后被转移进去。
- 多个玩家请求同一台服务器时,共享一次启动过程和同一个队列。
- 空闲服务器会在其
timeout 后停止。设置 timeout: -1 可让服务器永不自动停止。idleStartShutdownTime 用于停止那些已启动但实际没有任何人加入的服务器。
alwaysOnline 类型的服务器会在代理启动时启动,并在宕机时重启。
maxOnlineServers 限制同时运行的托管服务器数量。玩家会进入队列等待槽位(如果 queueWhenMaxOnline: false 则会被拒绝)。支持预留、免控服务器以及 ptero.maxcap.bypass 权限。
- 启动超时策略(
CANCEL 或 KEEP_STARTING)、后端在启动期间踢出玩家时的软重新排队,以及每位玩家的启动冷却时间。
- 持久化队列:在等待期间断开的玩家,如果在
persistentQueueTtlSeconds 时间内重新连接,会被放回队列中。
lifecycle.shutdownOnProxyExit 可在代理关闭时停止指定的服务器(或 all 全部服务器)。
大厅与 Limbo
- 支持多个大厅和 Limbo 服务器,可通过
ROUND_ROBIN、LEAST_PLAYERS 或 LEAST_CPU 进行负载均衡。
- 大厅自动扩缩容。VPP 会在达到容量
preStartThresholdPercent 时启动额外的大厅,保持 minOnline 数量的在线,并在空转超过 scaleDownIdleSeconds 后停止多余的大厅。
- 可配置强制主机加入离线服务器时的行为:
DISCONNECT、LOBBY_OR_LIMBO 或 LIMBO_ONLY。
访问控制
- 从面板获取每台服务器的
whitelist.json 并在启动前强制执行。使用 /ptero whitelistReload 重载,或通过 ptero.bypass 权限跳过。
- 一次性启动密码作为白名单的替代方案(
startPassword、/ptero unlock、/ptero password)。
- 内置维护模式,支持全局或按服务器设置(
/ptero maintenance)。VPP 还能检测 kennytv/Maintenance 并予以尊重。
服务器组
- 处于同一组(或
linkedServers)的服务器会一起启动。空闲关闭会等待整个组完全清空后才执行。
配置
- 命名
profiles 供服务器继承,并可针对超时、轮询间隔和状态检查方法进行单服务器覆盖。
- 旧配置文件会自动迁移,并保留您的
servers 部分。
- 提供英文和德文消息(
languageOverride: auto | en_US | de_DE)。
- 来自 Modrinth 的更新通知(
checkUpdate)。
插件扩展 (Addons)
- 由 VPP 管理的即插即用插件 JAR,并提供游戏内目录(
/ptero addon browse)。官方插件涵盖 Webhook、定时任务计划和持久化移动审计等功能。
- 提供包含
RoutingProvider 和 MaintenanceProvider 钩子的开发者 API,以便其他插件或扩展可以改变玩家去向或阻止冷启动。
安装
- 从 Modrinth 下载最新的
.jar 文件。
- 将其放入您的 Velocity
plugins 文件夹中。
- 重启 Velocity。
- 编辑
plugins/velocity-ptero-power/config.yml。文档页面 解释了每个选项的用法。
命令
/ptero start <server>
/ptero stop <server>
/ptero restart <server>
/ptero list
/ptero info <server>
/ptero api 和 /ptero apithreads 显示速率限制和线程池状态
/ptero queue 显示你自己的队列位置,或者如果你有 ptero.list 或 ptero.reload 权限则显示所有队列
/ptero history [player|uuid] 当 moveHistory.enabled 开启时显示最近的服务器迁移记录(仅保存在内存中)
/ptero unlock <server> <password>
/ptero password <set|generate|clear|status> <server>
/ptero maintenance [server|global] <on|off> (通过设置 maintenance.builtinEnabled: false 关闭内置模式)
/ptero addon [list|browse|info|install|uninstall|enable|disable|reload|update]
/ptero reload
/ptero whitelistReload
/ptero stopidle
/ptero forcestopall [confirm]
/ptero forcestartall [confirm]
安装附加组件后的附加组件命令:
/ptero webhook test|reload (Webhooks)
/ptero schedule list|reload (调度器)
/ptero audit ... (迁移历史记录,保存到磁盘)
/ptero greet, /ptero sampleinfo 以及更多(示例附加组件)
权限
核心权限:
ptero.start, ptero.stop, ptero.restart
ptero.list
ptero.info (也适用于 /ptero api 和 /ptero apithreads)
ptero.history
ptero.maintenance
ptero.password (管理启动密码)
ptero.password.bypass (无需解锁即可启动受密码保护的服务器)
ptero.addon (查看附加组件和目录)
ptero.addon.install (从目录安装或更新)
ptero.addon.manage (启用、禁用、重载、卸载)
ptero.whitelistReload
ptero.reload
ptero.stopIdle
ptero.forcestopall, ptero.forcestartall
ptero.bypass (跳过 VPP 白名单检查,如果启用了 whitelistAllowBypass)
ptero.maxcap.bypass (在 maxOnlineServers 已满时启动服务器,如果启用了 maxOnlineAllowBypass)
/ptero queue 和 /ptero unlock 不需要任何权限。
官方附加组件:
vpp.webhooks.test
vpp.scheduler.manage
vpp.audit.use, vpp.audit.manage
vpp.sample.* (示例附加组件)
开发者 API 和附加组件
该仓库是一个 Maven 多模块构建项目:
| 模块 |
构件 ID |
用途 |
vpp-api |
de.tubyoub:vpp-api |
面向附加组件的公共 API |
vpp-plugin |
de.tubyoub:velocitypteropower |
Velocity 插件(使用 *-shaded.jar) |
addons/sample |
de.tubyoub:vpp-addon-sample |
示例附加组件 |
addons/webhooks |
de.tubyoub:vpp-addon-webhooks |
Discord 和通用 JSON Webhooks |
addons/scheduler |
de.tubyoub:vpp-addon-scheduler |
基于 Cron 的启动和停止任务 |
addons/move-history |
de.tubyoub:vpp-addon-move-history |
持久化的连接和切换审计记录(/ptero audit) |
vpp-test-bridge |
|
仅供测试使用的 Velocity 插件,由 E2E 套件使用。请勿安装在真实的代理服务器上。 |
构建:
mvn -pl vpp-plugin -am package # 主插件
mvn -pl addons/sample -am package # 单个附加组件
mvn package # 插件、所有附加组件以及测试桥接插件
附加组件是 VPP 自行加载的 JAR 文件。它们不是独立的 Velocity 插件。实现 de.tubyoub.vpp.api.VPPAddon 接口,在 META-INF/services/de.tubyoub.vpp.api.VPPAddon 中注册它,依赖带有 provided 范围的 vpp-api,并将 JAR 放入 plugins/velocity-ptero-power/addons/ 目录中。
每个附加组件的配置文件位于 plugins/velocity-ptero-power/addons/configs/<addonId>.yml,其数据存储在 addons/data/<addonId>/ 中。执行 /ptero addon reload 会重新读取配置文件,因此手动编辑的内容会保留下来。
<dependency>
<groupId>de.tubyoub</groupId>
<artifactId>vpp-api</artifactId>
<version>0.9.6-beta</version>
<scope>provided</scope>
</dependency>
官方目录位于 catalog/addons.json,托管在 dev 分支上。你可以在 config.yml 中使用 addons.extraCatalogUrls 或 addons.extraEntries 添加自定义目录。
/ptero addon install ... 从 GitHub 滚动更新的 nightly 预发布版本下载。CI 会在每次推送时重建该预发布版本。
- Webhooks、调度器和迁移历史记录各自拥有独立的 Modrinth 项目以支持浏览器下载。示例附加组件仅在本地构建。
- VPP 在启动时会扫描附加组件文件夹。你放入其中的 JAR 文件将在下次重启后出现在
/ptero addon browse 的已安装列表中。
测试
mvn test 会在几秒钟内运行单元测试和面板契约测试,无需 Docker。
e2e/run-live-e2e.sh <pterodactyl|pelican|calagopus|all> 会在 Docker 中启动一个真实的面板、Wings、六个 Minecraft 服务器、Velocity 以及机器人玩家,然后针对它们运行 30 个场景。详细信息及覆盖范围列表请参阅 e2e/README.md。
支持
如有 Bug、想法或问题,请在 GitHub 上提交 Issue 或加入 Discord。
贡献
想要提供帮助?请通过 Discord 与我们交流,或者直接发送拉取请求。
许可证
MIT,详见 LICENSE。

VelocityPteroPower
<br>
<i>Please join the Discord if you have questions or for support!</i>
[!NOTE]
About AI use in this project. I built the automated test suite (the unit tests and the live panel E2E setup under e2e/) and wrote large parts of the documentation with the help of AI. I read and checked what went in, and the tests run against real Pterodactyl, Pelican and Calagopus panels. The plugin itself is still my project, and if something in the tests or docs looks wrong, please open an issue.
The Agents Cursor and Clause only have this many lines committed because i used them to commit large chunks of code i wrote over the last few months and then didnt commit myself and well lost track of it.
VelocityPteroPower (VPP) connects your Velocity proxy to Pterodactyl, Pelican Panel, Calagopus or Mc Server Soft. It starts a game server when a player tries to join it and stops it again once nobody has played on it for a while.
You need Velocity 4.3+ and Java 25 on the proxy. Velocity 3.x is not supported since 0.9.6.
The docs page covers configuration, commands and permissions in detail.
Features
Panels
- Pterodactyl (
ptlc_ keys), Pelican (plcn_ / pacc_), Calagopus (c7sp_) and Mc Server Soft (any other key). VPP picks the panel type from the key prefix.
- Live server state over the panel WebSocket, so VPP doesn't have to poll the API for every check. You can turn it off with
panelWebSocketEnabled: false.
- Respects the panel's rate limits. On an HTTP 429 VPP waits for
Retry-After and pauses background requests first.
- Three ways to decide if a server is ready:
VELOCITY_PING, PANEL_API or HYBRID (both). You can set this globally or per server.
Starting and stopping
- A player connecting to an offline server starts it. They wait on a limbo or lobby and get moved over once it's up and
startupJoinDelay has passed.
- Several players asking for the same server share one start and one queue.
- Idle servers stop after their
timeout. Set timeout: -1 to never stop a server. idleStartShutdownTime stops servers that were started but nobody actually joined.
alwaysOnline servers are started at boot and restarted if they go down.
maxOnlineServers caps how many managed servers can run at once. Players queue for a slot (or get refused with queueWhenMaxOnline: false). Reservations, exempt servers and ptero.maxcap.bypass are supported.
- Startup timeouts with a policy (
CANCEL or KEEP_STARTING), a soft requeue if the backend kicks a player during startup, and a per-player start cooldown.
- A persistent queue: players who disconnect while waiting are put back in line when they reconnect, within
persistentQueueTtlSeconds.
lifecycle.shutdownOnProxyExit stops chosen servers (or all) when the proxy shuts down.
Lobbies and limbos
- Several lobbies and limbos, balanced by
ROUND_ROBIN, LEAST_PLAYERS or LEAST_CPU.
- Lobby auto scaling. VPP starts another lobby at
preStartThresholdPercent of capacity, keeps minOnline running, and stops extra lobbies that sit empty for scaleDownIdleSeconds.
- What happens to a forced-host join on an offline server is configurable:
DISCONNECT, LOBBY_OR_LIMBO or LIMBO_ONLY.
Access control
- Fetch each server's
whitelist.json from the panel and enforce it before a start. Reload with /ptero whitelistReload, skip with ptero.bypass.
- Single-use start passwords as an alternative to the whitelist (
startPassword, /ptero unlock, /ptero password).
- Built-in maintenance mode, global or per server (
/ptero maintenance). VPP also detects kennytv/Maintenance and respects it.
Server groups
- Servers in a group (or
linkedServers) start together. Idle shutdown waits until the whole group is empty.
Configuration
- Named
profiles that servers can inherit from, and per-server overrides for timeouts, poll intervals and the status check method.
- Old config files are migrated automatically and keep your
servers section.
- Messages in English and German (
languageOverride: auto | en_US | de_DE).
- Update notifications from Modrinth (
checkUpdate).
Addons
- Drop-in addon JARs managed by VPP, with an in-game catalog (
/ptero addon browse). Official addons cover webhooks, cron schedules and a persistent move audit.
- A developer API with
RoutingProvider and MaintenanceProvider hooks so addons or other plugins can change where players go or block cold starts.
Installation
- Download the latest
.jar from Modrinth.
- Put it in your Velocity
plugins folder.
- Restart Velocity.
- Edit
plugins/velocity-ptero-power/config.yml. The docs page explains every option.
Commands
/ptero start <server>
/ptero stop <server>
/ptero restart <server>
/ptero list
/ptero info <server>
/ptero api and /ptero apithreads show rate limit and thread pool status
/ptero queue shows your own queue position, or every queue if you have ptero.list or ptero.reload
/ptero history [player|uuid] shows recent server moves when moveHistory.enabled is on (kept in memory only)
/ptero unlock <server> <password>
/ptero password <set|generate|clear|status> <server>
/ptero maintenance [server|global] <on|off> (turn the built-in mode off with maintenance.builtinEnabled: false)
/ptero addon [list|browse|info|install|uninstall|enable|disable|reload|update]
/ptero reload
/ptero whitelistReload
/ptero stopidle
/ptero forcestopall [confirm]
/ptero forcestartall [confirm]
Addon commands, when the addon is installed:
/ptero webhook test|reload (webhooks)
/ptero schedule list|reload (scheduler)
/ptero audit ... (move-history, saved to disk)
/ptero greet, /ptero sampleinfo and a few more (sample addon)
Permissions
Core:
ptero.start, ptero.stop, ptero.restart
ptero.list
ptero.info (also /ptero api and /ptero apithreads)
ptero.history
ptero.maintenance
ptero.password (manage start passwords)
ptero.password.bypass (start password-protected servers without unlocking)
ptero.addon (view addons and the catalog)
ptero.addon.install (install or update from the catalog)
ptero.addon.manage (enable, disable, reload, uninstall)
ptero.whitelistReload
ptero.reload
ptero.stopIdle
ptero.forcestopall, ptero.forcestartall
ptero.bypass (skip VPP whitelist checks, if whitelistAllowBypass is on)
ptero.maxcap.bypass (start a server while maxOnlineServers is full, if maxOnlineAllowBypass is on)
/ptero queue and /ptero unlock need no permission.
Official addons:
vpp.webhooks.test
vpp.scheduler.manage
vpp.audit.use, vpp.audit.manage
vpp.sample.* (sample addon)
Developer API and addons
The repo is a Maven multi-module build:
| Module |
Artifact |
Purpose |
vpp-api |
de.tubyoub:vpp-api |
Public API for addons |
vpp-plugin |
de.tubyoub:velocitypteropower |
The Velocity plugin (use the *-shaded.jar) |
addons/sample |
de.tubyoub:vpp-addon-sample |
Example addon |
addons/webhooks |
de.tubyoub:vpp-addon-webhooks |
Discord and generic JSON webhooks |
addons/scheduler |
de.tubyoub:vpp-addon-scheduler |
Cron-based start and stop |
addons/move-history |
de.tubyoub:vpp-addon-move-history |
Persistent connect and switch audit (/ptero audit) |
vpp-test-bridge |
|
Test-only Velocity plugin used by the E2E suite. Don't install it on a real proxy. |
Build:
mvn -pl vpp-plugin -am package # main plugin
mvn -pl addons/sample -am package # one addon
mvn package # plugin, all addons and the test bridge
Addons are JARs that VPP loads itself. They are not separate Velocity plugins. Implement de.tubyoub.vpp.api.VPPAddon, register it in META-INF/services/de.tubyoub.vpp.api.VPPAddon, depend on vpp-api with provided scope, and drop the JAR into plugins/velocity-ptero-power/addons/.
Each addon's config is plugins/velocity-ptero-power/addons/configs/<addonId>.yml, and its data goes in addons/data/<addonId>/. /ptero addon reload re-reads the config file, so hand edits survive.
<dependency>
<groupId>de.tubyoub</groupId>
<artifactId>vpp-api</artifactId>
<version>0.9.6-beta</version>
<scope>provided</scope>
</dependency>
The official catalog is catalog/addons.json, served from the dev branch. You can add your own with addons.extraCatalogUrls or addons.extraEntries in config.yml.
/ptero addon install ... downloads from the rolling GitHub nightly prerelease. CI rebuilds that prerelease on every push.
- Webhooks, scheduler and move-history each have their own Modrinth project for browser downloads. The sample addon is only built locally.
- VPP scans the addons folder at startup. A JAR you drop in shows up as installed in
/ptero addon browse after the next restart.
Testing
mvn test runs the unit and panel contract tests in a few seconds, no Docker needed.
e2e/run-live-e2e.sh <pterodactyl|pelican|calagopus|all> spins up a real panel, Wings, six Minecraft servers, Velocity and bot players in Docker, then runs 30 scenarios against them. e2e/README.md has the details and the list of what's covered.
Support
For bugs, ideas or questions, open an issue on GitHub or join the Discord.
Contributing
Want to help? Talk to us on Discord or send a pull request.
License
MIT, see LICENSE.

评论 0
登录后参与评分
还没有评论,来抢沙发吧