GeyserUpdater
GeyserMC / Floodgate 的自动更新插件。支持 Spigot(及其分支如 Paper)、BungeeCord 和 Velocity。
功能
- 从 Jenkins/download API 获取 GeyserMC 和 Floodgate 的最新稳定版本,并覆盖 plugins 目录中现有的 JAR 文件
- 获取最新的 MCXboxBroadcast(来自 Modrinth)并将其放置在 Geyser 扩展文件夹中(可选)
- 自动检查更新
- 在服务器启动时
- 按指定间隔(例如每 12 小时)
- 当拥有特定权限的玩家登录时(可启用/禁用)
- 手动命令:
/geyserupdate(权限:geyserupdater.admin)
- 可配置的语言、消息、目标、间隔和重启命令
构建
- 前置要求:Java 17, Maven 3.8+
- 说明:
- 在你克隆仓库的目录中运行
mvn package
- 产物:
spigot/target/GeyserUpdater-Spigot-1.0.0.jar
bungee/target/GeyserUpdater-Bungee-1.0.0.jar
velocity/target/GeyserUpdater-Velocity-1.0.0.jar
安装
- 将适合你服务器平台的相应 JAR 文件放入 plugins 文件夹
- 启动服务器以生成
config.yml 文件(它将与此 README 中包含的默认配置相同)
- 插件通过在 plugins 目录中搜索文件名包含 "geyser" 或 "floodgate" 的文件来自动检测现有的 Geyser / Floodgate JAR 文件
- 如果未找到现有 JAR 文件,它将使用标准名称创建新的 JAR 文件(例如
Geyser-Spigot.jar, floodgate-velocity.jar)
命令与权限
/geyserupdate
- 描述:立即运行一次更新检查
- 权限:
geyserupdater.admin
配置文件 (config.yml)
enabled: 启用或禁用插件
language: 语言设置 (ja / en / de / ko,默认值: ja)
checkOnStartup: 启用或禁用启动时的更新检查
periodic.enabled: 启用或禁用周期性更新检查
periodic.intervalHours: 定期检查的间隔(以小时为单位)
adminLogin.enabled: 启用或禁用特权玩家登录时的更新检查
adminLogin.permission: 触发登录检查的权限(默认值: geyserupdater.admin)
targets.geyser | targets.floodgate | targets.mcxboxbroadcast: 选择要更新的插件
postUpdate.notifyConsole: 更新后通知控制台
postUpdate.notifyPlayersWithPermission: 向拥有权限的玩家发送游戏内聊天通知
postUpdate.runRestartCommand: 更新后自动执行重启命令
postUpdate.restartCommand: 要执行的重启命令(例如 restart 或 end)
messages.<lang>.*: 自定义消息(例如 messages.ja.*)
- 为了兼容性,当
language=ja 时也会读取 messages.*
工作原理
- 下载 URL:
- Geyser:
https://download.geysermc.org/v2/projects/geyser/versions/latest/builds/latest/downloads/{platform}
- Floodgate:
https://download.geysermc.org/v2/projects/floodgate/versions/latest/builds/latest/downloads/{platform}
- MCXboxBroadcast:
https://api.modrinth.com/v2/project/mcxboxbroadcast/version
{platform} 为 spigot | bungeecord | velocity
- 最新 JAR 被下载到临时文件中,并将其 SHA-256 哈希值与现有 JAR 进行比较
- 如果哈希值相同,则视为“已是最新”,不会替换文件
- 如果不同,则使用原子替换操作覆盖现有文件
- 应用更新后需要重启服务器或代理
- 若要启用自动重启,请将
postUpdate.runRestartCommand 设置为 true 并将 restartCommand 配置为匹配你的环境
- MCXboxBroadcast 放置在 Geyser 扩展文件夹中
- 示例:
plugins/Geyser-Spigot/extensions
注意事项 / 已知限制
- 如果因网络问题或其他错误导致下载失败,现有的插件文件不会受到影响
- 如果 Geyser/Floodgate 文件具有不寻常的名称或不在 plugins 文件夹的直接子目录中,插件将无法检测到它们(它仅扫描 plugins 目录根目录下的 *.jar 文件)
- MCXboxBroadcast 始终放置在
plugins/Geyser-Spigot/extensions
- 插件不显示版本号;它仅依赖哈希比较来确定是否有可用更新
许可证
GeyserUpdater
An automatic updater plugin for GeyserMC / Floodgate. Supports Spigot (and forks like Paper), BungeeCord, and Velocity.
Features
- Fetches the latest stable versions of GeyserMC and Floodgate from the Jenkins/download API and overwrites the existing JARs in the plugins directory
- Fetches the latest MCXboxBroadcast (from Modrinth) and places it in the Geyser extensions folder (optional)
- Automatic update checks
- On server startup
- At a specified interval (e.g., every 12 hours)
- When a player with a specific permission logs in (can be enabled/disabled)
- Manual command: /geyserupdate (Permission: geyserupdater.admin)
- Configurable language, messages, targets, intervals, and restart commands
Build
- Prerequisites: Java 17, Maven 3.8+
- Instructions:
- Run
mvn package in the directory where you cloned the repository
- Artifacts:
spigot/target/GeyserUpdater-Spigot-1.0.0.jar
bungee/target/GeyserUpdater-Bungee-1.0.0.jar
velocity/target/GeyserUpdater-Velocity-1.0.0.jar
Installation
- Place the appropriate JAR for your server platform into the plugins folder
- Start the server to generate the
config.yml file (it will be identical to the default config included in this README)
- The plugin automatically detects existing Geyser / Floodgate JARs by searching for files in the plugins directory that contain "geyser" or "floodgate" in their names
- If no existing JARs are found, it will create new ones with standard names (e.g.,
Geyser-Spigot.jar, floodgate-velocity.jar)
Commands & Permissions
/geyserupdate
- Description: Immediately runs an update check
- Permission:
geyserupdater.admin
Configuration File (config.yml)
enabled: Enables or disables the plugin
language: Language setting (ja / en / de / ko, default: ja)
checkOnStartup: Enables or disables the update check on startup
periodic.enabled: Enables or disables the periodic update check
periodic.intervalHours: The interval for periodic checks (in hours)
adminLogin.enabled: Enables or disables the update check when a privileged player logs in
adminLogin.permission: The permission that triggers the check on login (default: geyserupdater.admin)
targets.geyser | targets.floodgate | targets.mcxboxbroadcast: Choose which plugins to update
postUpdate.notifyConsole: Notifies the console after an update
postUpdate.notifyPlayersWithPermission: Sends an in-game chat notification to players with permission
postUpdate.runRestartCommand: Automatically executes a restart command after an update
postUpdate.restartCommand: The restart command to execute (e.g., restart or end)
messages.<lang>.*: Customize messages (e.g., messages.ja.*)
- For compatibility,
messages.* is also read when language=ja
How it Works
- Download URLs:
- Geyser:
https://download.geysermc.org/v2/projects/geyser/versions/latest/builds/latest/downloads/{platform}
- Floodgate:
https://download.geysermc.org/v2/projects/floodgate/versions/latest/builds/latest/downloads/{platform}
- MCXboxBroadcast:
https://api.modrinth.com/v2/project/mcxboxbroadcast/version
{platform} is spigot | bungeecord | velocity
- The latest JAR is downloaded to a temporary file and its SHA-256 hash is compared with the existing JAR
- If the hashes are identical, it is considered "up to date," and the file is not replaced
- If they differ, the existing file is overwritten using an atomic replacement operation
- A server or proxy restart is required after an update is applied
- To enable automatic restarts, set
postUpdate.runRestartCommand to true and configure restartCommand to match your environment
- MCXboxBroadcast is placed in the Geyser extensions folder
- Example:
plugins/Geyser-Spigot/extensions
Notes / Known Limitations
- If a download fails due to network issues or other errors, the existing plugin files will not be affected
- The plugin cannot detect Geyser/Floodgate files if they have unusual names or are not located directly within the plugins folder (it only scans for *.jar files in the root of the plugins directory)
- MCXboxBroadcast is always placed in
plugins/Geyser-Spigot/extensions
- The plugin does not display version numbers; it relies solely on hash comparison to determine if an update is available
License
评论 0
登录后参与评分
还没有评论,来抢沙发吧