Class CacheManager

java.lang.Object
com.ranull.graves.manager.CacheManager

public final class CacheManager extends Object
  • Field Details

    • graveMap

      private final Map<UUID,Grave> graveMap
      A map of grave UUIDs to their corresponding Grave objects.

      This Map associates each UUID with a Grave instance, allowing for quick retrieval of grave information based on its unique identifier.

    • chunkMap

      private final Map<String,ChunkData> chunkMap
      A map of chunk identifiers to their corresponding ChunkData objects.

      This Map associates each chunk identifier (as a String) with ChunkData, which holds information about the specific chunk.

    • lastLocationMap

      private final Map<UUID,org.bukkit.Location> lastLocationMap
      A map of entity UUIDs to their last known Location.

      This Map tracks the most recent Location for each entity identified by its UUID.

    • removedItemStackMap

      private final Map<UUID,List<org.bukkit.inventory.ItemStack>> removedItemStackMap
      A map of entity UUIDs to lists of removed ItemStack objects.

      This Map associates each entity's UUID with a List of ItemStack objects that have been removed from the entity.

    • rightClickedBlocks

      private final Map<String,org.bukkit.Location> rightClickedBlocks
      A map of block identifiers to their corresponding Location objects where the block was right-clicked.

      This Map tracks the locations of blocks that have been right-clicked, identified by a String representing the block identifier.

  • Constructor Details

    • CacheManager

      public CacheManager()
      Constructs a new CacheManager with initialized maps.

      The constructor initializes all the maps used for caching data related to graves, chunks, locations, and items

  • Method Details

    • getGraveMap

      public Map<UUID,Grave> getGraveMap()
      Returns the map of grave UUIDs to their corresponding Grave objects.
      Returns:
      the map of graves
    • addRightClickedBlock

      public void addRightClickedBlock(String playerName, org.bukkit.Location location)
      Adds a right-clicked block location for a specified player.
      Parameters:
      playerName - the name of the player
      location - the location of the right-clicked block
    • getRightClickedBlock

      public org.bukkit.Location getRightClickedBlock(String playerName)
      Retrieves the location of the right-clicked block for a specified player.
      Parameters:
      playerName - the name of the player
      Returns:
      the location of the right-clicked block, or null if not found
    • removeRightClickedBlock

      public void removeRightClickedBlock(String playerName, org.bukkit.Location location)
      Removes the right-clicked block location for a specified player.
      Parameters:
      playerName - the name of the player
      location - the location of the right-clicked block
    • hasRightClickedBlock

      public boolean hasRightClickedBlock(String playerName)
      Checks if a right-clicked block location exists for a specified player.
      Parameters:
      playerName - the name of the player
      Returns:
      true if the right-clicked block location exists, false otherwise
    • getChunkMap

      public Map<String,ChunkData> getChunkMap()
      Returns the map of chunk identifiers to their corresponding ChunkData objects.
      Returns:
      the map of chunk data
    • getLastLocationMap

      public Map<UUID,org.bukkit.Location> getLastLocationMap()
      Returns the map of entity UUIDs to their last known Location.
      Returns:
      the map of last known locations
    • getRemovedItemStackMap

      public Map<UUID,List<org.bukkit.inventory.ItemStack>> getRemovedItemStackMap()
      Returns the map of entity UUIDs to lists of removed ItemStack objects.
      Returns:
      the map of removed item stacks
    • getOldestGrave

      public Grave getOldestGrave(UUID playerUUID)
      Returns the oldest grave for a given player.
      Parameters:
      playerUUID - The UUID of the player whose graves to consider.
      Returns:
      The oldest grave for the specified player.