Interface RegionScheduler
public interface RegionScheduler
The region task scheduler can be used to schedule tasks by location to be executed on the region which owns the location.
Note: It is entirely inappropriate to use the region scheduler to schedule tasks for entities.
If you wish to schedule tasks to perform actions on entities, you should be using Entity.getScheduler()
as the entity scheduler will "follow" an entity if it is teleported, whereas the region task scheduler
will not.
-
Method Summary
Modifier and TypeMethodDescriptiondefault void
Schedules a task to be executed on the region which owns the location.void
execute
(@NotNull Plugin plugin, @NotNull World world, int chunkX, int chunkZ, @NotNull Runnable run) Schedules a task to be executed on the region which owns the location.default @NotNull ScheduledTask
Schedules a task to be executed on the region which owns the location on the next tick.run
(@NotNull Plugin plugin, @NotNull World world, int chunkX, int chunkZ, @NotNull Consumer<ScheduledTask> task) Schedules a task to be executed on the region which owns the location on the next tick.default @NotNull ScheduledTask
runAtFixedRate
(@NotNull Plugin plugin, @NotNull Location location, @NotNull Consumer<ScheduledTask> task, long initialDelayTicks, long periodTicks) Schedules a repeating task to be executed on the region which owns the location after the initial delay with the specified period.runAtFixedRate
(@NotNull Plugin plugin, @NotNull World world, int chunkX, int chunkZ, @NotNull Consumer<ScheduledTask> task, long initialDelayTicks, long periodTicks) Schedules a repeating task to be executed on the region which owns the location after the initial delay with the specified period.default @NotNull ScheduledTask
runDelayed
(@NotNull Plugin plugin, @NotNull Location location, @NotNull Consumer<ScheduledTask> task, long delayTicks) Schedules a task to be executed on the region which owns the location after the specified delay in ticks.runDelayed
(@NotNull Plugin plugin, @NotNull World world, int chunkX, int chunkZ, @NotNull Consumer<ScheduledTask> task, long delayTicks) Schedules a task to be executed on the region which owns the location after the specified delay in ticks.
-
Method Details
-
execute
void execute(@NotNull @NotNull Plugin plugin, @NotNull @NotNull World world, int chunkX, int chunkZ, @NotNull @NotNull Runnable run) Schedules a task to be executed on the region which owns the location.- Parameters:
plugin
- The plugin that owns the taskworld
- The world of the region that owns the taskchunkX
- The chunk X coordinate of the region that owns the taskchunkZ
- The chunk Z coordinate of the region that owns the taskrun
- The task to execute
-
execute
default void execute(@NotNull @NotNull Plugin plugin, @NotNull @NotNull Location location, @NotNull @NotNull Runnable run) Schedules a task to be executed on the region which owns the location.- Parameters:
plugin
- The plugin that owns the tasklocation
- The location at which the region executing should ownrun
- The task to execute
-
run
@NotNull @NotNull ScheduledTask run(@NotNull @NotNull Plugin plugin, @NotNull @NotNull World world, int chunkX, int chunkZ, @NotNull @NotNull Consumer<ScheduledTask> task) Schedules a task to be executed on the region which owns the location on the next tick.- Parameters:
plugin
- The plugin that owns the taskworld
- The world of the region that owns the taskchunkX
- The chunk X coordinate of the region that owns the taskchunkZ
- The chunk Z coordinate of the region that owns the tasktask
- The task to execute- Returns:
- The
ScheduledTask
that represents the scheduled task.
-
run
@NotNull default @NotNull ScheduledTask run(@NotNull @NotNull Plugin plugin, @NotNull @NotNull Location location, @NotNull @NotNull Consumer<ScheduledTask> task) Schedules a task to be executed on the region which owns the location on the next tick.- Parameters:
plugin
- The plugin that owns the tasklocation
- The location at which the region executing should owntask
- The task to execute- Returns:
- The
ScheduledTask
that represents the scheduled task.
-
runDelayed
@NotNull @NotNull ScheduledTask runDelayed(@NotNull @NotNull Plugin plugin, @NotNull @NotNull World world, int chunkX, int chunkZ, @NotNull @NotNull Consumer<ScheduledTask> task, long delayTicks) Schedules a task to be executed on the region which owns the location after the specified delay in ticks.- Parameters:
plugin
- The plugin that owns the taskworld
- The world of the region that owns the taskchunkX
- The chunk X coordinate of the region that owns the taskchunkZ
- The chunk Z coordinate of the region that owns the tasktask
- The task to executedelayTicks
- The delay, in ticks.- Returns:
- The
ScheduledTask
that represents the scheduled task.
-
runDelayed
@NotNull default @NotNull ScheduledTask runDelayed(@NotNull @NotNull Plugin plugin, @NotNull @NotNull Location location, @NotNull @NotNull Consumer<ScheduledTask> task, long delayTicks) Schedules a task to be executed on the region which owns the location after the specified delay in ticks.- Parameters:
plugin
- The plugin that owns the tasklocation
- The location at which the region executing should owntask
- The task to executedelayTicks
- The delay, in ticks.- Returns:
- The
ScheduledTask
that represents the scheduled task.
-
runAtFixedRate
@NotNull @NotNull ScheduledTask runAtFixedRate(@NotNull @NotNull Plugin plugin, @NotNull @NotNull World world, int chunkX, int chunkZ, @NotNull @NotNull Consumer<ScheduledTask> task, long initialDelayTicks, long periodTicks) Schedules a repeating task to be executed on the region which owns the location after the initial delay with the specified period.- Parameters:
plugin
- The plugin that owns the taskworld
- The world of the region that owns the taskchunkX
- The chunk X coordinate of the region that owns the taskchunkZ
- The chunk Z coordinate of the region that owns the tasktask
- The task to executeinitialDelayTicks
- The initial delay, in ticks.periodTicks
- The period, in ticks.- Returns:
- The
ScheduledTask
that represents the scheduled task.
-
runAtFixedRate
@NotNull default @NotNull ScheduledTask runAtFixedRate(@NotNull @NotNull Plugin plugin, @NotNull @NotNull Location location, @NotNull @NotNull Consumer<ScheduledTask> task, long initialDelayTicks, long periodTicks) Schedules a repeating task to be executed on the region which owns the location after the initial delay with the specified period.- Parameters:
plugin
- The plugin that owns the tasklocation
- The location at which the region executing should owntask
- The task to executeinitialDelayTicks
- The initial delay, in ticks.periodTicks
- The period, in ticks.- Returns:
- The
ScheduledTask
that represents the scheduled task.
-