Class TaskWrapper

java.lang.Object
io.github.retrooper.packetevents.util.folia.TaskWrapper

public class TaskWrapper extends Object
Represents a wrapper around BukkitTask and Paper's ScheduledTask. This class provides a unified interface for interacting with both Bukkit's task scheduler and Paper's task scheduler.
  • Constructor Summary

    Constructors
    Constructor
    Description
    TaskWrapper(@NotNull io.papermc.paper.threadedregions.scheduler.ScheduledTask scheduledTask)
    Constructs a new TaskWrapper around Paper's ScheduledTask.
    TaskWrapper(@NotNull org.bukkit.scheduler.BukkitTask bukkitTask)
    Constructs a new TaskWrapper around a BukkitTask.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Cancels the task.
    org.bukkit.plugin.Plugin
    Retrieves the Plugin that owns this task.
    boolean
    Checks if the task is canceled.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • TaskWrapper

      public TaskWrapper(@NotNull @NotNull org.bukkit.scheduler.BukkitTask bukkitTask)
      Constructs a new TaskWrapper around a BukkitTask.
      Parameters:
      bukkitTask - the BukkitTask to wrap
    • TaskWrapper

      public TaskWrapper(@NotNull @NotNull io.papermc.paper.threadedregions.scheduler.ScheduledTask scheduledTask)
      Constructs a new TaskWrapper around Paper's ScheduledTask.
      Parameters:
      scheduledTask - the ScheduledTask to wrap
  • Method Details

    • getOwner

      public org.bukkit.plugin.Plugin getOwner()
      Retrieves the Plugin that owns this task.
      Returns:
      the owning Plugin
    • isCancelled

      public boolean isCancelled()
      Checks if the task is canceled.
      Returns:
      true if the task is canceled, false otherwise
    • cancel

      public void cancel()
      Cancels the task. If the task is running, it will be canceled.