受够了为了提醒玩家服务器即将重启,而不得不在聊天栏疯狂刷屏 “Quick restart restart!” 了吗?RestartAnnounce 是一个插件,它利用 Minecraft 的分层计分板系统来公告服务器重启倒计时。当倒计时归零时,服务器将自动关闭。
RestartAnnounce 已在 BeastsMC 服务器上部署运行超过一个月,期间未出现任何问题或漏洞。
功能
- 使用计分板作为计时器,以创新方式向玩家通告计划内的重启
- 当倒计时归零时自动关闭服务器
- 可安排未来进行的重启,无需任何工作人员在线
- 可按固定间隔安排重启
- 在距离关机还有 60 分钟之前,间隔重启的提示不会显示
命令
/sr <seconds>: 安排重启在 <seconds> 秒后执行
/sr reload: 重新加载插件的 config.yml 配置文件,同时取消所有正在进行的计划重启或间隔重启。
/sr time: 查看距离下一次计划重启的剩余时间。
/cancelrestart: 取消当前已计划的重启
权限
restartannounce.admin - 允许使用 /sr 和 /cancelrestart 命令
restartannounce.reload - 允许使用 /sr reload 命令
restartannounce.time - 允许使用 /sr time 命令
启动脚本
RestartAnnounce 仅负责关闭你的服务器。如果插件在调用关机后自行启动服务器会非常不优雅(hacky)。不过,你可以修改启动脚本让它在服务器关闭后为你重新启动。
在你的服务器目录下,创建一个名为 run.sh 的文件:
#!/bin/sh
SERVERDIR="/path/to/the/server/directory"
screen -S "Minecraft" bash -c "sh $SERVERDIR/loop.sh"
然后创建另一个名为 loop.sh 的文件:
#!/bin/sh
STARTUPLINE="java -Xincgc -Xmx2G -jar craftbukkit.jar"
while true
do
$STARTUPLINE
echo "If you want to completely stop the server process now, press Ctrl+C before the time is up!"
echo "Rebooting in:"
for i in 5 4 3 2 1
do
echo "$i..."
sleep 1
done
echo "Rebooting now!"
done
要启动服务器,请使用:./run.sh
源代码
Tired of having to spam the chat with "Quick restart restart!" just for players to notice you're restarting the server? RestartAnnounce is a plugin that uses Minecraft's scoreboard system to announce server restarts with a visible timer. When the timer hits 0, your server will shut down.
RestartAnnounce has been deployed on the BeastsMC servers for over a month now with no issues or bug.
Features
- Innovative way to alert players of scheduled restarts using scoreboards as a timer
- Automatically shuts down the server when timer hits 0
- Schedule restarts to occur in the future without any staff being online
- Schedule restarts to occur at set intervals
- Interval restarts don't display unless there is less than 60 minutes until shutdown
Commands
/sr <seconds>: Schedule a restart to occur in <seconds>
/sr reload: Reload the plugin's config.yml, also cancels any active scheduled restarts or interval restarts.
/sr time: Check the remaining time to the next planned restart.
/cancelrestart: Cancel a restart that is currently scheduled
Permissions
restartannounce.admin - Allow the usage of /sr and /cancelrestart
restartannounce.reload - Allows the usage of /sr reload
restartannounce.time - Allows for the usage of /sr time
Startup Script
RestartAnnounce merely shuts down your server. For the plugin to start up the server after it called a shutdown would be very hacky. However, you can modify your startup script to start the server up for you.
In your server directory, create a file called run.sh:
#!/bin/sh
SERVERDIR="/path/to/the/server/directory"
screen -S "Minecraft" bash -c "sh $SERVERDIR/loop.sh"
Then create another file called loop.sh:
#!/bin/sh
STARTUPLINE="java -Xincgc -Xmx2G -jar craftbukkit.jar"
while true
do
$STARTUPLINE
echo "If you want to completely stop the server process now, press Ctrl+C before the time is up!"
echo "Rebooting in:"
for i in 5 4 3 2 1
do
echo "$i..."
sleep 1
done
echo "Rebooting now!"
done
To start your server, use: ./run.sh
Source
评论 0
登录后参与评分
还没有评论,来抢沙发吧