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 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 task
      world - The world of the region that owns the task
      chunkX - The chunk X coordinate of the region that owns the task
      chunkZ - The chunk Z coordinate of the region that owns the task
      run - 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 task
      location - The location at which the region executing should own
      run - The task to execute
    • run

      Schedules a task to be executed on the region which owns the location on the next tick.
      Parameters:
      plugin - The plugin that owns the task
      world - The world of the region that owns the task
      chunkX - The chunk X coordinate of the region that owns the task
      chunkZ - The chunk Z coordinate of the region that owns the task
      task - The task to execute
      Returns:
      The ScheduledTask that represents the scheduled task.
    • run

      Schedules a task to be executed on the region which owns the location on the next tick.
      Parameters:
      plugin - The plugin that owns the task
      location - The location at which the region executing should own
      task - 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 task
      world - The world of the region that owns the task
      chunkX - The chunk X coordinate of the region that owns the task
      chunkZ - The chunk Z coordinate of the region that owns the task
      task - The task to execute
      delayTicks - 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 task
      location - The location at which the region executing should own
      task - The task to execute
      delayTicks - 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 task
      world - The world of the region that owns the task
      chunkX - The chunk X coordinate of the region that owns the task
      chunkZ - The chunk Z coordinate of the region that owns the task
      task - The task to execute
      initialDelayTicks - 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 task
      location - The location at which the region executing should own
      task - The task to execute
      initialDelayTicks - The initial delay, in ticks.
      periodTicks - The period, in ticks.
      Returns:
      The ScheduledTask that represents the scheduled task.