Interface SchedulerAdapter
- All Known Implementing Classes:
FoliaScheduler,SpigotScheduler
public interface SchedulerAdapter
An abstraction layer for scheduling tasks across different Minecraft server implementations, such as Folia and
Spigot.
Allows seamless compatibility by abstracting scheduling methods.
-
Method Summary
Modifier and TypeMethodDescriptionbooleanisOnOwnerThread(Block block) Returns true if the current thread is the correct owner thread for safely accessing the target.booleanisOnOwnerThread(Entity entity) Returns true if the current thread is the correct owner thread for safely accessing the target.booleanisOnOwnerThread(Location location) Returns true if the current thread is the correct owner thread for safely accessing the target.booleanisOnOwnerThread(World world, int chunkX, int chunkZ) Returns true if the current thread is the correct owner thread for safely accessing the target.runEntityTask(Entity entity, Runnable runnable) Executes a task specifically linked to an entity immediately.runEntityTaskLater(Entity entity, Runnable runnable, long delayTicks) Executes a task specifically linked to an entity after a delay.runEntityTaskTimer(Entity entity, Runnable runnable, long delayTicks, long periodTicks) Executes a repeating task specifically linked to an entity.runRegionTask(Location location, Runnable runnable) Executes a task associated with a specific region or chunk.runRegionTask(World world, int chunkX, int chunkZ, Runnable runnable) Executes a task associated with a specific region or chunk.runRegionTaskLater(Location location, Runnable runnable, long delayTicks) Executes a task associated with a specific region or chunk after a delay.runRegionTaskLater(World world, int chunkX, int chunkZ, Runnable runnable, long delayTicks) Executes a task associated with a specific region or chunk after a delay.runRegionTaskTimer(Location location, Runnable runnable, long delayTicks, long periodTicks) Executes a repeating task associated with a specific region or chunk.runRegionTaskTimer(World world, int chunkX, int chunkZ, Runnable runnable, long delayTicks, long periodTicks) Executes a repeating task associated with a specific region or chunk.Executes a task on the global server thread.runTaskAsynchronously(Runnable runnable) Executes a task asynchronously immediately, off the main server thread.runTaskLater(Runnable runnable, long delayTicks) Executes a task on the global server thread after a specified delay.runTaskLaterAsynchronously(Runnable runnable, long delayTicks) Executes an asynchronous task after a specified delay.runTaskTimer(Runnable runnable, long delayTicks, long periodTicks) Executes a repeating task on the global server thread.runTaskTimerAsynchronously(Runnable runnable, long delayTicks, long periodTicks) Executes an asynchronous repeating task.
-
Method Details
-
runEntityTask
Executes a task specifically linked to an entity immediately. On Spigot, this defaults to the global thread. -
runEntityTaskLater
Executes a task specifically linked to an entity after a delay. On Spigot, this defaults to the global thread.- Parameters:
delayTicks- Delay before execution, measured in ticks.
-
runEntityTaskTimer
SchedulerTask runEntityTaskTimer(Entity entity, Runnable runnable, long delayTicks, long periodTicks) Executes a repeating task specifically linked to an entity. On Spigot, this defaults to the global thread.- Parameters:
delayTicks- Initial delay before the first execution (in ticks).periodTicks- Period between each subsequent execution (in ticks).
-
runRegionTask
Executes a task associated with a specific region or chunk. On Spigot, this defaults to the global thread. -
runRegionTask
Executes a task associated with a specific region or chunk. On Spigot, this defaults to the global thread. -
runRegionTaskLater
Executes a task associated with a specific region or chunk after a delay. On Spigot, this defaults to the global thread.- Parameters:
delayTicks- Delay before execution, measured in ticks.
-
runRegionTaskLater
SchedulerTask runRegionTaskLater(World world, int chunkX, int chunkZ, Runnable runnable, long delayTicks) Executes a task associated with a specific region or chunk after a delay. On Spigot, this defaults to the global thread.- Parameters:
delayTicks- Delay before execution, measured in ticks.
-
runRegionTaskTimer
SchedulerTask runRegionTaskTimer(Location location, Runnable runnable, long delayTicks, long periodTicks) Executes a repeating task associated with a specific region or chunk. On Spigot, this defaults to the global thread.- Parameters:
delayTicks- Initial delay before the first execution (in ticks).periodTicks- Period between each subsequent execution (in ticks).
-
runRegionTaskTimer
SchedulerTask runRegionTaskTimer(World world, int chunkX, int chunkZ, Runnable runnable, long delayTicks, long periodTicks) Executes a repeating task associated with a specific region or chunk. On Spigot, this defaults to the global thread.- Parameters:
delayTicks- Initial delay before the first execution (in ticks).periodTicks- Period between each subsequent execution (in ticks).
-
runTask
Executes a task on the global server thread. -
runTaskAsynchronously
Executes a task asynchronously immediately, off the main server thread. -
runTaskLater
Executes a task on the global server thread after a specified delay.- Parameters:
delayTicks- Delay before execution, measured in server ticks (1 tick = 50ms).
-
runTaskLaterAsynchronously
Executes an asynchronous task after a specified delay.- Parameters:
delayTicks- Delay before execution, measured in ticks.
-
runTaskTimer
Executes a repeating task on the global server thread.- Parameters:
delayTicks- Initial delay before the first execution (in ticks).periodTicks- Period between each subsequent execution (in ticks).
-
runTaskTimerAsynchronously
Executes an asynchronous repeating task.- Parameters:
delayTicks- Initial delay before the first execution (in ticks).periodTicks- Period between each subsequent execution (in ticks).
-
isOnOwnerThread
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).
- Parameters:
entity- the target entity- Returns:
trueif the current thread is the owner thread for the entity;falseotherwise
-
isOnOwnerThread
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).
- Parameters:
location- the target location- Returns:
trueif the current thread is the owner thread for the location;falseotherwise
-
isOnOwnerThread
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).
- Parameters:
world- the target worldchunkX- the target chunk X coordinatechunkZ- the target chunk Z coordinate- Returns:
trueif the current thread is the owner thread for the chunk;falseotherwise
-
isOnOwnerThread
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).
- Parameters:
block- the target block- Returns:
trueif the current thread is the owner thread for the block;falseotherwise
-