Class FoliaTask
java.lang.Object
io.github.projectunified.minelib.scheduler.common.util.task.FoliaTask
- All Implemented Interfaces:
Task
A wrapped
Task for a ScheduledTask-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidcancel()Cancel the taskorg.bukkit.plugin.PluginGet the plugin that owns the taskio.papermc.paper.threadedregions.scheduler.ScheduledTaskGet the originalScheduledTaskbooleanCheck if the task is cancelledbooleanisDone()Check if the task is donestatic longnormalizedTicks(long ticks) Normalize the ticks to be at least 1static Consumer<io.papermc.paper.threadedregions.scheduler.ScheduledTask>wrapRunnable(Runnable runnable) static Consumer<io.papermc.paper.threadedregions.scheduler.ScheduledTask>wrapRunnable(BooleanSupplier runnable)
-
Constructor Details
-
FoliaTask
public FoliaTask(io.papermc.paper.threadedregions.scheduler.ScheduledTask scheduledTask) Create a new instance ofFoliaTask- Parameters:
scheduledTask- theScheduledTaskto wrap
-
-
Method Details
-
wrapRunnable
public static Consumer<io.papermc.paper.threadedregions.scheduler.ScheduledTask> wrapRunnable(BooleanSupplier runnable) - Parameters:
runnable- the runnable to wrap- Returns:
- the wrapped runnable
-
wrapRunnable
public static Consumer<io.papermc.paper.threadedregions.scheduler.ScheduledTask> wrapRunnable(Runnable runnable) - Parameters:
runnable- the runnable to wrap- Returns:
- the wrapped runnable
-
normalizedTicks
public static long normalizedTicks(long ticks) Normalize the ticks to be at least 1- Parameters:
ticks- the ticks to normalize- Returns:
- the normalized ticks
-
getScheduledTask
public io.papermc.paper.threadedregions.scheduler.ScheduledTask getScheduledTask()Get the originalScheduledTask- Returns:
- the original
ScheduledTask
-
isCancelled
public boolean isCancelled()Description copied from interface:TaskCheck if the task is cancelled- Specified by:
isCancelledin interfaceTask- Returns:
- true if the task is cancelled
-
isDone
public boolean isDone()Description copied from interface:TaskCheck if the task is done -
cancel
public void cancel()Description copied from interface:TaskCancel the task -
getPlugin
public org.bukkit.plugin.Plugin getPlugin()Description copied from interface:TaskGet the plugin that owns the task
-