Class PluginScheduler<T,Z>
java.lang.Object
com.olziedev.playereconomy.api.scheduler.PluginScheduler<T,Z>
- Type Parameters:
T- The type of plugin task.Z- The type of object to get the plugin task from.
This class is used to schedule tasks for the plugin.
-
Constructor Summary
ConstructorsConstructorDescriptionPluginScheduler(JavaPlugin plugin) This constructor is used to create a new plugin scheduler. -
Method Summary
Modifier and TypeMethodDescriptionabstract voidThis method is used to cancel all the tasks.abstract voidgetChunkAsync(Location location, Consumer<BukkitChunk> task) This method is used to get a chunk asynchronously when possible.runSingleTaskAsync(Consumer<PluginTask> task) This method is used to run a task on a single thread.abstract voidThs method is used to run a task on the main thread.abstract PluginTaskrunTaskAsync(Consumer<PluginTask> task) This method is used to run a task asynchronously.abstract voidrunTaskAtEntity(Entity entity, Consumer<PluginTask> task) This method is used to run a task at a specific entity.abstract PluginTaskrunTaskAtEntityLater(Entity entity, Consumer<PluginTask> task, long delay) This method is used to run a task at a specific entity after a delay.abstract PluginTaskrunTaskAtEntityTimer(Entity entity, Consumer<PluginTask> task, long delay, long period) This method is used to run a task at a specific entity after a delay and then repeat it.abstract voidrunTaskAtLocation(BukkitChunk chunk, Consumer<PluginTask> task) This method is used to run a task at a specific chunk.voidrunTaskAtLocation(Location location, Consumer<PluginTask> task) This method is used to run a task at a specific location.abstract PluginTaskrunTaskAtLocationLater(BukkitChunk chunk, Consumer<PluginTask> task, long delay) This method is used to run a task at a specific chunk after a delay.runTaskAtLocationLater(Location location, Consumer<PluginTask> task, long delay) This method is used to run a task at a specific location after a delay.abstract PluginTaskrunTaskAtLocationTimer(BukkitChunk chunk, Consumer<PluginTask> task, long delay, long period) This method is used to run a task at a specific chunk after a delay and then repeat it.runTaskAtLocationTimer(Location location, Consumer<PluginTask> task, long delay, long period) This method is used to run a task at a specific location after a delay and then repeat it.abstract PluginTaskrunTaskLater(Consumer<PluginTask> task, long delay) This method is used to run a task on the main thread after a delay.abstract PluginTaskrunTaskLaterAsync(Consumer<PluginTask> task, long delay) This method is used to run a task asynchronously after a delay.abstract PluginTaskrunTaskTimer(Consumer<PluginTask> task, long delay, long period) This method is used to run a task on the main thread after a delay and then repeat it.abstract PluginTaskrunTaskTimerAsync(Consumer<PluginTask> task, long delay, long period) This method is used to run a task asynchronously after a delay and then repeat it.static voidThis method is used to schedule a runnable to run after a delay.static voidThis method is used to setup the executors.abstract voidteleportAsync(Player player, Location location, Consumer<Boolean> task, PlayerTeleportEvent.TeleportCause teleportCause) This method is used to teleport a player to a location asynchronously when possible.
-
Constructor Details
-
PluginScheduler
This constructor is used to create a new plugin scheduler.- Parameters:
plugin- The plugin to use.
-
-
Method Details
-
runTask
Ths method is used to run a task on the main thread.- Parameters:
task- The task to run.
-
runTaskAsync
This method is used to run a task asynchronously.- Parameters:
task- The task to run.- Returns:
- The task that was run.
-
runSingleTaskAsync
This method is used to run a task on a single thread.- Parameters:
task- The task to run.- Returns:
- The task that was run.
-
runTaskLater
This method is used to run a task on the main thread after a delay.- Parameters:
task- The task to run.delay- The delay before the task is run.- Returns:
- The task that was run.
-
runTaskLaterAsync
This method is used to run a task asynchronously after a delay.- Parameters:
task- The task to run.delay- The delay before the task is run.- Returns:
- The task that was run.
-
runTaskTimer
This method is used to run a task on the main thread after a delay and then repeat it.- Parameters:
task- The task to run.delay- The delay before the task is run.period- The period between each run.- Returns:
- The task that was run.
-
runTaskTimerAsync
This method is used to run a task asynchronously after a delay and then repeat it.- Parameters:
task- The task to run.delay- The delay before the task is run.period- The period between each run.- Returns:
- The task that was run.
-
runTaskAtLocation
This method is used to run a task at a specific location.- Parameters:
location- The location to run the task at.task- The task to run.
-
runTaskAtLocationLater
This method is used to run a task at a specific location after a delay.- Parameters:
location- The location to run the task at.task- The task to run.delay- The delay before the task is run.- Returns:
- The task that was run.
-
runTaskAtLocationTimer
public PluginTask runTaskAtLocationTimer(Location location, Consumer<PluginTask> task, long delay, long period) This method is used to run a task at a specific location after a delay and then repeat it.- Parameters:
location- The location to run the task at.task- The task to run.delay- The delay before the task is run.period- The period between each run.- Returns:
- The task that was run.
-
runTaskAtLocation
This method is used to run a task at a specific chunk.- Parameters:
chunk- The chunk to run the task at.task- The task to run.
-
runTaskAtLocationLater
public abstract PluginTask runTaskAtLocationLater(BukkitChunk chunk, Consumer<PluginTask> task, long delay) This method is used to run a task at a specific chunk after a delay.- Parameters:
chunk- The chunk to run the task at.task- The task to run.delay- The delay before the task is run.- Returns:
- The task that was run.
-
runTaskAtLocationTimer
public abstract PluginTask runTaskAtLocationTimer(BukkitChunk chunk, Consumer<PluginTask> task, long delay, long period) This method is used to run a task at a specific chunk after a delay and then repeat it.- Parameters:
chunk- The chunk to run the task at.task- The task to run.delay- The delay before the task is run.period- The period between each run.- Returns:
- The task that was run.
-
runTaskAtEntity
This method is used to run a task at a specific entity.- Parameters:
entity- The entity to run the task at.task- The task to run.
-
runTaskAtEntityLater
public abstract PluginTask runTaskAtEntityLater(Entity entity, Consumer<PluginTask> task, long delay) This method is used to run a task at a specific entity after a delay.- Parameters:
entity- The entity to run the task at.task- The task to run.delay- The delay before the task is run.- Returns:
- The task that was run.
-
runTaskAtEntityTimer
public abstract PluginTask runTaskAtEntityTimer(Entity entity, Consumer<PluginTask> task, long delay, long period) This method is used to run a task at a specific entity after a delay and then repeat it.- Parameters:
entity- The entity to run the task at.task- The task to run.delay- The delay before the task is run.period- The period between each run.- Returns:
- The task that was run.
-
teleportAsync
public abstract void teleportAsync(Player player, Location location, Consumer<Boolean> task, PlayerTeleportEvent.TeleportCause teleportCause) This method is used to teleport a player to a location asynchronously when possible.- Parameters:
player- The player to teleport.location- The location to teleport the player to.task- The task to run after the teleport.teleportCause- The cause of the teleport.
-
getChunkAsync
This method is used to get a chunk asynchronously when possible.- Parameters:
location- The location to get the chunk from.task- The task to run after the chunk is retrieved.
-
cancelAllTasks
public abstract void cancelAllTasks()This method is used to cancel all the tasks. -
schedule
This method is used to schedule a runnable to run after a delay.- Parameters:
runnable- The runnable to run.date- The date to run the runnable.
-
setExecutors
public static void setExecutors()This method is used to setup the executors.
-