Class RepeatingTask
java.lang.Object
be.seeseemelk.mockbukkit.scheduler.ScheduledTask
be.seeseemelk.mockbukkit.scheduler.RepeatingTask
- All Implemented Interfaces:
BukkitTask
A
ScheduledTask
that can be repeated.-
Constructor Summary
ConstructorDescriptionRepeatingTask
(int id, Plugin plugin, boolean isSync, long scheduledTick, long period, @NotNull Runnable runnable) Constructs a newRepeatingTask
with the provided parameters.RepeatingTask
(int id, Plugin plugin, boolean isSync, long scheduledTick, long period, @NotNull Consumer<BukkitTask> consumer) Constructs a newRepeatingTask
with the provided parameters. -
Method Summary
Modifier and TypeMethodDescriptionlong
Gets the period of the timer.void
Updates the scheduled tick for the next run.Methods inherited from class be.seeseemelk.mockbukkit.scheduler.ScheduledTask
addOnCancelled, cancel, getConsumer, getOwner, getRunnable, getScheduledTick, getTaskId, isCancelled, isRunning, isSync, run, setRunning, setScheduledTick
-
Constructor Details
-
RepeatingTask
public RepeatingTask(int id, Plugin plugin, boolean isSync, long scheduledTick, long period, @NotNull @NotNull Runnable runnable) Constructs a newRepeatingTask
with the provided parameters.- Parameters:
id
- The task ID.plugin
- The plugin owning the task.isSync
- Whether the task is synchronous.scheduledTick
- The tick the task is scheduled to run at.period
- How often the task should run.runnable
- The runnable to run.
-
RepeatingTask
public RepeatingTask(int id, Plugin plugin, boolean isSync, long scheduledTick, long period, @NotNull @NotNull Consumer<BukkitTask> consumer) Constructs a newRepeatingTask
with the provided parameters.- Parameters:
id
- The task ID.plugin
- The plugin owning the task.isSync
- Whether the task is synchronous.scheduledTick
- The tick the task is scheduled to run at.period
- How often the task should run.consumer
- The consumer to run.
-
-
Method Details
-
getPeriod
public long getPeriod()Gets the period of the timer.- Returns:
- The period of the timer.
-
updateScheduledTick
public void updateScheduledTick()Updates the scheduled tick for the next run.
-