API interface for interacting with EssentialsC's schedule system. Schedules are
loaded from schedules.yml and support both time-based (cron-like)
and interval-based triggering. All schedule state changes are synchronous and
must be called on the main thread.
Retrieve an instance via EssentialsCAPI.getSchedulesApi().
SchedulesApi schedules = APIProvider.getAPI().getSchedulesApi();
schedules.getSchedule("announcement").ifPresent(s -> {
if (s.isActive()) {
schedules.runNow("announcement");
}
});
The ScheduleEntry record lives in the
net.godlycow.org.essc.api.schedule sub-package.
Method Summary
| List<String> |
getScheduleNames() Returns a list of all configured schedule names. |
| Optional<ScheduleEntry> |
getSchedule(String name) Returns the schedule entry with the given name, if it exists. |
| List<ScheduleEntry> |
getAllSchedules() Returns all configured schedules as a list. |
| boolean |
isMasterEnabled() Returns whether the schedule system master switch is enabled. |
| void |
setMasterEnabled(boolean enabled) Sets the master enable state for the schedule system. |
| boolean |
runNow(String name) Immediately executes the schedule with the given name. |
| boolean |
pause(String name) Pauses the schedule with the given name. |
| boolean |
resume(String name) Resumes the schedule with the given name. |
| void |
reload() Reloads all schedules from disk. |
Returns a list of all configured schedule names.
Returns:| List<String> | an unmodifiable list of schedule names; never null |
Returns the schedule entry with the given name, if it exists.
Parameters:| name | the schedule name to look up; must not be null |
| Optional<ScheduleEntry> | an Optional containing the schedule, or empty if not found |
Returns all configured schedules as a list.
Returns:| List<ScheduleEntry> | an unmodifiable list of all schedules; never null |
Returns whether the schedule system master switch is enabled.
Returns:| boolean | true if schedules are globally enabled |
Sets the master enable state for the schedule system.
When disabled, all scheduled tasks are stopped. When enabled, tasks are restarted according to their individual configurations. This change is persisted to schedules.yml.
| enabled | true to enable schedules globally |
Immediately executes the schedule with the given name.
Runs all actions for the schedule's current target players, regardless of trigger conditions or cooldowns.
| name | the schedule to run; must not be null |
| boolean | true if the schedule was found and executed |
Pauses the schedule with the given name.
Paused schedules will not trigger automatically, but can still be executed manually via runNow(String).
| name | the schedule to pause; must not be null |
| boolean | true if the schedule was found and is now paused |
Resumes the schedule with the given name.
Unpauses a previously paused schedule, allowing it to trigger automatically again.
| name | the schedule to resume; must not be null |
| boolean | true if the schedule was found and is now resumed |
Reloads all schedules from disk.
Re-reads schedules.yml, stops all current tasks, and restarts them with the new configuration. This is equivalent to /schedules reload.