Timers

Timers is a scheduling mechanism included into ReActions.

Timers allows you to execute any EXEC-activator in defined time. You can use in-game time (and for example execute activator every Minecraft-hour). Also you can create timers based on real time values. For example you can run single timer at 01.01.2015 or every day at 12:00 or every hour or every second.

Creating a timer

You can create a timer using command:

/react add timer <name> timer-type:<INGAME|SERVER> activator:<exec> time:<HH:MM,HH:MM|*_*_*_*_*_?> [player:<player>] [world:<world>]

To add in-game timer you need to use HH:MM time format that define hours and minutes of Minecraft time. You can define more than one time to execute activator inside one in-game timer. For example: "01:05,01:10,07:00" will point to in-game time: 01:05 and 01:10 and 07:00. So defined activator will be executed three times during the Minecraft day.

To define server time (or real time) timer you need to define time using cron format. There is an external library used in ReActions. And here is a short description of cron format (it's have some differences from classic Unix format) provided by this library: http://quartz-scheduler.org/documentation/quartz-2.2.x/tutorials/crontrigger

ReActions added one trait to this format. If you using command you need to replace spaces with character "". But you can use space and "" if you editing activators.yml file manually.

Examples

  • /react add timer TIMER1 timer-type:ingame activator:EXEC1 time:07:00 player:all — this command will add a timer named TIMER1 that will execute activator:EXEC1 every Minecraft-day at 07:00 (dawn)
  • /react add timer EveryTenMin timer-type:server activator:TenMin time:0_0/10_*_*_*_? player:all — This command will create timer based on server time that will execute every ten minutes (for example at: 00:00, 00:10, 00:20 etc.)

Commands

  • /react add timer <name> activator:<exec> timer-type:<INGAME|SERVER> time:<HH:MM,HH:MM|*_*_*_*_*_?> [player:<player>] [world:<world>] — Add new timer
  • /react list timer [page] — List timers
  • /react remove timer <id> — Remove timers

Timer actions and flags

You can control your timers in ReActions activators by using flags and actions:

  • TIMER_STOP — Action. Stops execution of timer. Parameter: timer:<timerId>
  • TIMER_RESUME — Action. Resumes execution of stopped timer. Parameter: timer:<timerId>
  • TIMER_ACTIVE — Flag. Checks activity state of defined timer. Returns false if timer is paused. Parameter: <timerId>