Class FoliaScheduler
java.lang.Object
net.chen.legacyLand.util.FoliaScheduler
Folia / Paper 兼容调度器工具类
自动检测运行环境,在 Folia 上使用区域化调度器,在 Paper/Spigot 上使用 BukkitScheduler
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classstatic interface任务句柄,用于取消任务 -
Method Summary
Modifier and TypeMethodDescriptionstatic booleanisFolia()static voidrunForPlayer(org.bukkit.plugin.Plugin plugin, org.bukkit.entity.Player player, Runnable task) 在玩家所在区域调度器上运行单次任务static voidrunTaskAsync(org.bukkit.plugin.Plugin plugin, Runnable task) 在异步线程运行任务(用于 DB / IO 操作,避免阻塞主线程)static voidrunTaskGlobal(org.bukkit.plugin.Plugin plugin, Runnable task) 在全局调度器上运行单次任务static FoliaScheduler.TaskHandlerunTaskTimerAtLocation(org.bukkit.plugin.Plugin plugin, org.bukkit.Location location, Runnable task, long delayTicks, long periodTicks) 在区域调度器上运行重复任务(适用于特定位置的任务)static FoliaScheduler.TaskHandlerunTaskTimerGlobal(org.bukkit.plugin.Plugin plugin, Runnable task, long delayTicks, long periodTicks) 在全局调度器上运行重复任务(适用于不依赖特定区域的任务,如遍历所有玩家)
-
Method Details
-
isFolia
public static boolean isFolia() -
runTaskTimerGlobal
public static FoliaScheduler.TaskHandle runTaskTimerGlobal(org.bukkit.plugin.Plugin plugin, Runnable task, long delayTicks, long periodTicks) 在全局调度器上运行重复任务(适用于不依赖特定区域的任务,如遍历所有玩家) -
runTaskTimerAtLocation
public static FoliaScheduler.TaskHandle runTaskTimerAtLocation(org.bukkit.plugin.Plugin plugin, org.bukkit.Location location, Runnable task, long delayTicks, long periodTicks) 在区域调度器上运行重复任务(适用于特定位置的任务) -
runForPlayer
public static void runForPlayer(org.bukkit.plugin.Plugin plugin, org.bukkit.entity.Player player, Runnable task) 在玩家所在区域调度器上运行单次任务 -
runTaskGlobal
在全局调度器上运行单次任务 -
runTaskAsync
在异步线程运行任务(用于 DB / IO 操作,避免阻塞主线程)
-