Class ChunkManager

java.lang.Object
dev.cwhead.GravesX.manager.ChunkManager

public final class ChunkManager extends Object
Chunk manager that provides cross-platform chunk helpers for Spigot, Paper, and Folia.
  • Constructor Details

    • ChunkManager

      public ChunkManager(Graves plugin)
      Creates a new chunk manager.
      Parameters:
      plugin - the GravesX plugin instance
  • Method Details

    • registerChunkTypeResolver

      public void registerChunkTypeResolver(ChunkManager.ChunkTypeResolver resolver)
      Registers a resolver that can determine the ChunkType using optional APIs.
      Parameters:
      resolver - resolver
    • setChunkTypeOverride

      public void setChunkTypeOverride(ChunkManager.ChunkType type)
      Sets a hard override type.
      Parameters:
      type - override
    • getChunkType

      public ChunkManager.ChunkType getChunkType()
      Gets the detected chunk/runtime type.
      Returns:
      chunk type
    • ensureLoadedAndExecute

      public boolean ensureLoadedAndExecute(org.bukkit.Location anchor, org.bukkit.Location location, boolean generate, boolean allowForceLoad, Runnable task)
      Ensures the chunk containing location is loaded, then executes task on the correct scheduler for the runtime
      Parameters:
      anchor - location inside the target chunk (used for Folia region execution). If null, location is used.
      location - target location
      generate - whether to generate the chunk if needed
      allowForceLoad - only applies on non-Folia (safe there)
      task - task to run after the chunk is loaded
      Returns:
      true if work was scheduled or completed, false if refused (Folia w/o async API or invalid location)