UnfinishedThis part of the API is brand-new. It will be changed if there are any bugs, missing features or usability improvements.
It is not recommended relying on this part of the API, it will most likely change.
DraftOur own usage and testing has shown that this part of the API is complete and seems bug free. However, other plugins may have other use cases which are not covered by our testing. Therefore, please go ahead and use this API part. Let us know if there are missing features or bugs. This API part will be changed if there are more bugs, missing features or usability improvements.
Please use this part of the API and give us feedback!
StableBoth our own and third party testing showed that this part of the API is complete. Only bugs and major conceptual problems would lead to more changes.
This part of the API should be safe to use. We try to keep it compatible with previous versions if changes are needed.
If the native schedule types are not enough for you, this API enables you to create your own type.
Creating a new schedule type🔗
To implement a new schedule type you have to create both the Schedule and the Scheduler class.
About this guide
This guide will show you how to create a custom schedule that runs every
x ticks, just like a redstone clock.
While this does not make that much sense, it is a super simple example to show the principle.
The schedule class must hold all the schedules' data. When reloading BetonQuest will try to parse all packages and construct new instances of this class.
Have a look at this example to see how to implement your own schedule.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
You can extend either
The latter has already implemented all cron parsing logic.
You need to define a Constructor that matches exactly this one.
Otherwise BetonQuest can't parse your schedule!
super.timeprovides the raw time string.
You'll need to parse it and add your own logic.
In this example we just use it as interval of ticks.
Make sure to handle all parsing errors & thrown exceptions!
If a schedule can't be loaded due to an invalid instruction, you should throw a
InstructionParseExceptionthat describes the error.
You'll have to implement your own handling of catchup strategies in the
If you don't want that, you can add this check if a CatchupStrategy was defined and throw an Exception.
This is how you add custom options, if needed.
The scheduler will receive parsed schedules using
addSchedule(S) and hold them in the
It should contain all the scheduling & schedule execution logic.
It is also responsible for catching up missed schedules, if they have a catchup strategy other than
Here is a pretty basic example, that does not provide any catchup logic:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
Your scheduler must extend
<>you have to put the name of your Schedule class.
Always remember to call
An easy way to iterate over all loaded schedules.
Schedule your events to run when their time instruction says.
Pass your plugin instance for the Bukkit-Scheduler.
Keep a list of all your active schedules somewhere, so you can easily cancel them.
Always remember to call
Make sure to cancel all active schedules in
Register the type🔗
To register the new schedule type to BetonQuest, use the following method:
BetonQuest.getInstance().registerScheduleType("redstoneScheduler"/* (1)! */, MyCustomSchedule.class/* (2)! */,new MyCustomScheduler()/* (3)! */);
The name of your new schedule type to use in configs.
Your Schedule class.
A new instance of your Scheduler.
You'll need to call it after BetonQuest was enabled.