Earlier Versions
| Name | Size | Uploaded | Game Version | Downloads | |
| cronmc-1.19-1.1.jar release | 107.13 KB | Jul 26, 2022 | 1.19.1 | 3 | Download |
| cronmc-1.18-1.1.jar release | 105.62 KB | Jul 26, 2022 | 1.18.2 | 1 | Download |
| cronmc-1.17-1.1.jar release | 105.64 KB | Jul 26, 2022 | 1.17.1 | 1 | Download |
| cronmc-1.16-1.1.jar release | 105.09 KB | Jul 26, 2022 | 1.16.5 | 1 | Download |
| cronmc-1.19-1.0.jar release | 104.87 KB | Jul 25, 2022 | 1.19.1 | 2 | Download |
| cronmc-1.18-1.0.jar release | 105.21 KB | Jul 25, 2022 | 1.18.2 | 3 | Download |
| cronmc-1.17-1.0.jar release | 105.30 KB | Jul 25, 2022 | 1.17.1 | 2 | Download |
| cronmc-1.16-1.0.jar release | 104.71 KB | Jul 25, 2022 | 1.16.5 | 2 | Download |
Description
What It Is
cronmc attempts to provide a ‘cron’-like capability for your Minecraft server, allowing you to schedule various activities to occur automatically.
How It Works
cronmc will look for it’s server-side config and process the provided schedules. Each schedule is expected to be in the format:
<scheduletype>:<scheduledata>|<optype>:<opdata>
Examples
Here are the default included cronmc strings:
event:FML_SERVER_STARTED_EVENT|op:say Cronmc here, letting you know the server is up
event:FML_SERVER_STARTED_EVENT|runnable:com.pyehouse.mcmod.cronmc.api.task.RunnableHandler$TestRunnable
cron:* * * * *|runnable:com.pyehouse.mcmod.cronmc.api.task.RunnableHandler$TestRunnable
cron:* * * * *|runnable:com.pyehouse.mcmod.cronmc.api.task.RunnableHandler$TestRunnable2
event:FML_SERVER_STARTED_EVENT|op:say Cronmc here, with a cron-based op command
event:PLAYER_CHANGE_GAME_MODE_EVENT|op:say Player changed game mode
Schedule Types and Data
Specifies the type of scheduling, i.e. it tells cronmc “when am I supposed to do something?”. Currently, the schedule types available include:
-
cron – Traditional cron scheduling. cron4j is responsible for the pattern parsing.
- cron schedule data – The actual cron pattern
-
event – Event based scheduling; attempts to run the indicated task when the indicated event is fired on the server.
- event schedule data – The tag representing one of the supported events
Op Types and Data
Specifies the action to take, i.e. it tells cronmc “what am I supposed to do?”. Currently, the op types available include:
-
op – Runs a command on the server as if it were typed at the console, i.e. an operator command
- op data – The string to be sent to the Minecraft console
-
runnable – Attempts to dynamically load and run the specified Java java.lang.Runnable
- runnable op data – The fully qualified class name of the Runnable to be run
Event Support
I haven’t cracked the nut of dynamically attaching to every possible event, so currently only the following events are supported, using the specified value in the cronmc string.
- FMLSERVERSTARTED_EVENT
- COMMAND_EVENT
- PLAYERCHANGEGAMEMODEVENT
- WORLDLOADEVENT
- DIFFICULTYCHANGEEVENT
- EXPLOSION_EVENT
- PLAYERLOGGEDIN_EVENT
Registering New Handlers
Both the Schedule Types and Task Types make use of the Forge Registry system, so it is possible to create your own schedule and task handlers.
Game Commands
There is also a console command, /cronmc, with the following options:
- cronmc stop – stops processing jobs until further notice
- cronmc start – starts processing jobs
- cronmc refresh – refreshes the job list from config and stops/starts scheduling
- cronmc settz – set the TimeZone you want scheduling to be run in (uses Java TimeZone Ids)
- cronmc list – list currently scheduled and running tasks
Configuring cronmc-server.toml
startOnServerStart : boolean
If true, will attempt to start the scheduling automatically on server start. If false, scheduling will not start automatically (i.e. you would need to run ‘cronmc start’)
cronTimeZone : string
A Java TimeZone Id where you want the scheduling to run. i.e. if the server is in one timezone, but you want your “6 AM” cron event to fire in your timezone, then you could specify your timezone here.
outputToConsole : boolean
If true, additional cronmc chatter will be sent to the console and to any players with appropriate permission to see them, which leads to…
consoleMessageMinPermissionLevel : int
Only players with this permission level or higher should see console output from cronmc. Minecraft permission levels explained.
schedules : array of strings
An array of the schedules you want to run
Licensing
cron4j is licensed under the LGPL and is available at the cron4j project website.
All code developed by me is licensed under the MIT license.
Get 0.05 TON 💎
Download
Add a comment