SimpleCronClone 包含两部分:基于类 cron 语法的定时脚本,以及在特定事件发生时触发的脚本。
SimpleCronClone
该部分插件模拟了 cron(Windows 用户可理解为“计划任务”)的行为,允许你安排脚本和命令以定时执行。它使用了由 Carlo Pelliccia 编写的出色 cron4j 调度器,以及其自身非常、非常、非常、非常、非常基础的脚本语言。
它是如何工作的呢?文件 `plugins/SimpleCronClone/tab.scc` 被用作 crontab 文件,但它不直接接收完整命令,而是仅接受脚本的名称。该 tab 文件会被解析并安排计划,当符合 cron 条件时,相应的脚本将被运行。
CronClone 部分旨在帮助处理服务器所需的自动化任务。例如:
- 每隔设定的时间向控制台发送一条消息。
- 运行一系列依赖于服务器运行的脚本(例如备份、异地备份等)。
- 每隔一段时间运行一系列游戏内命令(清除日志、重置竞技场等,具体取决于你的其他插件)。
- 查询操作系统程序的状态或信息,并在 SCC 脚本中使用这些信息。
EventEngine
v1.0 新增的功能。EventEngine 是 SimpleCronClone 的扩展功能,当特定事件发生时,它会调用事件脚本(以 .sce 结尾)。
其理念是通过将脚本添加到 plugins/SimpleCronClone/tab.sce,你可以基于玩家引发的事件进行数据统计收集或执行其他操作。例如,假设你有一个冒险世界,你可以设置一个脚本,当世界不再为空时触发,内容为:“对玩家 $1 说:$2 冒险地图正在开放,快来加入吧!”;而当世界再次变为空时,另一个脚本则将其恢复为正常状态。这只是 EventEngine 可实现的功能之一。有关哪些事件可以被调度以及如何调度,请参阅 事件页面。
** 脚本格式 **
参见 此处
** Tab 格式 **
参见 此处
** 安全警告 **
一句话提醒:无论你执行什么操作,它都将拥有与运行服务器的用户相同的权限。因此请小心谨慎。此外,请注意脚本的执行目录是服务器的可执行文件目录,而非插件目录。
** 源代码和问题追踪器 **
There are two parts to SimpleCronClone: scheduled scripts based on a cron-like syntax, and scripts that are called when certain events occur.
SimpleCronClone
This part of the plugin mimics the behavior of cron (for Windows-Users: Planned Tasks) and allows you to schedule scripts and commands for execution. It uses the awesome cron4j scheduler written by Carlo Pelliccia and it's own very, very, very, very, very basic scripting language.
How does it work? Well, the file plugins/SimpleCronClone/tab.scc is used as crontab-file, but instead of whole commands, it only takes the names of scripts. The tab file is parsed and scheduled, and when according the the cron part, the script is ran.
The CronClone part is to help with automated tasks that every server needs help with. For example:
- sending a message to the console every set amount of time.
- running a series of scripts that are dependent on the server running (eg, backups, off-site backups and more)
- running a series of in-game commands every so often (clearing logs, resetting arenas and much more, depending on your other plugins)
- query OS programs for status or information and use that information inside of the SCC script
EventEngine
New in v1.0, the EventEngine is a extension to the normal SimpleCronClone that calls event scripts (ending in .sce) when certain events occur.
The idea of this is that now by adding scripts to plugins/SimpleCronClone/tab.sce you will be able to do certain stats gathering or any other kind of thing based on events that players themselves cause. An example is lets say you have an adventure world, you can set a script to be run saying "do say hey player $1 is now playing in $2 adventure map, go join!" when a world is no longer empty, and when the world is empty again have a script revert it to normal. This is just one of many things that could be done with the EventEngine. See the events page for what events can be scheduled and how.
** Script Format **
See here
** Tab Format **
See here
** Warning about security **
One word of warning: Whatever you'll execute, it will have the same rights as the user from which the server is run. So be careful. Also keep in mind the execution-directory of the script is the server-directory for executables, not the plugin-directory.
** Source and issue tracker **
下载 SimpleCronClone
下载 SimpleCronClone
下载 SimpleCronClone
下载 SimpleCronClone
需要联机服务器吗?
稳定流畅、一键部署,几分钟即可和朋友联机开服
最低仅需 8 元/月 即可畅快联机
下载 SimpleCronClone
需要联机服务器吗?
稳定流畅、一键部署,几分钟即可和朋友联机开服
最低仅需 8 元/月 即可畅快联机
下载 SimpleCronClone
下载 SimpleCronClone
需要联机服务器吗?
稳定流畅、一键部署,几分钟即可和朋友联机开服
最低仅需 8 元/月 即可畅快联机
下载 SimpleCronClone
需要联机服务器吗?
稳定流畅、一键部署,几分钟即可和朋友联机开服
最低仅需 8 元/月 即可畅快联机
v 1.3.2
- 新增命令:"SLEEP MILLISECONDS"
- ExecWait 的 ScriptParser 不再出现(严重的)空白字符处理错误
- UUID-->PlayerName 脚本示例,包含简单的用法示例
- 次要版本号提升至 1.3.2
- 感谢 cyclo666 发现这些 bug,并测试了更改/修复内容
v 1.3.1
针对玩家/控制台命令 "/simplecronclone exec $SCRIPT" 的简单 bug 修复。同时允许向该脚本传递参数。v1.3 的其他说明仍然适用。
v 1.3
v1.3 中的破坏性更新
EventEngine 不再传递 PlayerName,而是仅传递 UUID。如果这对使用 EE 的用户造成了问题,请告知我,我们可以找出除了增加更多事件参数之外的其他解决方案……
v 1.2
SimpleCronEvents
应请求,新增两个 SCE 事件:playerDeath 和 playerRespawn。有关更多信息及参数详情,请参阅事件页面。
SimpleCronClone
SCC 无更改
在使用脚本运行时通过控制台命令 reload 重载服务器,可能会导致脚本处于暂停或未知状态。此问题正在处理中,但在此期间建议不要使用 reload 来重载所有插件,而是重启服务器。(若要重新解析 tab.scc 和 tab.sce,请使用 /simplecronclone restart 命令)
v1.3 中的破坏性更新
EventEngine 不再传递 PlayerName,而是仅传递 UUID。如果这对使用 EE 的用户造成了问题,请告知我,我们可以找出除了增加更多事件参数之外的其他解决方案……
v1.1 中的破坏性更新
EventEngine 的 tab.sce 格式不得不从头重写,你必须重新编写它!我无法制作出足够好用的转换器来自动为你转换。对此我深表歉意。有关新格式的样式,请参阅 tab-format,同时查看下载文件中包含的示例 tab.sce 文件。
关于这个资源的讨论、问题反馈与使用心得
还没有讨论,来发第一帖吧
你是这个资源的作者?登录后可认领此资源。
相似资源
插件
ExyliaPlugins 的库。
插件
重新定义服务器上的生物运输方式。使用高度可定制的口袋道具,安全地捕获、存储和释放任何实体。
插件
一个在游戏内运行的 Minecraft 地图编辑器! 支持选区、蓝图、复制粘贴、笔刷和脚本。 可在创造模式中使用,也可在生存模式中临时使用。
插件
创建用户友好的菜单以前往不同的世界
插件
专为 Velocity 打造的自制聊天插件,功能丰富——支持跨服群组/全局/私聊消息,并集成 LibertyBans 的禁言功能。
插件
一个高度兼容、功能完善且稳定的 TPA 模组
评论 0
登录后参与评分
还没有评论,来抢沙发吧