Class GlobalRegionScheduler
java.lang.Object
io.github.retrooper.packetevents.util.folia.GlobalRegionScheduler
Represents a scheduler for executing global region tasks.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
cancel
(@NotNull org.bukkit.plugin.Plugin plugin) Attempts to cancel all tasks scheduled by the specified plugin.void
Schedules a task to be executed on the global region.Schedules a task to be executed on the global region.runAtFixedRate
(@NotNull org.bukkit.plugin.Plugin plugin, @NotNull Consumer<Object> task, long initialDelayTicks, long periodTicks) Schedules a repeating task to be executed on the global region after the initial delay with the specified period.runDelayed
(@NotNull org.bukkit.plugin.Plugin plugin, @NotNull Consumer<Object> task, long delay) Schedules a task to be executed on the global region after the specified delay in ticks.
-
Constructor Details
-
GlobalRegionScheduler
protected GlobalRegionScheduler()
-
-
Method Details
-
execute
public void execute(@NotNull @NotNull org.bukkit.plugin.Plugin plugin, @NotNull @NotNull Runnable run) Schedules a task to be executed on the global region.- Parameters:
plugin
- The plugin that owns the taskrun
- The task to execute
-
run
public TaskWrapper run(@NotNull @NotNull org.bukkit.plugin.Plugin plugin, @NotNull @NotNull Consumer<Object> task) Schedules a task to be executed on the global region.- Parameters:
plugin
- The plugin that owns the tasktask
- The task to execute- Returns:
TaskWrapper
instance representing a wrapped task
-
runDelayed
public TaskWrapper runDelayed(@NotNull @NotNull org.bukkit.plugin.Plugin plugin, @NotNull @NotNull Consumer<Object> task, long delay) Schedules a task to be executed on the global region after the specified delay in ticks.- Parameters:
plugin
- The plugin that owns the tasktask
- The task to executedelay
- The delay, in ticks before the method is invoked. Any value less-than 1 is treated as 1.- Returns:
TaskWrapper
instance representing a wrapped task
-
runAtFixedRate
public TaskWrapper runAtFixedRate(@NotNull @NotNull org.bukkit.plugin.Plugin plugin, @NotNull @NotNull Consumer<Object> task, long initialDelayTicks, long periodTicks) Schedules a repeating task to be executed on the global region after the initial delay with the specified period.- Parameters:
plugin
- The plugin that owns the tasktask
- The task to executeinitialDelayTicks
- The initial delay, in ticks before the method is invoked. Any value less-than 1 is treated as 1.periodTicks
- The period, in ticks. Any value less-than 1 is treated as 1.- Returns:
TaskWrapper
instance representing a wrapped task
-
cancel
public void cancel(@NotNull @NotNull org.bukkit.plugin.Plugin plugin) Attempts to cancel all tasks scheduled by the specified plugin.- Parameters:
plugin
- Specified plugin.
-