• 每个人都可以搬运插件,请严格遵守搬运插件的规则,帖子一定要写上原帖地址! 近期Rustbbs会有大量更新!服务器版块请严格按照规定排版写入! 搬运插件请不要大量机翻!QQ交流群:612904352
资源图标

搬运 SmoothRestarter服务器定时重启 3.2.0

没有下载权限
原网址
https://umod.org/plugins/smooth-restarter
原作者
2CHEVSKII
原名称
SmoothRestarter
这个插件允许你为你的服务器设置预定的关机时间。

附加功能
  • 当新的氧化物版本出来时重启
  • 奇特的用户界面
  • 从其他插件使用灵活的API
重要通知,请在支持版块发帖前阅读
这个插件关机后重新启动服务器,因为这是不可能的。你需要一个外部的解决方案。

配置
可以在中配置设置和选项SmoothRestarter文件放在config目录。建议使用编辑器和验证器来避免格式问题和语法错误。
{
"Daily restarts": [
"0:00"
],
"Restart when new Oxide.Rust is out": true,
"Initiate countdown at": 300,
"Enable UI": true,
"UI position (X,Y)": "0.92, 0.92",
"UI scale": 1.0,
"Enable console logs": true,
"Commands": [
"sr",
"srestart",
"smoothrestart",
"smoothrestarter"
],
"Disable chat countdown notifications": false,
"Custom countdown reference points": [
60,
50,
40,
30,
25,
15,
10,
9,
8,
7,
6,
5,
4,
3,
2,
1
],
"Use custom countdown reference points": false,
"Oxide update check interval in seconds": 600
}
说明
  • Daily restarts:此设置允许您设置服务器关闭的时间(在中)hh:mm格式)
  • Restart when new Oxide.Rust is out:如果设置为true -如果当前的氧化物版本过期,服务器将重新启动
  • Initiate countdown at:重启倒计时的起点(以及氧化物更新重启的重启延迟)。倒计时速度将增加,同时越来越接近零
  • Enable UI:启用或禁用插件UI
  • UI position (X,Y):设置插件UI位置(0到1的浮点数)
  • UI scale:在0.3到3的范围内设置插件UI相对比例
  • Enable console logs:启用/禁用信息控制台消息
  • Commands:这允许您更改用于与插件交互的命令,排除插件冲突并提供一般便利
  • Disable chat countdown notifications:将此项设定为true以禁用聊天中显示的倒计时通知
  • Custom countdown reference points:使用它来替换默认倒计时里程碑
  • Use custom countdown reference points:将此项设置为true以启用以前的功能
本地化
默认消息在SmoothRestarter文件放在lang/en目录。要添加对另一种语言的支持,请创建新的语言文件夹(例如de对于德语)如果尚未创建,请将默认语言文件复制到新文件夹中,然后自定义消息。
{
"Chat prefix": "<color=#d9770f>Smooth Restarter</color>:",
"No permission": "<color=#f04c32>You</color> have no permission to use this command",
"Kick reason": "Server is restarting",
"Help message": "/sr <color=#1a97ba>[command]</color> <color=#1aba8f>[arguments]</color>\nCommands: <color=#1a97ba>help</color>, <color=#1a97ba>status</color>, <color=#1a97ba>restart</color>, <color=#1a97ba>cancel</color>\nTo get information about command usage, type '/sr <color=#1a97ba>help</color> <color=#1aba8f>[command]</color>'",
"Help message: Help": "/sr <color=#1a97ba>help</color> <color=#1aba8f>[command]</color> - Outputs general help message or command usage help if command is specified",
"Help message: Status": "/sr <color=#1a97ba>status</color> - Outputs current restart status",
"Help message: Restart": "/sr <color=#1a97ba>restart</color> <color=#1aba8f>[time]</color> - Initiates new restart process\nTime must be in one of the following formats:\n<color=#77ba20>123</color> - delay before restart in seconds\n<color=#77ba20>123</color><h|m|s> - delay before restart in <hours|minutes|seconds>\n<color=#77ba20>1</color>h <color=#77ba20>2</color>m <color=#77ba20>3</color>s - delay before restart in hr min sec, all optional\n<color=#77ba20>1</color>:<color=#77ba20>23</color> - schedule restart on 1:23 (24hr format)",
"Help message: Cancel": "/sr <color=#1a97ba>cancel</color> - Cancels current restart process",
"Restarting already": "Cannot do restart - already restarting. Use '/sr <color=#1a97ba>status</color>' to get info about current restart process, or try '/sr <color=#1a97ba>cancel</color>' to cancel current restart before starting new one",
"Not restarting": "Cannot cancel restart - plugin does not perform a restart currently.",
"Cancelled successfully": "Restart was successfully cancelled",
"Restart reason: Timed": "Planned",
"Restart reason: Oxide update": "New Oxide update is out",
"Restart reason: Command": "Command from <color=#dbc30b>{0}</color>",
"Restart reason: API call": "API call from <color=#dbc30b>{0}</color>",
"Announcement: Restart initiated": "Server will be restarted in <color=#a4db0b>{0:sfmt::<hr? hours ><min? minutes ><sec? seconds>}</color> ({1})",
"Announcement: Countdown tick": "<color=#a4db0b>{0:sfmt::<hr? h ><min? min ><sec? s>}</color> left before server restart",
"Announcement: Restart cancelled": "Server restart was cancelled",
"Restart initiated": "Restart initiated successfully",
"Status: Restarting": "Server is restarting, <color=#a4db0b>{1:sfmt::<min#0.0! min ><sec? seconds>}</color> left",
"Status: Restarting (global.restart)": "Server is restarting natively",
"Status: Restart planned": "Server restart planned at <color=#a4db0b>{0:hh\\:mm}</color> (<color=#a4db0b>{1:sfmt::<hr? hours ><min? minutes ><sec? seconds>}</color> left)",
"Status: No planned restarts": "Server is not restarting, no planned restarts found",
"UI title": "SmoothRestarter",
"UI countdown format": "{0:sfmt::<min#2!>:<sec#2>} left"
}
时间格式
插件在参数格式中为自定义时间格式化程序提供了自己的语法{0:format}占位符)可以使用模板输出不同的时间格式。要在某些特定参数中启用自定义格式,您需要使用sfmt::前缀,因此参数应该如下所示:{0:sfmt::}在前缀之后,您可以编写结果格式的文本,包括一些被相应值替换的模板:

  • sec模板被秒值替换
  • min模板被分钟值取代
  • hr模板被小时值取代
模板必须遵循以下格式<template_name>,这导致<min>如果您希望模板替换为重启前剩余分钟值

每个模板都可以有额外的修改器来改变它的外观和行为:

  • #-填充和精度修饰符允许对模板的数值进行填充/截断
  • !- Total修饰符导致模板被剩余的总值(秒/分/小时)替换
  • ?-如果数值等于零,可选修饰符将整个模板替换为空字符串
  • - Appender修饰符允许您将任何文本追加到模板中(在<和>之间键入),并使该文本的行为与模板相同(如果模板本身不是,则不会显示该文本,就像当我们使用value == 0的可选修饰符时一样)
示例如下所示:

假设我们在重启前还有30分23秒(30 * 60 23 =总共1823秒,或总共30,383333分钟)<hr>:<min>:<sec>显然会得出0:30:23,这不是一个好数字,对吗?但是我们可以用<hr?:><min?>:<sec?>如果我们还有1小时30分23秒,在这种情况下将显示30:23,同时仍然显示1:30:23

如果您想更进一步,让所有的数字以两位数的形式出现(必要时加上0),您可以使用#填充和精度修饰符在这种情况下很有帮助。<hr#2?:><min#2?:><sec#2?>将输出为01:30:23

如果您不想显示小时,而只是使用重新启动前剩余的分钟和秒钟值,请使用!总修改量。假设重启将在3小时59分17秒后发生。如果我们使用<min! minutes ><sec seconds>将值显示为“239分17秒”,因为我们的小时值被转换为180分钟,加上59分钟,得到239。3小时59分17秒的相同值总计为239.2833333333分钟,但小数部分默认情况下是隐藏的。如果要显示而不是秒呢?#填充和精度运算符也将帮助我们做到这一点,只需将格式设置为<min#0.3! minutes>并且结果值将是“239.283分钟”,因为我们使用3作为精度值,它实际上可以是大于或等于零的任何其他数字

命令
这个插件使用相同的语法提供聊天和控制台命令。在聊天中使用命令时,请在前面加一个正斜杠:`/`。
命令前缀可在配置中配置,/srestart被用作一个例子

  • srestart status-如果服务器正在重新启动或不启动(以及剩余时间),将响应信息性消息
  • srestart cancel-取消当前的重新启动过程,也将取消由global.restart命令
  • srestart restart <time>-启动重启过程,参见支持的格式去理解<time>参数格式
  • srestart help (<command>)-输出一般帮助消息,或有关< command >用法的信息(如果有)
支持的格式time命令
  • 123-延迟时间(秒)
  • 123<h|m|s>-延迟hours/minutes/seconds
  • 1h 2m 3s-延迟1小时2分3秒,共3723秒。所有部分都是可选的
  • 1:23-计划01:23实时重启(24小时格式)
本机重启交互
插件处理对本机重启进程的检查(global.restart控制台命令)。虽然你可以取消它/sr cancel命令,在执行此操作之前,您将无法启动新的重启过程,在本机重启运行时,定时/氧化更新重启都不会继续,因此请注意这种行为。

许可
这个插件使用权限系统。若要分配权限,请使用oxide.grant <user or group> <name or steam id> <permission>.若要移除权限,请使用oxide.revoke <user or group> <name or steam id> <permission>.
每个许可授予对相应插件命令的访问权(例如smoothrestarter.status为/sr status):

  • smoothrestarter.restart
  • smoothrestarter.cancel
  • smoothrestarter.status
在大多数情况下,您会希望smoothrestarter.status授予所有玩家,而其他命令只对管理员可用

用户界面
插件提供简单的用户界面来显示当前重启进程的状态。通过操作configUI进度条中的值,可以在屏幕上缩放和移动UI。颜色相对于重新启动前的剩余时间自动更新

ui_green
ui_yellow


ui_red


附加选项
如果你想给玩家提供奖励,如果他们在重启后回到你的服务器上玩的话,一定要检查一下顺利重启重新加入奖励它为此提供了可定制的功能

开发者API
/* Callable hooks */
IsSmoothRestarting(): bool // returns true if plugin is going to restart server
GetPlannedRestarts(): IReadOnlyCollection<TimeSpan> // returns list of planned restarts
GetCurrentRestartTime(): Nullable<DateTime> // returns DateTime indicating when the server will be restarted, if restarting currently, otherwise null
GetCurrentRestartReason(): Nullable<int> // returns number corresponding to RestartReason enum (see below), if restarting, otherwise null
GetCurrentRestartInitiator(): object // returns Plugin or IPlayer if restart initiated by API call / Command respectively, otherwise null
InitSmoothRestart(DateTime, Plugin): bool // Accepts DateTime as a timestamp to restart at and Plugin as restart initiator, returns true if successfull
CancelSmoothRestart(Plugin): bool // Accepts Plugin as a canceller and returns true if successfull
/* Informational hooks */
OnSmoothRestartInit(float, RestartReason, object) // Called whenever new restart process has started. Passes remaining time in seconds, RestartReason (see below), initiator (Plugin/IPlayer/null) as parameters
OnSmoothRestartTick(int) // Called when a countdown tick happens. Passes remaining time in seconds as a parameter
OnSmoothRestartCancelled(object) // Called when restart process was cancelled. Passes IPlayer/Plugin as a parameter
/* RestartReason enum */
// Timed = 0
// OxideUpdate = 1
// Command = 2
// ApiCall = 4
作者
keai
下载
28
查看
1,394
首次发布
上次更新
评分
0.00 星 0个评价

分享此资源