SRV-Cron
知名 Cron 插件 MC-Cron 的延续版本。
所有荣誉归于原作者 — TheTadeSK。
SRV-Cron 是一款功能齐全的一体化 Minecraft 服务器调度器,具备多种功能,可按特定时间或游戏内事件安排任务执行。
它是知名 Cron 插件 MC-Cron 的延续版本,提供了原版 MC-Cron 插件所不具备的许多额外和扩展功能,例如 PlaceholderAPI 支持、以玩家身份发送命令、变量操作以及条件检查。
功能
以下是该插件提供的一些功能。
- 可自定义的任务
- 控制台、玩家和管理员命令执行
- 让每个在线玩家执行命令
- 发送消息、标题和操作栏文本
- 播放音效并生成粒子效果
- 广播消息并写入计划日志
- 按权限、PlaceholderAPI 值或记分板分数过滤操作
- 事件任务与命令
- 启动命令
- 使用
/timer 延迟执行命令
- BungeeCord 支持
- PlaceholderAPI 支持
命令操作与条件
默认情况下,计划的命令以控制台身份运行。在命令前添加前缀可以发送消息、显示标题或操作栏、播放音效、生成粒子、让玩家聊天或运行命令、以管理员身份运行、广播或写入日志消息。支持的前缀包括 [MESSAGE]/[TEXT]、[TITLE]、[ACTIONBAR]、[SOUND]、[PARTICLE]、[CHAT]、[PLAYER]、[OP]、[CONSOLE]、[BROADCAST]、[LOG] 以及 [LOG <file>]。
消息、标题、操作栏和广播支持 MiniMessage 以及传统的 &/§ 颜色代码(包括 RGB 格式)。前缀条件支持权限检查、PlaceholderAPI 比较(需安装 PlaceholderAPI)、记分板分数,以及使用 && 和 || 的组合条件:
- '{IF:hasPermission:vip} [MESSAGE] <gold>Welcome, %player_name%!'
- '{IF:placeholder:%vault_eco_balance%>=1000} [CONSOLE] give %player_name% diamond 1'
- '{IF:score:points>=10} [ACTIONBAR] &aYou have enough points.'
条件需要一个玩家上下文,例如事件任务或针对 <ALL>/<ALL+> 分发的命令。现有的动作头过滤器(如 [TEXT (PERMISSION:staff)] ...)仍然受支持。
可用事件
在配置中使用以下值:
join-event
quit-event
weather-change-event
world-load-event
player-bed-enter-event
player-change-world-event
player-gamemode-change-event
player-kick-event
chat-event
command-event
item-pickup-event
player-advancement-done-event
内置占位符
{player_name} — 用于与玩家相关的事件
{world_name} — 用于与世界相关的事件
以及许多其他特定于事件的占位符。
在此阅读更多:
如果事件同时涉及玩家和世界(例如 player-change-world-event),你可以同时使用这两个占位符。
BungeeCord 仅提供两个可用事件:加入和离开。
命令与权限
指定秒数后运行命令
命令:
/timer <seconds> <command>
权限:
srvcron.command.timer
重载配置与任务
命令:
/srvcron reload
权限:
srvcron.command.reload
手动运行 cron 或事件任务
命令:
/srvcron run <job-name>
/srvcron run event <event-name>
权限:
srvcron.command.run
暂停任务执行
命令:
/srvcron suspend <job-name>
权限:
srvcron.command.suspend
恢复任务执行
命令:
/srvcron resume <job-name>
权限:
srvcron.command.resume
任务信息
命令:
/srvcron jobinfo <job-name>
权限:
srvcron.command.jobinfo
任务与事件列表
命令:
/srvcron list [events]
权限:
srvcron.command.list
配置
配置非常简单易懂。
如需更详细的说明,请访问 GitHub Wiki:
Configuration · M0diis/SRV-Cron Wiki
默认配置
jobs:
save:
time: every 1 hour
commands:
- say Saving world!
- save-all
- say Save Complete!
restart:
time: every 1 day of week at 6:00
commands:
- say Server restart in 10 seconds!
- timer 10 stop
tps:
time: every 30 minutes
commands:
- tps
# 如果你不想使用任何事件任务,请使用:
# event-jobs: { }
event-jobs:
join-event:
welcome:
time: 1
commands:
- tell {player_name} Hello!
- <ALL>[CHAT] Hello {player_name}!
quit-event:
bye:
time: 5
commands:
- say {player_name} left the game few seconds ago.
player-gamemode-change-event:
notify:
time: 0
commands:
- '<ALL> [TEXT (PERM:staff.notify.gamemode)] Player {player_name} changed his gamemode from {from_gamemode} to {to_gamemode}.'
startup:
commands:
- say Server was started!
- timer 60 say Server is online for 1 minute!
- save-all
schedule:
# 控制类似 "every day of week in 1,5 at 12:00" 表达式中的数字星期几
# 支持:monday-first(默认,ISO)、sunday-first(旧版)、iso、legacy
weekday-numbering: monday-first
debug: false
silent-start: false
notify-update: true
log-to-file: true
locale: 'en'
语法
# 命名星期几
time: every wednesday at 00:00
time: every monday,friday at 18:30
# 列表/范围支持
time: every day of week in 1,3,5 at 12:00
time: every day of week in 2..6 at 07:45
time: every day of month in 1..5 at 09:00
# 纯间隔
time: every 30 seconds
time: every 5 minutes
time: every 1 hour
time: every 2 days
# 每天多次
time: every day at 08:00,12:00,18:00
# 时间窗口
time: 09:00 至 17:00,每 15 分钟一次
time: 23:00 至 03:00,每 20 分钟一次
# 每月第 N 个/最后一个工作日
time: 每月第 2 个周一 10:00
time: 每月最后一个周五 22:00
# 相对日历关键词
time: 每个工作日 09:00
time: 每个周末 11:00
time: 每月最后一天 23:55
# 月份名称计划
time: 每年 1 月、3 月的第 1 天 08:00
# 开始/结束约束
time: 2026-06-01 至 2026-09-01 之间,每小时一次
# 每个任务的时区和抖动
# 选项顺序为:... [between ...] [jitter ...] [timezone ...]
time: 每天 09:00 timezone Europe/Berlin
time: 每 5 分钟 jitter 30s
time: 每 10 分钟 jitter 2m timezone Europe/Berlin
# 一次性执行
time: 2026-06-10 14:30
# 经典 Cron 表达式(需显式启用)
time: "cron: 0 0 * * 3"
time: "cron: */15 9-17 * * mon-fri"
注意:
- Cron 格式为
minute hour day-of-month month day-of-week。
- Cron 支持在每个字段中使用
*、列表(,)、范围(-)和步长(/)。
- 支持 Cron 的月份/星期几名称(例如
jan、mon-fri)。
- 星期几 DSL 数字与现有配置保持兼容(
1=星期日 ... 7=星期六)。
- 为了向后兼容,仍接受旧版表达式:
every 4 day of week at 00:00(或省略 at,默认为 00:00)
every 1 day of month at 09:00(或省略 at,默认为 00:00)
API
如需更详细的说明,请访问 GitHub Wiki:
API · M0diis/SRV-Cron Wiki
目前有 3 个事件会在特定操作时触发:
您还可以与 API 进行交互。
SRV-Cron
Continuation of the well-known Cron plugin - MC-Cron.
All credits go to the original author — TheTadeSK.
SRV-Cron is an all-in-one Minecraft server scheduler that has many features to schedule jobs for certain times or in-game events.
It is a continuation of the well-known Cron plugin MC-Cron, with many additional and expanded features that the original MC-Cron plugin does not provide, such as PlaceholderAPI support, sending commands as players, variable actions, and condition checking.
Features
These are some of the features that this plugin provides.
- Customizable jobs
- Console, player, and operator command execution
- Execute commands by every online player
- Send messages, titles, and action bars
- Play sounds and spawn particle effects
- Broadcast messages and write scheduled logs
- Filter actions by permissions, PlaceholderAPI values, or scoreboard scores
- Event jobs & commands
- Start-up commands
- Delayed command execution with
/timer
- BungeeCord support
- PlaceholderAPI support
Command Actions & Conditions
Scheduled commands run as the console by default. Prefix a command with an action to send a message, show a title or action bar, play a sound, spawn particles, chat or run a command as a player, run as an operator, broadcast, or write a log message. Supported prefixes are [MESSAGE]/[TEXT], [TITLE], [ACTIONBAR], [SOUND], [PARTICLE], [CHAT], [PLAYER], [OP], [CONSOLE], [BROADCAST], [LOG], and [LOG <file>].
Messages, titles, action bars, and broadcasts support MiniMessage and legacy &/§ color codes, including RGB formats. Prefix conditions support permissions, PlaceholderAPI comparisons (when PlaceholderAPI is installed), scoreboard scores, and combinations using && and ||:
- '{IF:hasPermission:vip} [MESSAGE] <gold>Welcome, %player_name%!'
- '{IF:placeholder:%vault_eco_balance%>=1000} [CONSOLE] give %player_name% diamond 1'
- '{IF:score:points>=10} [ACTIONBAR] &aYou have enough points.'
Conditions require a player context, such as an event job or a command dispatched for <ALL>/<ALL+>. Existing action-header filters such as [TEXT (PERMISSION:staff)] ... remain supported.
Available Events
Use these values in the configuration:
join-event
quit-event
weather-change-event
world-load-event
player-bed-enter-event
player-change-world-event
player-gamemode-change-event
player-kick-event
chat-event
command-event
item-pickup-event
player-advancement-done-event
Built-in Placeholders
{player_name} — for events that relate to a player
{world_name} — for events that relate to a world
And many more event-specific placeholders.
Read more here:
You can use both placeholders if the event relates to both a player and a world, for example player-change-world-event.
BungeeCord has only two events available: join and quit.
Commands & Permissions
Run command after specified seconds
Command:
/timer <seconds> <command>
Permission:
srvcron.command.timer
Reload configuration & jobs
Command:
/srvcron reload
Permission:
srvcron.command.reload
Run cron or event job manually
Command:
/srvcron run <job-name>
/srvcron run event <event-name>
Permission:
srvcron.command.run
Suspend job execution
Command:
/srvcron suspend <job-name>
Permission:
srvcron.command.suspend
Resume job execution
Command:
/srvcron resume <job-name>
Permission:
srvcron.command.resume
Job information
Command:
/srvcron jobinfo <job-name>
Permission:
srvcron.command.jobinfo
Job & event list
Command:
/srvcron list [events]
Permission:
srvcron.command.list
Configuration
Configuration is pretty simple and easy to understand.
For a more detailed explanation, visit the GitHub Wiki:
Configuration · M0diis/SRV-Cron Wiki
Default Configuration
jobs:
save:
time: every 1 hour
commands:
- say Saving world!
- save-all
- say Save Complete!
restart:
time: every 1 day of week at 6:00
commands:
- say Server restart in 10 seconds!
- timer 10 stop
tps:
time: every 30 minutes
commands:
- tps
# If you do not want to use any event jobs, use:
# event-jobs: { }
event-jobs:
join-event:
welcome:
time: 1
commands:
- tell {player_name} Hello!
- <ALL>[CHAT] Hello {player_name}!
quit-event:
bye:
time: 5
commands:
- say {player_name} left the game few seconds ago.
player-gamemode-change-event:
notify:
time: 0
commands:
- '<ALL> [TEXT (PERM:staff.notify.gamemode)] Player {player_name} changed his gamemode from {from_gamemode} to {to_gamemode}.'
startup:
commands:
- say Server was started!
- timer 60 say Server is online for 1 minute!
- save-all
schedule:
# Controls numeric weekdays in expressions like: every day of week in 1,5 at 12:00
# Supported: monday-first (default, ISO), sunday-first (legacy), iso, legacy
weekday-numbering: monday-first
debug: false
silent-start: false
notify-update: true
log-to-file: true
locale: 'en'
Syntax
# named weekdays
time: every wednesday at 00:00
time: every monday,friday at 18:30
# list/range support
time: every day of week in 1,3,5 at 12:00
time: every day of week in 2..6 at 07:45
time: every day of month in 1..5 at 09:00
# plain intervals
time: every 30 seconds
time: every 5 minutes
time: every 1 hour
time: every 2 days
# multiple times per day
time: every day at 08:00,12:00,18:00
# time windows
time: every 15 minutes from 09:00 to 17:00
time: every 20 minutes from 23:00 to 03:00
# nth / last weekday in month
time: every 2nd monday of month at 10:00
time: every last friday of month at 22:00
# relative calendar keywords
time: every weekday at 09:00
time: every weekend at 11:00
time: every month on last-day at 23:55
# month-name schedules
time: every january,march day 1 at 08:00
# start/end constraints
time: every 1 hour between 2026-06-01 and 2026-09-01
# per-job timezone and jitter
# options order is: ... [between ...] [jitter ...] [timezone ...]
time: every day at 09:00 timezone Europe/Berlin
time: every 5 minutes jitter 30s
time: every 10 minutes jitter 2m timezone Europe/Berlin
# one-shot execution
time: at 2026-06-10 14:30
# classic cron expression (opt-in)
time: "cron: 0 0 * * 3"
time: "cron: */15 9-17 * * mon-fri"
Notes:
- Cron format is
minute hour day-of-month month day-of-week.
- Cron supports
*, lists (,), ranges (-), and steps (/) in each field.
- Cron month/day-of-week names are supported (e.g.
jan, mon-fri).
- Day-of-week DSL numbers stay compatible with existing configs (
1=Sunday ... 7=Saturday).
- Legacy expressions are still accepted for backward compatibility:
every 4 day of week at 00:00 (or without at, defaults to 00:00)
every 1 day of month at 09:00 (or without at, defaults to 00:00)
API
For a more detailed explanation, visit the GitHub Wiki:
API · M0diis/SRV-Cron Wiki
There are currently 3 events that are fired upon certain actions:
You can also interact with the API.
评论 0
登录后参与评分
还没有评论,来抢沙发吧