Class PluginScheduler<T,Z>

java.lang.Object
com.olziedev.playerauctions.api.scheduler.PluginScheduler<T,Z>
Type Parameters:
T - The type of plugin task.
Z - The type of object to get the plugin task from.

public abstract class PluginScheduler<T,Z> extends Object
This class is used to schedule tasks for the plugin.
  • Constructor Details

    • PluginScheduler

      public PluginScheduler(JavaPlugin plugin)
      This constructor is used to create a new plugin scheduler.
      Parameters:
      plugin - The plugin to use.
  • Method Details

    • runTask

      public abstract void runTask(Runnable task)
      Ths method is used to run a task on the main thread.
      Parameters:
      task - The task to run.
    • runTaskAsync

      public abstract PluginTask runTaskAsync(Consumer<PluginTask> task)
      This method is used to run a task asynchronously.
      Parameters:
      task - The task to run.
      Returns:
      The task that was run.
    • runSingleTaskAsync

      public PluginTask runSingleTaskAsync(Consumer<PluginTask> task)
      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

      public abstract PluginTask runTaskLater(Consumer<PluginTask> task, long delay)
      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

      public abstract PluginTask runTaskLaterAsync(Consumer<PluginTask> task, long delay)
      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

      public abstract PluginTask runTaskTimer(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.
      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

      public abstract PluginTask runTaskTimerAsync(Consumer<PluginTask> task, long delay, long period)
      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

      public void runTaskAtLocation(Location location, Consumer<PluginTask> task)
      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

      public PluginTask runTaskAtLocationLater(Location location, Consumer<PluginTask> task, long delay)
      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

      public abstract void runTaskAtLocation(Chunk chunk, Consumer<PluginTask> task)
      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(Chunk 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(Chunk 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

      public abstract void runTaskAtEntity(Entity entity, Consumer<PluginTask> task)
      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

      public abstract void getChunkAsync(Location location, Consumer<BukkitChunk> task)
      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

      public static void schedule(Runnable runnable, Date date)
      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.