Class ScheduledTask
java.lang.Object
be.seeseemelk.mockbukkit.scheduler.ScheduledTask
- All Implemented Interfaces:
org.bukkit.scheduler.BukkitTask
- Direct Known Subclasses:
RepeatingTask
-
Constructor Summary
ConstructorsConstructorDescriptionScheduledTask(int id, org.bukkit.plugin.Plugin plugin, boolean isSync, long scheduledTick, @NotNull Runnable runnable) ScheduledTask(int id, org.bukkit.plugin.Plugin plugin, boolean isSync, long scheduledTick, @NotNull Consumer<org.bukkit.scheduler.BukkitTask> consumer) -
Method Summary
Modifier and TypeMethodDescriptionvoidaddOnCancelled(Runnable callback) Adds a callback which is executed when the task is cancelled.voidcancel()Consumer<org.bukkit.scheduler.BukkitTask>Get the Consumer that will be run.@NotNull org.bukkit.plugin.PlugingetOwner()Get the task itself that will be run.longGet the tick at which the task is scheduled to run at.intbooleanbooleanbooleanisSync()voidrun()Runs the task if it has not been cancelled.voidsetRunning(boolean running) protected voidsetScheduledTick(long scheduledTick) Sets the tick at which the task is scheduled to run at.
-
Constructor Details
-
ScheduledTask
public ScheduledTask(int id, org.bukkit.plugin.Plugin plugin, boolean isSync, long scheduledTick, @NotNull @NotNull Runnable runnable) -
ScheduledTask
public ScheduledTask(int id, org.bukkit.plugin.Plugin plugin, boolean isSync, long scheduledTick, @NotNull @NotNull Consumer<org.bukkit.scheduler.BukkitTask> consumer)
-
-
Method Details
-
isRunning
public boolean isRunning() -
setRunning
public void setRunning(boolean running) -
getScheduledTick
public long getScheduledTick()Get the tick at which the task is scheduled to run at.- Returns:
- The tick the task is scheduled to run at.
-
setScheduledTick
protected void setScheduledTick(long scheduledTick) Sets the tick at which the task is scheduled to run at.- Parameters:
scheduledTick- The tick at which the task is scheduled to run at.
-
getRunnable
Get the task itself that will be run.- Returns:
- The task that will be run.
-
getConsumer
Get the Consumer that will be run.- Returns:
- The consumer that will be run.
-
run
public void run()Runs the task if it has not been cancelled. -
getTaskId
public int getTaskId()- Specified by:
getTaskIdin interfaceorg.bukkit.scheduler.BukkitTask
-
getOwner
@NotNull public @NotNull org.bukkit.plugin.Plugin getOwner()- Specified by:
getOwnerin interfaceorg.bukkit.scheduler.BukkitTask
-
isSync
public boolean isSync()- Specified by:
isSyncin interfaceorg.bukkit.scheduler.BukkitTask
-
isCancelled
public boolean isCancelled()- Specified by:
isCancelledin interfaceorg.bukkit.scheduler.BukkitTask
-
cancel
public void cancel()- Specified by:
cancelin interfaceorg.bukkit.scheduler.BukkitTask
-
addOnCancelled
Adds a callback which is executed when the task is cancelled.- Parameters:
callback- The callback which gets executed when the task is cancelled.
-