Class EntityDataManager

java.lang.Object
com.ranull.graves.manager.EntityDataManager
Direct Known Subclasses:
CitizensNPC, EntityManager, FancyNPCs, FurnitureEngine, FurnitureLib, HologramManager, ItemsAdder, ItemStackManager, Nexo, Oraxen, PlayerNPC

public class EntityDataManager extends Object
Manages entity data and interactions within the Graves plugin.
  • Field Details

    • plugin

      private final Graves plugin
      The main plugin instance associated with Graves.

      This Graves instance represents the core plugin that this Graves is part of. It provides access to the plugin's functionality, configuration, and other services.

    • SERVER_GET_ENTITY

      private static Method SERVER_GET_ENTITY
  • Constructor Details

    • EntityDataManager

      public EntityDataManager(Graves plugin)
      Initializes the EntityDataManager with the specified plugin instance.
      Parameters:
      plugin - the Graves plugin instance.
  • Method Details

    • createEntityData

      public void createEntityData(org.bukkit.entity.Entity entity, Grave grave, EntityData.Type type)
      Creates entity data for a specified entity and grave.
      Parameters:
      entity - the entity for which to create the data.
      grave - the grave associated with the entity.
      type - the type of entity data.
    • createEntityData

      public void createEntityData(org.bukkit.Location location, UUID entityUUID, UUID graveUUID, EntityData.Type type)
      Creates entity data for a specified location, entity UUID, grave UUID, and entity data type.
      Parameters:
      location - the location of the entity.
      entityUUID - the UUID of the entity.
      graveUUID - the UUID of the grave.
      type - the type of entity data.
    • getEntityData

      public EntityData getEntityData(org.bukkit.Location location, UUID uuid)
      Retrieves entity data for a specified location and entity UUID.
      Parameters:
      location - the location of the entity.
      uuid - the UUID of the entity.
      Returns:
      the entity data, or null if not found.
    • getGrave

      public Grave getGrave(org.bukkit.Location location, UUID uuid)
      Retrieves a grave for a specified location and entity UUID.
      Parameters:
      location - the location of the entity.
      uuid - the UUID of the entity.
      Returns:
      the grave, or null if not found.
    • getGrave

      public Grave getGrave(org.bukkit.entity.Entity entity)
      Retrieves a grave for a specified entity.
      Parameters:
      entity - the entity for which to retrieve the grave.
      Returns:
      the grave, or null if not found.
    • removeEntityData

      public void removeEntityData(EntityData entityData)
      Removes entity data for a specified entity data.
      Parameters:
      entityData - the entity data to remove.
    • getLoadedEntityDataList

      public List<EntityData> getLoadedEntityDataList(Grave grave)
      Retrieves a list of loaded entity data associated with a specified grave.
      Parameters:
      grave - the grave for which to retrieve the loaded entity data.
      Returns:
      the list of loaded entity data.
    • getEntityDataMap

      public Map<EntityData,org.bukkit.entity.Entity> getEntityDataMap(List<EntityData> entityDataList)
      Retrieves a map of entity data and their corresponding entities from a list of entity data.
      Parameters:
      entityDataList - the list of entity data to map.
      Returns:
      the map of entity data and entities.
    • removeEntityData

      public void removeEntityData(List<EntityData> entityDataList)
      Removes a list of entity data.
      Parameters:
      entityDataList - the list of entity data to remove.
    • fastGetEntity

      private org.bukkit.entity.Entity fastGetEntity(UUID uuid)
      Try fast, version-friendly entity lookup: - World#getEntity(UUID) when present (Paper/Bukkit newer) - Server#getEntity(UUID) when present (Paper) Returns null if unavailable or not found.
    • scanChunkForEntityRegionSafe

      private org.bukkit.entity.Entity scanChunkForEntityRegionSafe(org.bukkit.World world, int cx, int cz, UUID uuid, org.bukkit.Location anchor)
      Scan a loaded chunk for a specific entity UUID on the correct region thread if possible. If a region scheduler is available, the scan is executed in-region and we await briefly. If not (legacy servers), we fall back to a direct on-thread scan (original behavior).