randombyte-developer / command-utils

A Sponge plugin.
https://ore.spongepowered.org/RandomByte/CommandUtils
GNU General Public License v2.0
6 stars 1 forks source link

can you add a Scheduler function? #9

Open Jecvay opened 5 years ago

Jecvay commented 5 years ago

use Cron's format to edit the config file:

sayhi {
    commands=["broadcast &6游戏开始!"]
    schedule {
        type="Cron"
        schedule="10 22 * * *"
    }
}

desayhi {
    commands=["broadcast &6游戏结束!"]
    schedule {
        type="Cron"
        schedule="11 22 * * *"
    }
}
randombyte-developer commented 5 years ago

Just for me to note down, I think I will go with https://github.com/jmrozanec/cron-utils. It also seems to support similar but extended formats which build upon the cron format.

I will add a new config file for the scheduler and it will look something like this:

schedules {
  mySchedule1 {
    commands = [
      "myCommand"
    ],
    schedule = "10 22 * * *"
    type = "Cron" #Quartz, Cron4J or whatever that library offers
  }
}