Class SpigotScheduler

java.lang.Object
net.citizensnpcs.api.util.schedulers.adapter.SpigotScheduler
All Implemented Interfaces:
SchedulerAdapter

public class SpigotScheduler extends Object implements SchedulerAdapter
  • Constructor Details

    • SpigotScheduler

      public SpigotScheduler(Plugin plugin)
  • Method Details

    • runEntityTask

      public SchedulerTask runEntityTask(Entity entity, Runnable runnable)
      Description copied from interface: SchedulerAdapter
      Executes a task specifically linked to an entity immediately. On Spigot, this defaults to the global thread.
      Specified by:
      runEntityTask in interface SchedulerAdapter
    • runEntityTaskLater

      public SchedulerTask runEntityTaskLater(Entity entity, Runnable runnable, long delayTicks)
      Description copied from interface: SchedulerAdapter
      Executes a task specifically linked to an entity after a delay. On Spigot, this defaults to the global thread.
      Specified by:
      runEntityTaskLater in interface SchedulerAdapter
      Parameters:
      delayTicks - Delay before execution, measured in ticks.
    • runEntityTaskTimer

      public SchedulerTask runEntityTaskTimer(Entity entity, Runnable runnable, long delayTicks, long periodTicks)
      Description copied from interface: SchedulerAdapter
      Executes a repeating task specifically linked to an entity. On Spigot, this defaults to the global thread.
      Specified by:
      runEntityTaskTimer in interface SchedulerAdapter
      Parameters:
      delayTicks - Initial delay before the first execution (in ticks).
      periodTicks - Period between each subsequent execution (in ticks).
    • runRegionTask

      public SchedulerTask runRegionTask(Location location, Runnable runnable)
      Description copied from interface: SchedulerAdapter
      Executes a task associated with a specific region or chunk. On Spigot, this defaults to the global thread.
      Specified by:
      runRegionTask in interface SchedulerAdapter
    • runRegionTask

      public SchedulerTask runRegionTask(World world, int chunkX, int chunkZ, Runnable runnable)
      Description copied from interface: SchedulerAdapter
      Executes a task associated with a specific region or chunk. On Spigot, this defaults to the global thread.
      Specified by:
      runRegionTask in interface SchedulerAdapter
    • runRegionTaskLater

      public SchedulerTask runRegionTaskLater(Location location, Runnable runnable, long delayTicks)
      Description copied from interface: SchedulerAdapter
      Executes a task associated with a specific region or chunk after a delay. On Spigot, this defaults to the global thread.
      Specified by:
      runRegionTaskLater in interface SchedulerAdapter
      Parameters:
      delayTicks - Delay before execution, measured in ticks.
    • runRegionTaskLater

      public SchedulerTask runRegionTaskLater(World world, int chunkX, int chunkZ, Runnable runnable, long delayTicks)
      Description copied from interface: SchedulerAdapter
      Executes a task associated with a specific region or chunk after a delay. On Spigot, this defaults to the global thread.
      Specified by:
      runRegionTaskLater in interface SchedulerAdapter
      Parameters:
      delayTicks - Delay before execution, measured in ticks.
    • runRegionTaskTimer

      public SchedulerTask runRegionTaskTimer(Location location, Runnable runnable, long delayTicks, long periodTicks)
      Description copied from interface: SchedulerAdapter
      Executes a repeating task associated with a specific region or chunk. On Spigot, this defaults to the global thread.
      Specified by:
      runRegionTaskTimer in interface SchedulerAdapter
      Parameters:
      delayTicks - Initial delay before the first execution (in ticks).
      periodTicks - Period between each subsequent execution (in ticks).
    • runRegionTaskTimer

      public SchedulerTask runRegionTaskTimer(World world, int chunkX, int chunkZ, Runnable runnable, long delayTicks, long periodTicks)
      Description copied from interface: SchedulerAdapter
      Executes a repeating task associated with a specific region or chunk. On Spigot, this defaults to the global thread.
      Specified by:
      runRegionTaskTimer in interface SchedulerAdapter
      Parameters:
      delayTicks - Initial delay before the first execution (in ticks).
      periodTicks - Period between each subsequent execution (in ticks).
    • runTask

      public SchedulerTask runTask(Runnable runnable)
      Description copied from interface: SchedulerAdapter
      Executes a task on the global server thread.
      Specified by:
      runTask in interface SchedulerAdapter
    • runTaskAsynchronously

      public SchedulerTask runTaskAsynchronously(Runnable runnable)
      Description copied from interface: SchedulerAdapter
      Executes a task asynchronously immediately, off the main server thread.
      Specified by:
      runTaskAsynchronously in interface SchedulerAdapter
    • runTaskLater

      public SchedulerTask runTaskLater(Runnable runnable, long delayTicks)
      Description copied from interface: SchedulerAdapter
      Executes a task on the global server thread after a specified delay.
      Specified by:
      runTaskLater in interface SchedulerAdapter
      Parameters:
      delayTicks - Delay before execution, measured in server ticks (1 tick = 50ms).
    • runTaskLaterAsynchronously

      public SchedulerTask runTaskLaterAsynchronously(Runnable runnable, long delayTicks)
      Description copied from interface: SchedulerAdapter
      Executes an asynchronous task after a specified delay.
      Specified by:
      runTaskLaterAsynchronously in interface SchedulerAdapter
      Parameters:
      delayTicks - Delay before execution, measured in ticks.
    • runTaskTimer

      public SchedulerTask runTaskTimer(Runnable runnable, long delayTicks, long periodTicks)
      Description copied from interface: SchedulerAdapter
      Executes a repeating task on the global server thread.
      Specified by:
      runTaskTimer in interface SchedulerAdapter
      Parameters:
      delayTicks - Initial delay before the first execution (in ticks).
      periodTicks - Period between each subsequent execution (in ticks).
    • runTaskTimerAsynchronously

      public SchedulerTask runTaskTimerAsynchronously(Runnable runnable, long delayTicks, long periodTicks)
      Description copied from interface: SchedulerAdapter
      Executes an asynchronous repeating task.
      Specified by:
      runTaskTimerAsynchronously in interface SchedulerAdapter
      Parameters:
      delayTicks - Initial delay before the first execution (in ticks).
      periodTicks - Period between each subsequent execution (in ticks).
    • isOnOwnerThread

      public boolean isOnOwnerThread(Entity entity)
      Description copied from interface: SchedulerAdapter
      Returns true if the current thread is the correct owner thread for safely accessing the target.

      Spigot: true if running on the main server thread.

      Folia: true if the current thread owns the target's region (isOwnedByCurrentRegion).

      Specified by:
      isOnOwnerThread in interface SchedulerAdapter
      Parameters:
      entity - the target entity
      Returns:
      true if the current thread is the owner thread for the entity; false otherwise
    • isOnOwnerThread

      public boolean isOnOwnerThread(Location location)
      Description copied from interface: SchedulerAdapter
      Returns true if the current thread is the correct owner thread for safely accessing the target.

      Spigot: true if running on the main server thread.

      Folia: true if the current thread owns the target's region (isOwnedByCurrentRegion).

      Specified by:
      isOnOwnerThread in interface SchedulerAdapter
      Parameters:
      location - the target location
      Returns:
      true if the current thread is the owner thread for the location; false otherwise
    • isOnOwnerThread

      public boolean isOnOwnerThread(World world, int chunkX, int chunkZ)
      Description copied from interface: SchedulerAdapter
      Returns true if the current thread is the correct owner thread for safely accessing the target.

      Spigot: true if running on the main server thread.

      Folia: true if the current thread owns the target's region (isOwnedByCurrentRegion).

      Specified by:
      isOnOwnerThread in interface SchedulerAdapter
      Parameters:
      world - the target world
      chunkX - the target chunk X coordinate
      chunkZ - the target chunk Z coordinate
      Returns:
      true if the current thread is the owner thread for the chunk; false otherwise
    • isOnOwnerThread

      public boolean isOnOwnerThread(Block block)
      Description copied from interface: SchedulerAdapter
      Returns true if the current thread is the correct owner thread for safely accessing the target.

      Spigot: true if running on the main server thread.

      Folia: true if the current thread owns the target's region (isOwnedByCurrentRegion).

      Specified by:
      isOnOwnerThread in interface SchedulerAdapter
      Parameters:
      block - the target block
      Returns:
      true if the current thread is the owner thread for the block; false otherwise