# SimpleAutoRestart
[](https://github.com/teunjojo/SimpleAutoRestart/releases)
[](https://github.com/teunjojo/SimpleAutoRestart)
[](https://www.spigotmc.org/resources/simpleautorestart.107932/)
[](https://modrinth.com/plugin/simpleautorestart)
[](https://www.curseforge.com/minecraft/bukkit-plugins/simpleautorestart)
[](https://bukkit.org/)
[](https://papermc.io/software/folia)
我尝试了许多自动重启插件,但发现要么太复杂,要么基于周期。这意味着当 TPS 低于 20 时,它们并不准确,因此与诸如 [Hibernate](https://www.spigotmc.org/resources/hibernate.4441/) 和 [Server Naptime](https://github.com/gvk/MinecraftPluginServerHibernate) 等插件不兼容。
因此我决定自己创建一个。
[](https://www.bstats.org/plugin/bukkit/SimpleAutoRestart/17760)
## 特性
- 安排在特定时间自动重启。
- 在重启前向玩家广播警告消息。
- 安排多个重启。
- 基于实时,而不是基于周期,因此更准确。
- 与诸如 [Hibernate](https://www.spigotmc.org/resources/hibernate.4441/) 和 [Server Naptime](https://github.com/gvk/MinecraftPluginServerHibernate) 等插件兼容。
## 游戏内显示效果(虽然您可以自定义):

## 服务器控制台显示效果(虽然您可以自定义):

## 安装
1. 在 [spigot.yml](https://docs.papermc.io/paper/reference/spigot-configuration/#settings_restart_script) 中设置启动脚本。
2. 从发布页面下载 `SimpleAutoRestart-x.x.x-jar`。
3. 将 JAR 文件放在服务器的插件文件夹中。
4. 启动或重启服务器。
5. 通过编辑插件文件夹(plugins/SimpleAutoRestart)中的 config.yml 文件来配置插件。
## 配置
```yml
# 服务器应该重启的小时和分钟(24 小时制)
restartTime:
- '00:00'
# 通过添加新行来添加多个时间,例如:- '12:00'
# 配置消息和相应的预警时间(秒)
messages:
'0': '现在重启'
'1': '1秒后重启'
'2': '2秒后重启'
'3': '3秒后重启'
'60': '1分钟后重启'
'120': '2分钟后重启'
'180': '3分钟后重启'
'300': '5分钟后重启'
titles:
'300' : '§l§4警告'
'3' : '§l§4警告'
subtitles:
'300' : "§65分钟后重启"
'3' : "§6现在重启..."
# 在重启时执行的命令
commands:
- 'restart'
```
## 命令
- `/simpleautorestart` 或 `/sar` 或 `/autorestart` - 显示帮助菜单。
- `/simpleautorestart cancel` - 取消下一次重启。
- `/simpleautorestart resume` - 恢复下一次重启。
- `/simpleautorestart status` - 显示下一次重启的状态。
- `/simpleautorestart set ` - 安排在特定时间重启。
## 故障排除
### 倒计时,但没有重启
请确保您已在 [`spigot.yml`](https://docs.papermc.io/paper/reference/spigot-configuration/#settings_restart_script) 中配置了 `restart-script`。
## 支持
如果您遇到任何问题或疑问,请 [创建问题票证](https://github.com/teunjojo/SimpleAutoRestart/issues/new)。