Class TaskManager

java.lang.Object
xyz.xenondevs.particle.task.TaskManager

public final class TaskManager extends Object
A manager to handle different ParticleTasks
Author:
ByteZ
See Also:
  • Method Details

    • startTask

      public int startTask(ParticleTask task)
      Starts a new Timer for the given task.
      Parameters:
      task - the task that should be added to the scheduler
      Returns:
      the id of the BukkitTask which can be cancelled using stopTask(int)
      See Also:
    • stopTask

      public void stopTask(int taskId)
      Stops a task that is currently running.
      Parameters:
      taskId - the id of the task to be stopped.
    • getTaskManager

      public static TaskManager getTaskManager()
      Get the singleton instance of the TaskManager
      Returns:
      the singleton instance of the TaskManager
    • startGlobalTask

      public static int startGlobalTask(List<Object> packets, int tickDelay)
      Starts a new GlobalTask.
      Parameters:
      packets - List of packets
      tickDelay - The delay of ticks between each execution
      Returns:
      the id of the BukkitTask which can be cancelled using stopTask(int)
      See Also:
    • startWorldTask

      public static int startWorldTask(List<Object> packets, int tickDelay, org.bukkit.World world)
      Starts a new WorldTask.
      Parameters:
      packets - List of packets
      tickDelay - The delay of ticks between each execution
      world - The target World
      Returns:
      the id of the BukkitTask which can be cancelled using stopTask(int)
      See Also:
    • startTargetedTask

      public static int startTargetedTask(List<Object> packets, int tickDelay, Collection<org.bukkit.entity.Player> targets)
      Starts a new TargetedTask.
      Parameters:
      packets - List of packets
      tickDelay - The delay of ticks between each execution
      targets - A Collection of Players that will receive the particles.
      Returns:
      the id of the BukkitTask which can be cancelled using stopTask(int)
      See Also:
    • startSingularTask

      public static int startSingularTask(List<Object> packets, int tickDelay, UUID target)
      Starts a new SingularTask.
      Parameters:
      packets - List of packets
      tickDelay - The delay of ticks between each execution
      target - The UUID of the target Player
      Returns:
      the id of the BukkitTask which can be cancelled using stopTask(int)
      See Also:
    • startSingularTask

      public static int startSingularTask(List<Object> packets, int tickDelay, org.bukkit.entity.Player target)
      Starts a new SingularTask.
      Parameters:
      packets - List of packets
      tickDelay - The delay of ticks between each execution
      target - The target Player
      Returns:
      the id of the BukkitTask which can be cancelled using stopTask(int)
      See Also:
    • startFilteredTask

      public static int startFilteredTask(List<Object> packets, int tickDelay, Predicate<org.bukkit.entity.Player> filter)
      Starts a new FilteredTask.
      Parameters:
      packets - List of packets
      tickDelay - The delay of ticks between each execution
      filter - The Predicate to filter the Players
      Returns:
      the id of the BukkitTask which can be cancelled using stopTask(int)
      See Also:
    • startSuppliedTask

      public static int startSuppliedTask(List<Object> packets, int tickDelay, Supplier<Collection<org.bukkit.entity.Player>> supplier)
      Starts a new SuppliedTask.
      Parameters:
      packets - List of packets
      tickDelay - The delay of ticks between each execution
      supplier - The Supplier used to retrieve the Collection of target Players
      Returns:
      the id of the BukkitTask which can be cancelled using stopTask(int)
      See Also: