java.lang.Object
net.paulem.arcana.regions.container.WorldBlockContainer<S,K>
- Type Parameters:
S- The type of the tracked entities being managed, which extendsTracked.K- The type of the key associated with the tracked entities, which extendsWorldKey.
- All Implemented Interfaces:
SubContainerHolderAccessor<S,K>
public class WorldBlockContainer<S extends Tracked<K>,K extends WorldKey>
extends Object
implements SubContainerHolderAccessor<S,K>
Represents a container for managing block-related data across a specific world,
organized into smaller chunk-based containers.
-
Method Summary
Modifier and TypeMethodDescriptionCollection<Holder<S, K>> @Nullable ChunkBlockContainer<S, K> Retrieves the container for the given chunk, without creating it.getHolder(int x, int y, int z) Retrieves the tracked object at the given coordinates, using the chunk container that contains them.Retrieves the container for the given chunk, creating it first if it doesn't exist yet.org.bukkit.WorldgetWorld()static <S extends Tracked<K>,K extends WorldKey>
WorldBlockContainer<S, K> Creates a new, emptyWorldBlockContainerfor the given world.static <S extends Tracked<K>,K extends WorldKey>
WorldBlockContainer<S, K> of(org.bukkit.World world) Creates a new, emptyWorldBlockContainerfor the given world.voidRemoves the container for the given chunk, if present.voidremoveChunkContainer(org.bukkit.Chunk chunk) Removes the container for the given chunk, if present.voidremoveHolder(int x, int y, int z) Removes the tracked object at the given coordinates, if its chunk is tracked.voidStores a tracked object at the given coordinates, creating the chunk container for those coordinates if needed.
-
Method Details
-
of
Creates a new, emptyWorldBlockContainerfor the given world.- Type Parameters:
S- the type of the tracked entities being managedK- the type of the key associated with the tracked entities- Parameters:
worldId- the UUID of the world this container manages- Returns:
- a new
WorldBlockContainerinstance
-
of
public static <S extends Tracked<K>,K extends WorldKey> WorldBlockContainer<S,K> of(org.bukkit.World world) Creates a new, emptyWorldBlockContainerfor the given world.- Type Parameters:
S- the type of the tracked entities being managedK- the type of the key associated with the tracked entities- Parameters:
world- the world this container manages- Returns:
- a new
WorldBlockContainerinstance
-
getWorld
public org.bukkit.World getWorld()- Returns:
- the
Worldthis container manages, resolved from its UUID, ornullif that world isn't currently loaded
-
getChunkContainer
Retrieves the container for the given chunk, without creating it.- Parameters:
key- the chunk's key- Returns:
- the chunk's container, or
nullif it doesn't exist yet
-
getOrCreateChunkContainer
Retrieves the container for the given chunk, creating it first if it doesn't exist yet.- Parameters:
key- the chunk's key- Returns:
- the chunk's container, never
null
-
removeChunkContainer
Removes the container for the given chunk, if present.- Parameters:
key- the key of the chunk to remove
-
removeChunkContainer
public void removeChunkContainer(org.bukkit.Chunk chunk) Removes the container for the given chunk, if present.- Parameters:
chunk- the chunk to remove
-
getHolder
Retrieves the tracked object at the given coordinates, using the chunk container that contains them. -
setHolder
Stores a tracked object at the given coordinates, creating the chunk container for those coordinates if needed. -
removeHolder
public void removeHolder(int x, int y, int z) Removes the tracked object at the given coordinates, if its chunk is tracked.- Specified by:
removeHolderin interfaceSubContainerHolderAccessor<S extends Tracked<K>,K extends WorldKey> - Parameters:
x- the x coordinatey- the y coordinatez- the z coordinate
-
getAllHolders
- Specified by:
getAllHoldersin interfaceSubContainerHolderAccessor<S extends Tracked<K>,K extends WorldKey> - Returns:
- a collection of all holders stored across every chunk in this world
-