Class StargateTask
java.lang.Object
org.sgrewritten.stargate.thread.task.StargateTask
- All Implemented Interfaces:
Runnable
- Direct Known Subclasses:
StargateAsyncTask,StargateEntityTask,StargateGlobalTask,StargateQueuedAsyncTask,StargateRegionTask
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidcancel()Cancel this taskstatic voidRuns all tasksprotected org.bukkit.scheduler.BukkitRunnableregisterBukkitTask(org.bukkit.scheduler.BukkitRunnable scheduledBukkitTask) Register a bukkit taskprotected voidregisterFoliaTask(io.papermc.paper.threadedregions.scheduler.ScheduledTask scheduledTask) Register a Folia taskprotected voidRegister the task to all tasks that are currently runabstract voidrunDelayed(long delay) abstract voidrunNow()protected voidrunTask()Run the task if not already been running (should be threadsafe)protected voidrunTask(io.papermc.paper.threadedregions.scheduler.ScheduledTask scheduledTask) Convenience method, does same asrunTask()abstract voidrunTaskTimer(long period, long delay) protected voidsetRepeatable(boolean repeatable) Should the task repeat itself?
-
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 asrunTask()- 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
-