重启公告
为 Paper 和 Folia 提供高度可配置的重启倒计时:聊天、Boss 栏或标题公告,可选的每日/每周定时重启及提醒,并支持在 messages.yml 中使用 MiniMessage。
命令: /announcer · 别名: /ra, /restartannouncer
要求
- Minecraft 1.20+ (Paper API)
- Java 17+
- Paper 或其兼容分支(支持 Folia — 需设置
folia-supported: true)
功能
- 手动倒计时 — 使用
/announcer start 开始,可指定时间、间隔和显示模式(chat, bossbar, title)
- 定时重启 — 基于墙钟时间的每日或每周重启,可选基于小时数的提醒,以及等待备份完成后的延迟机制
- 关机控制 —
execute-shutdown: true 会在倒计时结束时停止服务器;false 则仅发布公告(需由脚本或看门狗自行重启)
- 关机方式 —
shutdown、stop 或 restart(详见配置注释;推荐默认值 shutdown)
- 游戏内管理 — 切换
execute-shutdown、设置重启消息、重载配置/消息
- 更新检查器 — 可选功能;通过
announcer.update 权限执行 /announcer update
- 可配置权限 —
config.yml 中的权限节点字符串映射到你使用的权限插件
命令
| 命令 |
描述 |
/announcer start <time> [interval] [display] |
开始倒计时。time / interval:例如 10m, 30s, 1h。display:chat(默认)、bossbar、title。 |
/announcer stop |
取消当前活动的倒计时 |
/announcer status |
显示是否有正在运行的重启及剩余时间 |
/announcer reload |
重载 config.yml、messages.yml,并根据配置重新应用定时重启 |
/announcer toggle |
翻转 config.yml 中的 execute-shutdown 设置(重载后完全同步行为) |
/announcer set message <message> |
设置主要重启公告(MiniMessage 格式);持久化保存到 messages.yml |
/announcer update |
检查插件更新(需要 announcer.update 权限) |
/announcer help |
上下文敏感帮助(玩家仅能看到其有权使用的子命令) |
示例
/announcer start 10m — 10 分钟,默认间隔,聊天显示
/announcer start 30m 2m bossbar — 30 分钟,每 2 分钟在 Boss 栏公告一次
/announcer start 30s 2s title — 30 秒,每 2 秒以标题形式显示
权限
定义于 plugin.yml(显示了默认值)。如果你的权限插件使用不同的名称,可以将配置键指向自定义节点。
| 权限 |
默认值 |
用途 |
announcer.use |
true |
基础命令访问权限 |
announcer.start |
op |
开始倒计时 |
announcer.stop |
op |
停止倒计时 |
announcer.status |
op |
查看状态 |
announcer.reload |
op |
重载、切换、set message |
announcer.update |
op |
/announcer update |
announcer.admin |
op |
父节点,包含上述所有权限 |
config.yml 中还列出了用于启动/停止/状态/重载检查的字符串(默认值与上表匹配)。
配置
config.yml
config_version — 当默认值更改时会递增;更新时保留你的文件,如有需要可从 jar 中合并新键。
update-checker — 启用/禁用启动时的更新检查。
defaults — 当 /announcer start 未指定时使用的 restart-time(分钟)和 announcement-interval(秒)。
scheduled-restart — enabled、time(HHmm 24小时制)、recurrence(DAILY / WEEKLY)、day-of-week、interval-weeks、week-anchor-date(用于多周每周计划)、reminder-interval-hours、wait-for-backup、wait-for-backup-delay。
shutdown-method — shutdown | stop | restart
execute-shutdown — true 表示在倒计时结束时停止服务器;false 表示仅发布公告。
permissions — 覆盖用于 start/stop/status/reload 的权限节点字符串。
示例骨架:
config_version: 4
update-checker:
enabled: true
defaults:
restart-time: 10
announcement-interval: 60
scheduled-restart:
enabled: false
time: "0400"
recurrence: DAILY
day-of-week: SUNDAY
interval-weeks: 1
week-anchor-date: "2026-01-04"
reminder-interval-hours: 4
wait-for-backup: true
wait-for-backup-delay: 60
shutdown-method: "shutdown"
execute-shutdown: true
permissions:
start: "announcer.start"
stop: "announcer.stop"
status: "announcer.status"
reload: "announcer.reload"
messages.yml
messages_version — 除非你清楚自己在做什么,否则不要更改。
restart-message — %time% = 剩余时间。
scheduled-restart.reminder — 定时通知中的 %time%、%timezone%。
scheduled-restart.backup-delayed — 当重启因等待备份而延迟时显示。
commands.* — MiniMessage 格式的用法、错误和帮助字符串。
messages_version: 3
restart-message: "<red><bold>Server will restart in <yellow>%time%<red>!"
scheduled-restart:
reminder: "<yellow>Next scheduled restart: <white>%time% <gray>(%timezone%)"
backup-delayed: "<yellow>Restart delayed – backup in progress. Will restart when backup completes."
commands:
start:
usage: "<red>Usage: /announcer start <time> <interval> [display]"
example: "<gray>Example: /announcer start 10m 60s chat"
invalid-display: "<red>Invalid display type. Use: chat, bossbar, title"
# … stop, status, reload, help …
安装
- 下载构建好的 JAR (
mvn package) 或发布包。
- 将其放入服务器的
plugins 文件夹。
- 启动服务器一次以生成
config.yml 和 messages.yml。
- 编辑配置/消息文件,然后执行
/announcer reload(或重启服务器)。
- 在游戏中使用
/announcer help 查看允许的子命令。
更新
- 备份
plugins/RestartAnnouncer/config.yml 和 messages.yml。
- 替换 JAR 文件并启动服务器。
- 将你的配置文件与新 JAR 中的默认配置进行比较;添加任何新增的配置项(例如在
scheduled-restart 或 update-checker 下的内容),除非你希望完全重置,否则不要删除整个文件夹。
- 在大幅更新后,请确认
config_version / messages_version 以及 scheduled-restart 字段是否与新版本的默认值匹配。
时间格式示例
例如:30s、60s、5m、10m、30m、1h、2h、6h(用于设置重启开始时间和公告间隔)。
关闭方式
shutdown(默认)—— 调用 Bukkit.shutdown()
stop —— 旨在与 /stop 命令行为保持一致(详见 JAR 内的注释说明)
restart —— 对应 /restart 命令;某些环境可能不支持该功能,请谨慎使用
仅公告模式
execute-shutdown: false
正常发送公告;当倒计时归零时,服务器不会自动停止。建议在玩家收到警告后通过外部脚本或控制面板执行重启操作。
MiniMessage 支持
messages.yml 支持 MiniMessage 语法(如 <red>、<yellow>、<bold>、<reset>、渐变色等)。部分硬编码的管理员字符串中仍可能出现传统的 § 符号代码,但在 YAML 文件中推荐使用 MiniMessage 格式。
技术支持
问题反馈与建议:请使用提供的 Discord 频道
Restart Announcer
Highly configurable restart countdowns for Paper and Folia: chat, boss bar, or title announcements, optional scheduled daily/weekly restarts with reminders, and MiniMessage in messages.yml.
Command: /announcer · Aliases: /ra, /restartannouncer
Requirements
- Minecraft 1.20+ (Paper API)
- Java 17+
- Paper or a compatible fork (Folia supported —
folia-supported: true)
Features
- Manual countdowns —
/announcer start with time, interval, and display mode (chat, bossbar, title)
- Scheduled restarts — wall-clock DAILY or WEEKLY restarts, optional hour-based reminders, optional wait for backup + delay after backup finishes
- Shutdown control —
execute-shutdown: true stops the server at zero; false = announcements only (your script/watchdog must reboot)
- Shutdown method —
shutdown, stop, or restart (see config comments; default shutdown is recommended)
- In-game management — toggle execute-shutdown, set restart message, reload config/messages
- Update checker — optional;
announcer.update for /announcer update
- Configurable permissions — permission node strings in
config.yml map to your permission plugin
Commands
| Command |
Description |
/announcer start <time> [interval] [display] |
Start a countdown. time / interval: e.g. 10m, 30s, 1h. display: chat (default), bossbar, title. |
/announcer stop |
Cancel the active countdown |
/announcer status |
Show whether a restart is running and time left |
/announcer reload |
Reload config.yml, messages.yml, and re-apply scheduled restart from config |
/announcer toggle |
Flip execute-shutdown in config.yml (reload afterward to fully sync behavior) |
/announcer set message <message> |
Set the main restart announcement (MiniMessage); persists to messages.yml |
/announcer update |
Check for plugin updates (requires announcer.update) |
/announcer help |
Context-sensitive help (players only see subcommands they can use) |
Examples
/announcer start 10m — 10 minutes, default interval, chat
/announcer start 30m 2m bossbar — 30 minutes, announce every 2 minutes on boss bar
/announcer start 30s 2s title — 30 seconds, every 2 seconds as title
Permissions
Defined in plugin.yml (defaults shown). You can point config keys at custom nodes if your permission plugin uses different names.
| Permission |
Default |
Purpose |
announcer.use |
true |
Base command access |
announcer.start |
op |
Start countdowns |
announcer.stop |
op |
Stop countdowns |
announcer.status |
op |
View status |
announcer.reload |
op |
Reload, toggle, set message |
announcer.update |
op |
/announcer update |
announcer.admin |
op |
Parent node grouping the above |
config.yml also lists the strings used for start/stop/status/reload checks (defaults match the table).
Configuration
config.yml
config_version — bumped when defaults change; keep your file when updating and merge new keys from the jar if needed.
update-checker — enable/disable update checks on startup.
defaults — restart-time (minutes), announcement-interval (seconds) when omitted from /announcer start.
scheduled-restart — enabled, time (HHmm 24h), recurrence (DAILY / WEEKLY), day-of-week, interval-weeks, week-anchor-date (for multi-week weekly), reminder-interval-hours, wait-for-backup, wait-for-backup-delay.
shutdown-method — shutdown | stop | restart
execute-shutdown — true to stop server at end of countdown; false for announcements only.
permissions — override permission node strings for start/stop/status/reload.
Example skeleton:
config_version: 4
update-checker:
enabled: true
defaults:
restart-time: 10
announcement-interval: 60
scheduled-restart:
enabled: false
time: "0400"
recurrence: DAILY
day-of-week: SUNDAY
interval-weeks: 1
week-anchor-date: "2026-01-04"
reminder-interval-hours: 4
wait-for-backup: true
wait-for-backup-delay: 60
shutdown-method: "shutdown"
execute-shutdown: true
permissions:
start: "announcer.start"
stop: "announcer.stop"
status: "announcer.status"
reload: "announcer.reload"
messages.yml
messages_version — do not change unless you know what you’re doing.
restart-message — %time% = time remaining.
scheduled-restart.reminder — %time%, %timezone% for scheduled notices.
scheduled-restart.backup-delayed — when restart waits on a backup.
commands.* — MiniMessage strings for usage, errors, and help.
messages_version: 3
restart-message: "<red><bold>Server will restart in <yellow>%time%<red>!"
scheduled-restart:
reminder: "<yellow>Next scheduled restart: <white>%time% <gray>(%timezone%)"
backup-delayed: "<yellow>Restart delayed – backup in progress. Will restart when backup completes."
commands:
start:
usage: "<red>Usage: /announcer start <time> <interval> [display]"
example: "<gray>Example: /announcer start 10m 60s chat"
invalid-display: "<red>Invalid display type. Use: chat, bossbar, title"
# … stop, status, reload, help …
Installation
- Download the built JAR (
mvn package) or a release artifact.
- Place it in the server’s
plugins folder.
- Start the server once to generate
config.yml and messages.yml.
- Edit config/messages, then
/announcer reload (or restart).
- Use
/announcer help in-game for allowed subcommands.
Updating
- Back up
plugins/RestartAnnouncer/config.yml and messages.yml.
- Replace the JAR and start the server.
- Compare your files with the defaults in the new jar; add any new keys (e.g. under
scheduled-restart or update-checker) instead of deleting the whole folder unless you want a full reset.
- After large jumps, verify
config_version / messages_version and scheduled-restart fields match the new defaults.
Time formats
Examples: 30s, 60s, 5m, 10m, 30m, 1h, 2h, 6h (used for start time and announcement interval).
Shutdown methods
shutdown (default) — Bukkit.shutdown()
stop — intended to align with /stop-style behavior (see in-jar comments)
restart — /restart; may not exist on all setups — use with care
Announcement-only mode
execute-shutdown: false
Announces as usual; at 0 the server does not stop. Use an external script or panel to restart after players are warned.
MiniMessage
messages.yml supports MiniMessage (e.g. <red>, <yellow>, <bold>, <reset>, gradients). Legacy § codes may still appear in a few hard-coded admin strings; prefer MiniMessage in YAML.
Support
Issues and suggestions: use the provided Discord
Plugin does not restart the process by itself when the OS exits — pair with a start script, systemd, or watchdog that brings the server back up.
评论 0
登录后参与评分
还没有评论,来抢沙发吧