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
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
cancel()
Cancel this taskstatic void
Runs all tasksprotected org.bukkit.scheduler.BukkitRunnable
registerBukkitTask
(org.bukkit.scheduler.BukkitRunnable scheduledBukkitTask) Register a bukkit taskprotected void
registerFoliaTask
(io.papermc.paper.threadedregions.scheduler.ScheduledTask scheduledTask) Register a Folia taskprotected void
Register the task to all tasks that are currently runabstract void
runDelayed
(long delay) abstract void
runNow()
protected void
runTask()
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 asrunTask()
abstract void
runTaskTimer
(long period, long delay) protected void
setRepeatable
(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
-