类 EntitySchedulerUtil

java.lang.Object
cn.handyplus.lib.adapter.EntitySchedulerUtil

public class EntitySchedulerUtil extends Object
实体相关调度器
从以下版本开始:
1.2.2
  • 方法概要

    修饰符和类型
    方法
    说明
    static void
    addPotionEffects(@NotNull org.bukkit.entity.LivingEntity entity, @NotNull List<org.bukkit.potion.PotionEffect> potionEffectList)
    调度添加药水效果
    static void
    addPotionEffects(@NotNull org.bukkit.entity.LivingEntity entity, @NotNull org.bukkit.potion.PotionEffect potionEffect)
    调度添加药水效果
    protected static void
    取消所有实体周期任务
    static void
    removePotionEffect(@NotNull org.bukkit.entity.LivingEntity entity, @NotNull org.bukkit.potion.PotionEffectType potionEffect)
    调度移除药水效果
    static void
    runSafeOnEntityScheduler(@NotNull org.bukkit.entity.LivingEntity entity, @NotNull Runnable task)
    在线程安全的实体调度器中执行任务(无返回值)
    static void
    runSafeOnEntityScheduler(@NotNull org.bukkit.entity.LivingEntity entity, @NotNull Runnable task, boolean isSync)
    在线程安全的实体调度器中执行任务(无返回值)
    static <T> void
    runSafeOnEntityScheduler(@NotNull org.bukkit.entity.LivingEntity entity, @NotNull Supplier<T> task, boolean isSync)
    在线程安全的实体调度器中执行任务
    static <T> void
    runSafeOnEntityScheduler(@NotNull org.bukkit.entity.LivingEntity entity, @NotNull Supplier<T> task, @Nullable Consumer<T> success, boolean isSync)
    在线程安全的实体调度器中执行任务
    static void
    runTaskTimer(@NotNull org.bukkit.entity.Entity entity, @NotNull HandyRunnable task, long delay, long period)
    在实体安全线程周期执行可取消任务
    static boolean
    runTaskTimer(@NotNull org.bukkit.entity.Entity entity, @NotNull HandyRunnable task, long delay, long period, @Nullable Runnable retired)
    在实体安全线程周期执行可取消任务,并在 Folia 实体退役时通知调用方。
    static void
    syncTeleport(@NotNull org.bukkit.entity.Entity entity, @NotNull org.bukkit.Location target)
    调度传送实体
    static void
    syncTeleport(@NotNull org.bukkit.entity.Entity entity, @NotNull org.bukkit.Location target, org.bukkit.event.player.PlayerTeleportEvent.TeleportCause cause)
    调度传送实体
    static boolean
    teleport(@NotNull org.bukkit.entity.Entity entity, @NotNull org.bukkit.Location target)
    传送实体
    static boolean
    teleport(@NotNull org.bukkit.entity.Entity entity, @NotNull org.bukkit.Location target, org.bukkit.event.player.PlayerTeleportEvent.TeleportCause cause)
    传送实体
    protected static void
    unregisterTask(@NotNull io.papermc.paper.threadedregions.scheduler.ScheduledTask task)
    移除实体周期任务
  • 方法详细资料

    • teleport

      public static boolean teleport(@NotNull @NotNull org.bukkit.entity.Entity entity, @NotNull @NotNull org.bukkit.Location target)
      传送实体
      参数:
      entity - 需要传送的实体
      target - 目的地
      返回:
      Bukkit 下返回传送结果,Folia 下返回传送任务是否已提交
      从以下版本开始:
      1.3.0
    • teleport

      public static boolean teleport(@NotNull @NotNull org.bukkit.entity.Entity entity, @NotNull @NotNull org.bukkit.Location target, @NotNull org.bukkit.event.player.PlayerTeleportEvent.TeleportCause cause)
      传送实体
      参数:
      entity - 需要传送的实体
      target - 传送目的地
      cause - 传送原因
      返回:
      Bukkit 下返回传送结果,Folia 下返回传送任务是否已提交
      从以下版本开始:
      1.3.0
    • syncTeleport

      public static void syncTeleport(@NotNull @NotNull org.bukkit.entity.Entity entity, @NotNull @NotNull org.bukkit.Location target)
      调度传送实体
      参数:
      entity - 需要传送的实体
      target - 传送目的地
      从以下版本开始:
      1.3.0
    • syncTeleport

      public static void syncTeleport(@NotNull @NotNull org.bukkit.entity.Entity entity, @NotNull @NotNull org.bukkit.Location target, @NotNull org.bukkit.event.player.PlayerTeleportEvent.TeleportCause cause)
      调度传送实体
      参数:
      entity - 需要传送的实体
      target - 传送目的地
      cause - 传送原因
      从以下版本开始:
      1.3.0
    • addPotionEffects

      public static void addPotionEffects(@NotNull @NotNull org.bukkit.entity.LivingEntity entity, @NotNull @NotNull List<org.bukkit.potion.PotionEffect> potionEffectList)
      调度添加药水效果
      参数:
      entity - 实体
      potionEffectList - 药水效果
      从以下版本开始:
      1.3.0
    • addPotionEffects

      public static void addPotionEffects(@NotNull @NotNull org.bukkit.entity.LivingEntity entity, @NotNull @NotNull org.bukkit.potion.PotionEffect potionEffect)
      调度添加药水效果
      参数:
      entity - 实体
      potionEffect - 药水效果
      从以下版本开始:
      1.3.0
    • removePotionEffect

      public static void removePotionEffect(@NotNull @NotNull org.bukkit.entity.LivingEntity entity, @NotNull @NotNull org.bukkit.potion.PotionEffectType potionEffect)
      调度移除药水效果
      参数:
      entity - 实体
      potionEffect - 药水效果
      从以下版本开始:
      1.3.0
    • runSafeOnEntityScheduler

      public static void runSafeOnEntityScheduler(@NotNull @NotNull org.bukkit.entity.LivingEntity entity, @NotNull @NotNull Runnable task)
      在线程安全的实体调度器中执行任务(无返回值)
      参数:
      entity - 实体
      task - 要执行的任务
      从以下版本开始:
      1.3.0
    • runSafeOnEntityScheduler

      public static void runSafeOnEntityScheduler(@NotNull @NotNull org.bukkit.entity.LivingEntity entity, @NotNull @NotNull Runnable task, boolean isSync)
      在线程安全的实体调度器中执行任务(无返回值)
      参数:
      entity - 实体
      task - 要执行的任务
      isSync - Bukkit 下是否使用主线程调度
      从以下版本开始:
      1.3.0
    • runSafeOnEntityScheduler

      public static <T> void runSafeOnEntityScheduler(@NotNull @NotNull org.bukkit.entity.LivingEntity entity, @NotNull @NotNull Supplier<T> task, boolean isSync)
      在线程安全的实体调度器中执行任务
      类型参数:
      T - 返回类型
      参数:
      entity - 实体
      task - 要执行的任务(返回 T)
      isSync - Bukkit 下是否使用主线程调度
      从以下版本开始:
      1.3.0
    • runSafeOnEntityScheduler

      public static <T> void runSafeOnEntityScheduler(@NotNull @NotNull org.bukkit.entity.LivingEntity entity, @NotNull @NotNull Supplier<T> task, @Nullable @Nullable Consumer<T> success, boolean isSync)
      在线程安全的实体调度器中执行任务
      类型参数:
      T - 返回类型
      参数:
      entity - 实体
      task - 要执行的任务(返回 T)
      success - 成功回调(接收 T)
      isSync - Bukkit 下是否使用主线程调度
      从以下版本开始:
      1.3.0
    • runTaskTimer

      public static void runTaskTimer(@NotNull @NotNull org.bukkit.entity.Entity entity, @NotNull @NotNull HandyRunnable task, long delay, long period)
      在实体安全线程周期执行可取消任务
      参数:
      entity - 实体
      task - 可通过 cancel() 取消的任务
      delay - 首次执行延迟,单位为 tick
      period - 执行间隔,单位为 tick
      从以下版本开始:
      1.3.3
    • runTaskTimer

      public static boolean runTaskTimer(@NotNull @NotNull org.bukkit.entity.Entity entity, @NotNull @NotNull HandyRunnable task, long delay, long period, @Nullable @Nullable Runnable retired)
      在实体安全线程周期执行可取消任务,并在 Folia 实体退役时通知调用方。
      参数:
      entity - 实体
      task - 可通过 cancel() 取消的任务
      delay - 首次执行延迟,单位为 tick
      period - 执行间隔,单位为 tick
      retired - Folia 实体退役时的回调;不会在 Bukkit 分支、主动取消或提交失败时调用,回调中不可操作实体或区块
      返回:
      任务是否提交成功;Folia 实体已退役时返回 false
      从以下版本开始:
      1.3.5
    • cancelTask

      protected static void cancelTask()
      取消所有实体周期任务
    • unregisterTask

      protected static void unregisterTask(@NotNull @NotNull io.papermc.paper.threadedregions.scheduler.ScheduledTask task)
      移除实体周期任务
      参数:
      task - 实体任务