Velocitypacker
一款 Velocity 插件,可自动向玩家发送资源包并将其接受状态存储在 SQLite 数据库中。
✨ 功能特性
- ? 自动发送资源包 - 每次代理连接时发送资源包
- ? SQLite 数据库 - 持久化存储接受状态
- ? 智能拦截 - 在资源包被接受或拒绝之前,玩家无法连接到服务器
- ⚡ 自动连接 - 成功接受后自动连接到第一个服务器
- ? 会话管理 - 在后端服务器之间切换时不会重新发送
- ?️ YAML 配置 - 轻松自定义所有设置
- ? 详细日志 - 提供关于资源包状态的全面信息
? 安装
1. 下载插件
# 克隆仓库
git clone https://github.com/TheLion102009/Velocitypacker.git
cd Velocitypacker
# 构建插件
./gradlew clean shadowJar
2. 安装 JAR
编译后的 JAR 文件位于 build/libs/Velocitypacker-0.1.jar。
将此文件复制到你的 Velocity 服务器的 plugins/ 文件夹中。
3. 启动服务器
重启你的 Velocity 服务器。配置文件将自动创建。
⚙️ 配置
config.yml 会自动创建在 plugins/velocitypacker/ 文件夹中:
# 资源包 URL(必需)
# 必须是 .zip 文件的直接下载链接
resourcePackUrl: https://example.com/resourcepack.zip
# 资源包的 SHA-1 哈希值(可选)
# 格式:40 位十六进制字符(例如 a1b2c3d4e5f6...)
# 如果不想使用哈希值,请留空
resourcePackSha1: ""
# 显示给玩家的消息
# 支持带有 § 的 Minecraft 颜色代码
resourcePackPrompt: "§a请接受资源包以进行游戏!"
# 如果资源包被拒绝则踢出玩家
kickOnDecline: true
# 如果下载失败则踢出玩家
kickOnFailedDownload: true
# 踢出消息(支持带有 § 的颜色代码)
kickMessage: "§c你必须接受资源包才能进行游戏!"
生成 SHA-1 哈希值
Windows:
certutil -hashfile resourcepack.zip SHA1
Linux/Mac:
sha1sum resourcepack.zip
? 工作原理
玩家加入流程:
- 玩家连接到代理 → 立即发送资源包
- 服务器连接被阻止 → 玩家停留在资源包界面
- 接受资源包 → 自动连接到第一个可用服务器
- 拒绝资源包 → 玩家被踢出(如果已配置)
服务器切换流程:
- 后端服务器切换 → 不重新发送(存储在会话中)
- 重新连接代理 → 再次发送资源包(新会话)
数据库:
- 位置:
plugins/velocitypacker/resourcepack.db
- 存储数据:UUID、接受状态、时间戳
? 日志
该插件提供详细的日志记录:
[INFO] Initializing Velocitypacker...
[INFO] Configuration loaded
[INFO] Database initialized
[INFO] Event listener registered
[INFO] Sent resource pack to player Spieler123
[INFO] Player Spieler123 successfully downloaded the resource pack
[INFO] Connecting Spieler123 to lobby
?️ 技术细节
- Velocity API: 3.4.0-SNAPSHOT
- Kotlin: 2.0.20-Beta1
- SQLite: 3.45.0.0
- SnakeYAML: 2.2
- Shadow Plugin: 用于依赖打包
?️ 构建
# 包含所有依赖的完整构建
./gradlew clean shadowJar
# 仅编译(不含 Shadow)
./gradlew build
最终的 JAR 文件大小约为 16 MB,并包含所有必要的依赖项。
? 重要提示
- 资源包 URL:必须是直接的
.zip 下载链接
- 无服务器切换拦截:玩家可以自由在后端服务器之间切换
- 会话清理:断开连接时数据会自动清理
- 数据库备份:SQLite 文件可以轻松复制/备份
? 故障排除
插件未加载
- 确保正在运行 Velocity 3.4.0-SNAPSHOT
- 检查所有依赖是否已正确打包
未发送资源包
- 检查配置中的
resourcePackUrl
- 确保该 URL 可访问
玩家未被转发
? 许可证
由 thelion 创建
? 支持
如有问题或疑问:
- 在 GitHub 仓库中创建 Issue
- 检查日志以获取错误消息
- 确保所有依赖均已正确安装
祝你在使用 Velocitypacker 插件时好运!?
Velocitypacker
A Velocity plugin that automatically sends resource packs to players and stores their acceptance status in a SQLite database.
✨ Features
- ? Automatic Resource Pack Sending - Pack is sent on every proxy join
- ? SQLite Database - Persistent storage of acceptance status
- ? Smart Blocking - Players cannot connect to servers until pack is accepted/declined
- ⚡ Auto-Connect - Automatic connection to first server after successful acceptance
- ? Session Management - No re-sending when switching between backend servers
- ?️ YAML Configuration - Easy customization of all settings
- ? Detailed Logs - Comprehensive information about pack status
? Installation
1. Download Plugin
# Clone repository
git clone https://github.com/TheLion102009/Velocitypacker.git
cd Velocitypacker
# Build plugin
./gradlew clean shadowJar
2. Install JAR
You can find the compiled JAR in build/libs/Velocitypacker-0.1.jar.
Copy this file to the plugins/ folder of your Velocity server.
3. Start Server
Restart your Velocity server. The configuration file will be created automatically.
⚙️ Configuration
The config.yml is automatically created in the plugins/velocitypacker/ folder:
# Resource pack URL (REQUIRED)
# Must be a direct download URL to a .zip file
resourcePackUrl: https://example.com/resourcepack.zip
# SHA-1 hash of the resource pack (OPTIONAL)
# Format: 40 hexadecimal characters (e.g. a1b2c3d4e5f6...)
# Leave empty if you don't want to use a hash
resourcePackSha1: ""
# Message shown to the player
# Supports Minecraft color codes with §
resourcePackPrompt: "§aPlease accept the resource pack to play!"
# Kick player if the resource pack is declined
kickOnDecline: true
# Kick player if the download fails
kickOnFailedDownload: true
# Kick message (supports color codes with §)
kickMessage: "§cYou must accept the resource pack to play!"
Generate SHA-1 Hash
Windows:
certutil -hashfile resourcepack.zip SHA1
Linux/Mac:
sha1sum resourcepack.zip
? How It Works
Player Join Process:
- Player connects to proxy → Resource pack is sent immediately
- Server connection blocked → Player stays in resource pack screen
- Pack accepted → Automatic connection to first available server
- Pack declined → Player is kicked (if configured)
Server Switch Process:
- Backend server switch → No re-sending (stored in session)
- Proxy rejoin → Pack is sent again (new session)
Database:
- Location:
plugins/velocitypacker/resourcepack.db
- Stored data: UUID, acceptance status, timestamp
? Logs
The plugin provides detailed logs:
[INFO] Initializing Velocitypacker...
[INFO] Configuration loaded
[INFO] Database initialized
[INFO] Event listener registered
[INFO] Sent resource pack to player Spieler123
[INFO] Player Spieler123 successfully downloaded the resource pack
[INFO] Connecting Spieler123 to lobby
?️ Technical Details
- Velocity API: 3.4.0-SNAPSHOT
- Kotlin: 2.0.20-Beta1
- SQLite: 3.45.0.0
- SnakeYAML: 2.2
- Shadow Plugin: For dependency bundling
?️ Build
# Full build with all dependencies
./gradlew clean shadowJar
# Compile only (without Shadow)
./gradlew build
The final JAR is approximately 16 MB in size and contains all necessary dependencies.
? Important Notes
- Resource Pack URL: Must be a direct
.zip download URL
- No Server Switch Blocks: Players can freely switch between backend servers
- Session Cleanup: Data is automatically cleaned up on disconnect
- Database Backup: SQLite file can be easily copied/backed up
? Troubleshooting
Plugin doesn't load
- Make sure Velocity 3.4.0-SNAPSHOT is running
- Check if all dependencies are correctly bundled
Resource pack is not sent
- Check the
resourcePackUrl in the configuration
- Make sure the URL is accessible
Players are not forwarded
- Check the server logs for errors
- Make sure backend servers are available
? License
Created by thelion
? Support
For questions or problems:
- Create an issue in the GitHub repository
- Check the logs for error messages
- Make sure all dependencies are correctly installed
Good luck with your Velocitypacker plugin! ?
评论 0
登录后参与评分
还没有评论,来抢沙发吧