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
-
Method Summary
Modifier and TypeMethodDescriptionvoid
cancel()
Cancel the taskorg.bukkit.plugin.Plugin
Get the plugin that owns the taskio.papermc.paper.threadedregions.scheduler.ScheduledTask
Get the originalScheduledTask
boolean
Check if the task is cancelledboolean
isDone()
Check if the task is donestatic long
normalizedTicks
(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
- theScheduledTask
to 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:Task
Check if the task is cancelled- Specified by:
isCancelled
in interfaceTask
- Returns:
- true if the task is cancelled
-
isDone
public boolean isDone()Description copied from interface:Task
Check if the task is done -
cancel
public void cancel()Description copied from interface:Task
Cancel the task -
getPlugin
public org.bukkit.plugin.Plugin getPlugin()Description copied from interface:Task
Get the plugin that owns the task
-