Restartify
语言: 英文 | Русский
一个用于 Paper/Purpur (1.21+ 和 1.20+) 优雅重启服务器的插件:它在倒计时期间显示可配置的聊天公告和屏幕 BossBar,在倒计时过程中自动提供 PvP 保护,并支持带有 IANA 时区支持的定时重启,最后通过核心原生的重启方法重启服务器。
[!CAUTION]
此插件仍在测试中,使用时可能会遇到问题。如果发现 Bug,
请在 Issues 中报告!
支持版本
| 组件 |
版本 |
| 服务端软件 |
Paper / Purpur 1.20 – 26.x+(推荐 1.21+) |
| Java (JDK) |
17+ |
api-version |
1.20 |
该插件基于 Java 17 编译,仅依赖 Paper 自带的 Adventure API —— 无需外部库。
描述
突兀的服务器重启会让玩家毫无预警地被断开连接,并可能导致战斗中的物品丢失。Restartify 解决了这个问题:管理员运行 /reboot(或在 scheduled-restart 中配置自动时间),所有在线玩家会在聊天和 BossBar 中看到实时倒计时,并且可以在重启完成或取消之前自动禁用 PvP。当时钟归零时,插件会通过原生方式重启服务器。
功能 (v1.1.0)
- 带有平滑倒计时计时的 BossBar。 进度使用墙钟时间从
1.0 平滑移动至 0.0(服务器延迟不会拉长倒计时)。颜色 (PINK, BLUE, RED, GREEN, YELLOW, PURPLE, WHITE)、样式 (SOLID, NOTCHED_6/10/12/20) 和 darken-screen 均可配置。在倒计时中途加入的玩家会自动看到 BossBar。
- 倒计时期间的 PvP 保护 (
pvp-protection)。 当手动或定时重启倒计时开始时,玩家对玩家的伤害将在 EventPriority.HIGHEST 级别被阻止 —— 覆盖第三方 PvP 管理器和 CombatLog/anti-relog 插件,防止玩家在重启前丢失物品。涵盖近战攻击、箭矢、三叉戟、溅射药水、TNT 和末影水晶(同时保留自我伤害如末影珍珠),拒绝消息有 2 秒的反垃圾冷却。取消的重启会立即恢复正常的 PvP。
- 带有时区支持的定时重启 (
scheduled-restart)。 由 java.time.ZoneId 和 ZonedDateTime 驱动的异步调度器会在您选择的 IANA 时区配置的 HH:mm 时间触发重启,并考虑 countdown.seconds(例如,04:00 重启配合 60 秒倒计时将从 03:59:00 开始)。无效的时区将记录警告并安全地回退到 ZoneId.systemDefault()。请参阅 TIMEZONES.md 获取有效的时区 ID。
- 可配置的聊天公告。 三种模式:
INTERVAL(每 N 秒一次)、SCHEDULE(精确秒数列表)和 OFF(仅 BossBar)。设置 chat.enabled: false 会静音倒计时聊天消息,但保持命令回复活跃。
- MiniMessage 和旧版颜色代码共存。 在任何文本中混合使用
<red>、<bold>、<gradient:#ff0000:#0000ff>、<#RRGGBB> 与 &c、&l、&#RRGGBB —— 闭合标签会自动插入。
- 内置本地化 (
en / ru)。 默认为英文 (messages.yml),并通过在 config.yml 中设置 locale: ru 激活内置的俄语翻译 (messages_ru.yml)。
- 管理员通知、取消和热重载。 管理员和控制台可以看到是谁启动或取消了重启;
/reboot cancel 停止倒计时并重新启用 PvP;/reboot reload 在不中断活动倒计时的情况下动态更新文本、语言环境、PvP 设置和重启计划。
命令与权限
| 命令 |
描述 |
权限 |
/reboot |
启动重启倒计时 |
restartify.admin |
/reboot start |
显式子命令以启动倒计时 |
restartify.admin |
/reboot cancel |
取消正在运行的倒计时并恢复 PvP |
restartify.admin |
/reboot reload |
重载 config.yml 和 messages.yml |
restartify.admin |
/rb |
/reboot 的别名 |
restartify.admin |
单个权限 restartify.admin 默认为操作员 (default: op)。LuckPerms 示例:/lp user <player> permission set restartify.admin true。
注意: /restart 属于服务端核心 (org.spigotmc.RestartCommand),Restartify 故意不拦截它以防止重启命令循环。请改用 /reboot —— 它直接调用 Bukkit.spigot().restart()。
本地化
Restartify 支持多种内置语言,通过 config.yml 中的 locale 进行配置:
| 语言环境 |
语言 |
消息文件 |
en |
英语(默认) |
plugins/Restartify/messages.yml |
ru |
俄语 |
plugins/Restartify/messages_ru.yml |
# 插件本地化语言。可用选项:en, ru
locale: en
当选择 locale: ru 时(在启动时或 /reboot reload 时),如果 plugins/Restartify/messages_ru.yml 尚不存在,Restartify 会自动生成它并从其中加载所有消息。任何未知的 locale 值都将回退到 en (messages.yml),缺失的键将回退到嵌入式默认值。
配置
首次启动时,插件会创建 plugins/Restartify/config.yml 和 plugins/Restartify/messages.yml。
config.yml 示例
# 插件本地化语言。可用选项:en, ru
locale: en
countdown:
seconds: 60
聊天:
启用: true
公告:
模式: 间隔
间隔秒数: 15
秒数:
- 60
- 30
- 15
- 10
- 5
- 4
- 3
- 2
- 1
BossBar:
启用: true
颜色: 红
叠加层: 实心
屏幕变暗: true
重启:
操作: 重启
延迟刻数: 20
PvP 保护:
启用: true
拒绝消息: "<red>PvP 已禁用!服务器即将重启。</red>"
定时重启:
启用: true
# IANA 时区格式(完整列表见 TIMEZONES.md)
时区: "Europe/Moscow"
# 24 小时制 HH:mm 格式
时间:
- "04:00"
- "16:00"
config.yml 键值说明
| 键 |
描述 |
locale |
插件语言(en 或 ru)。 |
countdown.seconds |
倒计时持续时间,单位为秒(最小值为 1)。 |
chat.enabled |
false 将静默倒计时聊天广播(BossBar 和命令回复仍然有效)。 |
announce.mode |
INTERVAL(间隔)、SCHEDULE(定时)或 OFF(关闭)。 |
announce.interval-seconds |
INTERVAL 模式下的间隔秒数。 |
announce.seconds |
SCHEDULE 模式下显示的秒数列表。 |
bossbar.enabled |
是否显示倒计时 BossBar。 |
bossbar.color |
进度条颜色(PINK、BLUE、RED、GREEN、YELLOW、PURPLE、WHITE)。 |
bossbar.overlay |
进度条样式(SOLID、NOTCHED_6、NOTCHED_10、NOTCHED_12、NOTCHED_20)。 |
bossbar.darken-screen |
在 BossBar 激活期间使屏幕变暗。 |
restart.action |
RESTART — 使用原生 Bukkit.spigot().restart()(如果不支持则自动回退到 SHUTDOWN);SHUTDOWN — 使用 Bukkit.shutdown()。 |
restart.delay-ticks |
执行重启/关机前的延迟刻数(20 = 1 秒)。 |
pvp-protection.enabled |
在重启倒计时运行时禁用玩家之间的 PvP。 |
pvp-protection.deny-message |
当 PvP 被阻止时发送给攻击者的消息(具有 2 秒防刷屏冷却)。 |
scheduled-restart.enabled |
根据 times 启用自动重启。 |
scheduled-restart.timezone |
IANA ZoneId 名称 — 参见 TIMEZONES.md。 |
scheduled-restart.times |
目标重启时间列表,采用 HH:mm(24 小时制)格式。 |
messages.yml
所有聊天消息和 BossBar 标题均在 messages.yml 中配置。可用的占位符:
| 占位符 |
含义 |
%sender% |
启动或取消重启的人(玩家名称或 Console)。 |
%time% |
剩余时间,格式为 MM:SS(或 H:MM:SS)。 |
%seconds% |
以秒为单位的剩余时间。 |
%total% |
倒计时的总时长(秒)。 |
%progress% |
剩余的倒计时百分比。 |
%error% |
错误消息(仅在 restart-fallback 中使用)。 |
构建项目
需要 JDK 17 或更高版本:
# Linux / macOS
./gradlew build
# Windows
gradlew.bat build
构建好的 JAR 文件位于 build/libs/ 目录下:
Restartify-<version>.jar — 主插件 JAR;
Restartify-<version>-shadow.jar — Shadow JAR(所有依赖项均为 compileOnly,并由 Paper 提供)。
Restartify
Language: English | Русский
A plugin for graceful server restarts on Paper/Purpur (1.21+ and 1.20+): it runs a wall-clock countdown with configurable chat announcements, an on-screen BossBar, automatic PvP protection during the countdown, and scheduled restarts with IANA timezone support, then restarts the server via the core's native restart method.
[!CAUTION]
This plugin is still being tested, so you may run into issues while using it. If you find a bug,
please report it in Issues!
Supported Versions
| Component |
Versions |
| Server software |
Paper / Purpur 1.20 – 26.x+ (recommended 1.21+) |
| Java (JDK) |
17+ |
api-version |
1.20 |
The plugin is compiled for Java 17 and relies only on the Adventure API shipped with Paper — no external libraries are required.
Description
An abrupt server restart cuts players off without warning and can cause item loss during combat. Restartify solves this: an administrator runs /reboot (or configures automatic times in scheduled-restart), everyone online sees a live countdown in chat and via BossBar, and PvP can be automatically disabled until the restart completes or is cancelled. When the timer reaches zero, the plugin restarts the server natively.
Features (v1.1.0)
- BossBar with a smooth countdown timer. Progress moves smoothly from
1.0 down to 0.0 using wall-clock time (server lag does not stretch the countdown). Color (PINK, BLUE, RED, GREEN, YELLOW, PURPLE, WHITE), style (SOLID, NOTCHED_6/10/12/20), and darken-screen are configurable. Players joining mid-countdown see the BossBar automatically.
- PvP Protection during countdown (
pvp-protection). When a manual or scheduled restart countdown starts, player-vs-player damage is blocked at EventPriority.HIGHEST — overriding third-party PvP managers and CombatLog/anti-relog plugins so players do not lose items right before a restart. Covers melee hits, arrows, tridents, splash potions, TNT, and End Crystals (while preserving self-damage such as Ender Pearls), with a 2-second anti-spam cooldown on the deny message. Cancelled restarts immediately restore normal PvP.
- Scheduled Restarts with timezone support (
scheduled-restart). An asynchronous scheduler powered by java.time.ZoneId and ZonedDateTime triggers restarts at configured HH:mm times in your chosen IANA timezone, accounting for countdown.seconds (e.g., a 04:00 restart with a 60-second countdown starts at 03:59:00). Invalid timezones log a warning and safely fall back to ZoneId.systemDefault(). See TIMEZONES.md for valid timezone IDs.
- Configurable chat announcements. Three modes:
INTERVAL (every N seconds), SCHEDULE (exact seconds list), and OFF (BossBar only). Setting chat.enabled: false silences countdown chat messages while keeping command replies active.
- MiniMessage and legacy color codes together. Mix
<red>, <bold>, <gradient:#ff0000:#0000ff>, <#RRGGBB> with &c, &l, &#RRGGBB in any text — closing tags are inserted automatically.
- Built-in localization (
en / ru). Defaults to English (messages.yml), with a built-in Russian translation (messages_ru.yml) activated via locale: ru in config.yml.
- Admin notifications, cancel & hot-reload. Admins and console see who started or cancelled the restart;
/reboot cancel stops the countdown and re-enables PvP; /reboot reload updates texts, locale, PvP settings, and restart schedules on the fly without interrupting an active countdown.
Commands & Permissions
| Command |
Description |
Permission |
/reboot |
Start the restart countdown |
restartify.admin |
/reboot start |
Explicit subcommand to start the countdown |
restartify.admin |
/reboot cancel |
Cancel a running countdown and restore PvP |
restartify.admin |
/reboot reload |
Reload config.yml and messages.yml |
restartify.admin |
/rb |
Alias for /reboot |
restartify.admin |
The single permission restartify.admin defaults to operators (default: op). Example with LuckPerms: /lp user <player> permission set restartify.admin true.
Note: /restart belongs to the server core (org.spigotmc.RestartCommand) and is deliberately not intercepted by Restartify to prevent restart command loops. Use /reboot instead — it invokes Bukkit.spigot().restart() directly.
Localization
Restartify supports multiple built-in languages configured via locale in config.yml:
| Locale |
Language |
Messages File |
en |
English (default) |
plugins/Restartify/messages.yml |
ru |
Russian |
plugins/Restartify/messages_ru.yml |
# Plugin localization language. Available options: en, ru
locale: en
When locale: ru is selected (at startup or on /reboot reload), Restartify automatically generates plugins/Restartify/messages_ru.yml if it does not exist yet and loads all messages from it. Any unknown locale value falls back to en (messages.yml), and missing keys fall back to the embedded defaults.
Configuration
On first startup, the plugin creates plugins/Restartify/config.yml and plugins/Restartify/messages.yml.
config.yml example
# Plugin localization language. Available options: en, ru
locale: en
countdown:
seconds: 60
chat:
enabled: true
announce:
mode: INTERVAL
interval-seconds: 15
seconds:
- 60
- 30
- 15
- 10
- 5
- 4
- 3
- 2
- 1
bossbar:
enabled: true
color: RED
overlay: SOLID
darken-screen: true
restart:
action: RESTART
delay-ticks: 20
pvp-protection:
enabled: true
deny-message: "<red>PvP is disabled! The server is about to restart.</red>"
scheduled-restart:
enabled: true
# IANA timezone format (see TIMEZONES.md for the full list)
timezone: "Europe/Moscow"
# 24-hour HH:mm format
times:
- "04:00"
- "16:00"
config.yml keys
| Key |
Description |
locale |
Plugin language (en or ru). |
countdown.seconds |
Countdown duration in seconds (minimum 1). |
chat.enabled |
false silences countdown chat broadcasts (BossBar and command replies still work). |
announce.mode |
INTERVAL, SCHEDULE, or OFF. |
announce.interval-seconds |
Interval in seconds for INTERVAL mode. |
announce.seconds |
List of seconds for SCHEDULE mode. |
bossbar.enabled |
Whether to display the countdown BossBar. |
bossbar.color |
Bar color (PINK, BLUE, RED, GREEN, YELLOW, PURPLE, WHITE). |
bossbar.overlay |
Bar style (SOLID, NOTCHED_6, NOTCHED_10, NOTCHED_12, NOTCHED_20). |
bossbar.darken-screen |
Darken the screen while the BossBar is active. |
restart.action |
RESTART — native Bukkit.spigot().restart() (auto-falls back to SHUTDOWN if unsupported); SHUTDOWN — Bukkit.shutdown(). |
restart.delay-ticks |
Delay in ticks before executing restart/shutdown (20 = 1 second). |
pvp-protection.enabled |
Disable PvP between players while a restart countdown is running. |
pvp-protection.deny-message |
Message sent to an attacker when PvP is blocked (2s anti-spam cooldown). |
scheduled-restart.enabled |
Enable automatic restarts according to times. |
scheduled-restart.timezone |
IANA ZoneId name — see TIMEZONES.md. |
scheduled-restart.times |
List of target restart times in HH:mm (24-hour) format. |
messages.yml
All chat messages and the BossBar title are configured in messages.yml. Available placeholders:
| Placeholder |
Meaning |
%sender% |
Who started or cancelled the restart (player name or Console). |
%time% |
Remaining time formatted as MM:SS (or H:MM:SS). |
%seconds% |
Remaining time in seconds. |
%total% |
Total countdown duration in seconds. |
%progress% |
Percentage of countdown remaining. |
%error% |
Error message (used only in restart-fallback). |
Building the Project
Requires JDK 17 or newer:
# Linux / macOS
./gradlew build
# Windows
gradlew.bat build
Built JARs are placed in build/libs/:
Restartify-<version>.jar — main plugin JAR;
Restartify-<version>-shadow.jar — shadow JAR (all dependencies are compileOnly and provided by Paper).
评论 0
登录后参与评分
还没有评论,来抢沙发吧