Class StargateTask

java.lang.Object
org.sgrewritten.stargate.thread.task.StargateTask
All Implemented Interfaces:
Runnable
Direct Known Subclasses:
StargateAsyncTask, StargateEntityTask, StargateGlobalTask, StargateQueuedAsyncTask, StargateRegionTask

public abstract class StargateTask extends Object implements Runnable
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected static final boolean
     
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Cancel this task
    static void
    Runs all tasks
    protected org.bukkit.scheduler.BukkitRunnable
    registerBukkitTask(org.bukkit.scheduler.BukkitRunnable scheduledBukkitTask)
    Register a bukkit task
    protected void
    registerFoliaTask(io.papermc.paper.threadedregions.scheduler.ScheduledTask scheduledTask)
    Register a Folia task
    protected void
    Register the task to all tasks that are currently run
    abstract void
    runDelayed(long delay)
     
    abstract void
     
    protected void
    Run the task if not already been running (should be threadsafe)
    protected void
    runTask(io.papermc.paper.threadedregions.scheduler.ScheduledTask scheduledTask)
    Convenience method, does same as runTask()
    abstract void
    runTaskTimer(long period, long delay)
     
    protected void
    setRepeatable(boolean repeatable)
    Should the task repeat itself?

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface java.lang.Runnable

    run
  • Field Details

    • USING_FOLIA

      protected static final boolean USING_FOLIA
  • Constructor Details

    • StargateTask

      public StargateTask()
  • Method Details

    • runDelayed

      public abstract void runDelayed(long delay)
    • runNow

      public abstract void runNow()
    • runTaskTimer

      public abstract void runTaskTimer(long period, long delay)
    • cancel

      public void cancel()
      Cancel this task
    • registerTask

      protected void registerTask()
      Register the task to all tasks that are currently run
    • registerFoliaTask

      protected void registerFoliaTask(io.papermc.paper.threadedregions.scheduler.ScheduledTask scheduledTask)
      Register a Folia task
      Parameters:
      scheduledTask -

      The id of the task

    • registerBukkitTask

      protected org.bukkit.scheduler.BukkitRunnable registerBukkitTask(org.bukkit.scheduler.BukkitRunnable scheduledBukkitTask)
      Register a bukkit task
      Parameters:
      scheduledBukkitTask -

      The ID of the task

      Returns:

      A bukkit runnable

    • forceRunAllTasks

      public static void forceRunAllTasks()
      Runs all tasks
    • runTask

      protected void runTask()
      Run the task if not already been running (should be threadsafe)
    • runTask

      protected void runTask(io.papermc.paper.threadedregions.scheduler.ScheduledTask scheduledTask)
      Convenience method, does same as runTask()
      Parameters:
      scheduledTask -
    • setRepeatable

      protected void setRepeatable(boolean repeatable)
      Should the task repeat itself?
      Parameters:
      repeatable -

      Change the task to repeat it self, or to stop repeating itself