Class FoliaScheduler
java.lang.Object
io.github.retrooper.packetevents.util.folia.FoliaScheduler
Utility class to handle scheduling tasks.
It uses Paper's threaded-regions schedulers if Folia is used,
otherwise it falls back to the default Bukkit scheduler.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic AsyncScheduler
Returns the async scheduler.static EntityScheduler
Returns the entity scheduler.static GlobalRegionScheduler
Returns the global region scheduler.static RegionScheduler
Returns the region scheduler.static boolean
isFolia()
static void
runTaskOnInit
(org.bukkit.plugin.Plugin plugin, Runnable run) Run a task after the server has finished initializing.
-
Constructor Details
-
FoliaScheduler
public FoliaScheduler()
-
-
Method Details
-
isFolia
public static boolean isFolia()- Returns:
- Whether the server is running Folia
-
getAsyncScheduler
Returns the async scheduler.- Returns:
- async scheduler instance of
AsyncScheduler
-
getEntityScheduler
Returns the entity scheduler.- Returns:
- entity scheduler instance of
EntityScheduler
-
getGlobalRegionScheduler
Returns the global region scheduler.- Returns:
- global region scheduler instance of
GlobalRegionScheduler
-
getRegionScheduler
Returns the region scheduler.- Returns:
- region scheduler instance of
RegionScheduler
-
runTaskOnInit
Run a task after the server has finished initializing. Undefined behavior if called after the server has finished initializing.We still need to use reflections to get the server init event class, as this is only part of the Folia API.
- Parameters:
plugin
- Your plugin or PacketEventsrun
- The task to run
-