Class SchedulingSystem<T extends org.bukkit.plugin.java.JavaPlugin>
java.lang.Object
io.github.simplexdevelopment.scheduler.SchedulingSystem<T>
- Type Parameters:
T- Your plugin class, which extendsJavaPlugin.
- All Implemented Interfaces:
ISchedule
public final class SchedulingSystem<T extends org.bukkit.plugin.java.JavaPlugin>
extends Object
implements ISchedule
This class is used to manage the scheduling of
IServices,
and the creation of ServicePools through the ServiceManager.
The ServiceManager should be used to create new ServicePools on
initialization of your plugin, and your IServices should be registered in the
JavaPlugin.onEnable() method. You can then use the queue(IService) method
to then queue up your services, or call queueAll() to queue up all services in every pool.
forceStart(IService) and forceStop(IService) will forcefully start and stop the services, respectively.
getMainScheduler() gets the main scheduler for the scheduling system, which is a ReactorBukkitScheduler object.- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescription(package private) static intA denominator to use when registering default service pool names.private final ReactorBukkitSchedulerThe main scheduler which this system runs on.private final TThe plugin to use for registering tasks.private final ServiceManagerThe service manager to use for controlling service pools. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionreactor.core.publisher.Mono<Void>forceStart(IService service) reactor.core.publisher.Mono<Void>@NotNull reactor.core.publisher.Mono<T>@NotNull reactor.core.publisher.Mono<ServiceManager>@NotNull reactor.core.publisher.Mono<reactor.core.Disposable>Queues a service to be executed in a service pool.reactor.core.publisher.Flux<reactor.core.Disposable>queueAll()@NotNull reactor.core.publisher.Mono<Void>
-
Field Details
-
denom
static int denomA denominator to use when registering default service pool names. -
serviceManager
The service manager to use for controlling service pools. -
plugin
The plugin to use for registering tasks. This should be an instance of your plugin. -
mainScheduler
The main scheduler which this system runs on. This is an abstraction of theBukkitScheduler, and as a result runs on the Main server thread.
-
-
Constructor Details
-
SchedulingSystem
Creates a new instance of the scheduling system. This is used to manage the scheduling of services.- Parameters:
plugin- The plugin to use for this scheduling system. This should be an instance of your plugin.
-
-
Method Details
-
getServiceManager
- Specified by:
getServiceManagerin interfaceISchedule- Returns:
- The service manager which exerts control over the service pools and their associated services.
-
queue
@NotNull public @NotNull reactor.core.publisher.Mono<reactor.core.Disposable> queue(@NotNull @NotNull IService service) Description copied from interface:IScheduleQueues a service to be executed in a service pool. -
queueAll
public reactor.core.publisher.Flux<reactor.core.Disposable> queueAll() -
runOnce
-
forceStop
-
forceStart
- Specified by:
forceStartin interfaceISchedule- Parameters:
service- The service to forcefully start.- Returns:
- A Mono object which can be used to forcefully start the service with
Mono.subscribe().
-
getProvidingPlugin
- Returns:
- A Mono object containing your plugin, for non-blocking communication.
-
getMainScheduler
- Returns:
- The main thread which the scheduling system operates on.
-