Package dev.cwhead.GravesX.manager
Class ChunkManager
java.lang.Object
dev.cwhead.GravesX.manager.ChunkManager
Chunk manager that provides cross-platform chunk helpers for Spigot, Paper, and Folia.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumRepresents the chunk/runtime type detected for the current server.static interfaceAllows external APIs (your own integrations/modules) to provide the runtime chunk type. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanensureLoadedAndExecute(org.bukkit.Location anchor, org.bukkit.Location location, boolean generate, boolean allowForceLoad, Runnable task) Ensures the chunk containinglocationis loaded, then executestaskon the correct scheduler for the runtimeGets the detected chunk/runtime type.voidRegisters a resolver that can determine the ChunkType using optional APIs.voidSets a hard override type.
-
Constructor Details
-
ChunkManager
Creates a new chunk manager.- Parameters:
plugin- the GravesX plugin instance
-
-
Method Details
-
registerChunkTypeResolver
Registers a resolver that can determine the ChunkType using optional APIs.- Parameters:
resolver- resolver
-
setChunkTypeOverride
Sets a hard override type.- Parameters:
type- override
-
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 containinglocationis loaded, then executestaskon the correct scheduler for the runtime- Parameters:
anchor- location inside the target chunk (used for Folia region execution). If null,locationis used.location- target locationgenerate- whether to generate the chunk if neededallowForceLoad- 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)
-