Class ReactorBukkitScheduler
java.lang.Object
io.github.simplexdevelopment.scheduler.ReactorBukkitScheduler
- All Implemented Interfaces:
reactor.core.Disposable
,reactor.core.scheduler.Scheduler
,reactor.core.scheduler.Scheduler.Worker
public final class ReactorBukkitScheduler
extends Object
implements reactor.core.scheduler.Scheduler, reactor.core.scheduler.Scheduler.Worker
An abstraction layer over the
BukkitScheduler
to allow for the use as a Scheduler
.
This will allow us to perform non-blocking operations on the main server thread.-
Nested Class Summary
Nested classes/interfaces inherited from interface reactor.core.Disposable
reactor.core.Disposable.Composite, reactor.core.Disposable.Swap
Nested classes/interfaces inherited from interface reactor.core.scheduler.Scheduler
reactor.core.scheduler.Scheduler.Worker
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescription@NotNull reactor.core.scheduler.Scheduler.Worker
A newScheduler.Worker
.void
dispose()
Deprecated.@NotNull reactor.core.Disposable
Delegates to theBukkitScheduler
.@NotNull reactor.core.Disposable
Delegates to theBukkitScheduler
with a delay.@NotNull reactor.core.Disposable
schedulePeriodically
(@NotNull Runnable task, long initialDelay, long period, @Nullable TimeUnit unit) Delegates to theBukkitScheduler
with a delay and a period.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface reactor.core.Disposable
isDisposed
Methods inherited from interface reactor.core.scheduler.Scheduler
disposeGracefully, now, start
-
Field Details
-
plugin
private final org.bukkit.plugin.java.JavaPlugin pluginThe plugin instance. -
scheduler
private final org.bukkit.scheduler.BukkitScheduler schedulerThe bukkit scheduler.
-
-
Constructor Details
-
ReactorBukkitScheduler
public ReactorBukkitScheduler(org.bukkit.plugin.java.JavaPlugin plugin)
-
-
Method Details
-
schedule
Delegates to theBukkitScheduler
.- Specified by:
schedule
in interfacereactor.core.scheduler.Scheduler
- Specified by:
schedule
in interfacereactor.core.scheduler.Scheduler.Worker
- Parameters:
task
- The task to delegate.- Returns:
- A disposable that can be used to cancel the task.
-
schedule
@NotNull public @NotNull reactor.core.Disposable schedule(@NotNull @NotNull Runnable task, long delay, @Deprecated @Nullable @Nullable TimeUnit unit) Delegates to theBukkitScheduler
with a delay.- Specified by:
schedule
in interfacereactor.core.scheduler.Scheduler
- Specified by:
schedule
in interfacereactor.core.scheduler.Scheduler.Worker
- Parameters:
task
- The task to delegatedelay
- The amount of time to wait before running the taskunit
- Unused parameter in this implementation. Regardless of what value you use, this parameter will never be called.- Returns:
- A disposable that can be used to cancel the task.
-
schedulePeriodically
@NotNull public @NotNull reactor.core.Disposable schedulePeriodically(@NotNull @NotNull Runnable task, long initialDelay, long period, @Deprecated @Nullable @Nullable TimeUnit unit) Delegates to theBukkitScheduler
with a delay and a period. The initial delay may be 0L, but the period must be greater than 0L.- Specified by:
schedulePeriodically
in interfacereactor.core.scheduler.Scheduler
- Specified by:
schedulePeriodically
in interfacereactor.core.scheduler.Scheduler.Worker
- Parameters:
task
- The task to delegate.initialDelay
- The amount of time to wait before running the task.period
- The amount of time to wait between each execution of the task.unit
- Unused parameter in this implementation. Regardless of what value you use, this parameter will never be called.- Returns:
- A disposable that can be used to cancel the task.
-
createWorker
@NotNull public @NotNull reactor.core.scheduler.Scheduler.Worker createWorker()A newScheduler.Worker
.- Specified by:
createWorker
in interfacereactor.core.scheduler.Scheduler
- Returns:
- This class instance, as it implements
Scheduler.Worker
.
-
dispose
Deprecated.This method does nothing and is unused.- Specified by:
dispose
in interfacereactor.core.Disposable
- Specified by:
dispose
in interfacereactor.core.scheduler.Scheduler
-