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 **
source code
bug tracker
评论 0
登录后参与评分
还没有评论,来抢沙发吧