spvelocity

一个允许你将Velocity用作Spigot插件的插件。

资源图片
Spvelocity — 一个 Paper / Spigot 插件,**下载并启动 Velocity 代理** ------------------------------------------------------------------------------------ ![Java](https://img.shields.io/badge/Java-21-blue) ![Paper](https://img.shields.io/badge/Paper-1.21.x-green) ![License](https://img.shields.io/badge/License-MIT-lightgrey) --- ## 什么是它? Spvelocity 是一个 Paper / Spigot 插件,它可以自动: 1. 从给定的 URL 下载 Velocity jar 2. 在单独的进程中启动 Velocity 3. 允许你在游戏内/控制台中通过 `/proxy start|stop|status` 控制它 非常适合快速网络测试、CI 管道或临时测试服务器。 --- ## 特点 * 首次执行 `/proxy start` 时自动**下载** `velocity.jar` * 在 Paper / Spigot 1.12 – 最新版本中运行 (基于 1.21.4 API 构建) * 只需要 Java 11+, 推荐 Java 17 或 21 * 在后台线程中运行 – 不会阻塞主服务器 * 当 Paper 服务器停止时自动停止 Velocity * 通过 `plugins/Spvelocity/config.yml` 简单配置 --- ## 要求 * 一个 Paper 或 Spigot 服务器 (1.12 – 最新版本,基于 Paper-1.21.4 构建) * Java 11 或更高版本 (Velocity 本身需要 11+) * 首次运行 `/proxy start` 时需要 Internet 访问 (用于下载 Velocity) --- ## 快速开始 (预构建 jar) 1. 从 Releases 页面下载 `spvelocity--shaded.jar` 2. 将它放入 `/plugins` 3. 使用 **Java 17 / 21** 等启动你的 Paper / Spigot 服务器 4. 在游戏中或控制台中运行: ```text /proxy start ``` → `velocity.jar` 下载到 `plugins/Spvelocity/proxy/` 并启动在端口 25577 上 --- ## 从源代码构建 ```bash git clone https://github.com//spvelocity.git cd spvelocity mvn clean package # 产生 target/spvelocity-*-shaded.jar ``` --- ## 配置 — `config.yml` ```yml velocity: download-url: "https://api.papermc.io/v2/projects/velocity/versions/3.3.0-SNAPSHOT/builds/261/downloads/velocity-3.3.0-SNAPSHOT-261.jar" jar-name: "velocity.jar" port: 25577 ``` * 从 PaperMC 的下载页面复制下载 URL: * 稳定版本 (`3.2.0` 等) 保留相同的 URL。 * 对于 SNAPSHOT 版本,你可能需要一个脚本来查询 API 以获取最新版本或者手动更新 URL。 --- ## 命令 & 权限 | 命令 | 描述 | 权限 | 默认 | |--------------------|-------------------------------------|-------------------------|---------| | `/proxy start` | 下载 & 启动 Velocity | `spvelocity.command` | OP | | `/proxy stop` | 停止运行的 Velocity 实例 | `spvelocity.command` | OP | | `/proxy status` | 显示代理状态 | `spvelocity.command` | OP | --- ## 工作原理 1. `SpvelocityManager` 检查 `plugins/Spvelocity/proxy/velocity.jar` 是否存在 2. 如果不存在,它将通过 **Apache Commons IO** 从配置的 URL 下载它 3. 通过 **ProcessBuilder** 运行 `java -jar velocity.jar --port ` 4. 将代理输出重定向到 Paper 控制台 5. 当 Paper 服务器关闭时,子进程通过 `destroy()` 销毁 --- ## 许可证 MIT 许可证 — 详情请参阅 `LICENSE`。 Fork、修改、重新分发、享受吧!