Class FoliaScheduler

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

public class FoliaScheduler extends Object
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 Details

    • FoliaScheduler

      public FoliaScheduler()
  • Method Details

    • isFolia

      public static boolean isFolia()
      Returns:
      Whether the server is running Folia
    • getAsyncScheduler

      public static AsyncScheduler getAsyncScheduler()
      Returns the async scheduler.
      Returns:
      async scheduler instance of AsyncScheduler
    • getEntityScheduler

      public static EntityScheduler getEntityScheduler()
      Returns the entity scheduler.
      Returns:
      entity scheduler instance of EntityScheduler
    • getGlobalRegionScheduler

      public static GlobalRegionScheduler getGlobalRegionScheduler()
      Returns the global region scheduler.
      Returns:
      global region scheduler instance of GlobalRegionScheduler
    • getRegionScheduler

      public static RegionScheduler getRegionScheduler()
      Returns the region scheduler.
      Returns:
      region scheduler instance of RegionScheduler
    • runTaskOnInit

      public static void runTaskOnInit(org.bukkit.plugin.Plugin plugin, Runnable run)
      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 PacketEvents
      run - The task to run