java.lang.Object
io.github.projectunified.minelib.scheduler.common.util.task.FoliaTask
All Implemented Interfaces:
Task

public class FoliaTask extends Object implements Task
A wrapped Task for a ScheduledTask
  • Constructor Details

    • FoliaTask

      public FoliaTask(io.papermc.paper.threadedregions.scheduler.ScheduledTask scheduledTask)
      Create a new instance of FoliaTask
      Parameters:
      scheduledTask - the ScheduledTask to wrap
  • Method Details

    • wrapRunnable

      public static Consumer<io.papermc.paper.threadedregions.scheduler.ScheduledTask> wrapRunnable(BooleanSupplier runnable)
      Wrap a BooleanSupplier into a Consumer of ScheduledTask
      Parameters:
      runnable - the runnable to wrap
      Returns:
      the wrapped runnable
    • wrapRunnable

      public static Consumer<io.papermc.paper.threadedregions.scheduler.ScheduledTask> wrapRunnable(Runnable runnable)
      Wrap a Runnable into a Consumer of ScheduledTask
      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 original ScheduledTask
      Returns:
      the original ScheduledTask
    • isCancelled

      public boolean isCancelled()
      Description copied from interface: Task
      Check if the task is cancelled
      Specified by:
      isCancelled in interface Task
      Returns:
      true if the task is cancelled
    • isDone

      public boolean isDone()
      Description copied from interface: Task
      Check if the task is done
      Specified by:
      isDone in interface Task
      Returns:
      true if the task is done
    • cancel

      public void cancel()
      Description copied from interface: Task
      Cancel the task
      Specified by:
      cancel in interface Task
    • getPlugin

      public org.bukkit.plugin.Plugin getPlugin()
      Description copied from interface: Task
      Get the plugin that owns the task
      Specified by:
      getPlugin in interface Task
      Returns:
      the plugin