Class EntityData

java.lang.Object
com.ranull.graves.data.EntityData
All Implemented Interfaces:
Serializable
Direct Known Subclasses:
HologramData

public class EntityData extends Object implements Serializable
Represents data for an entity associated with a grave, including its location, UUID, and type.
See Also:
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static enum 
    Enum representing the different types of entities that can be associated with a grave.
  • Constructor Summary

    Constructors
    Constructor
    Description
    EntityData(org.bukkit.Location location, UUID uuidEntity, UUID uuidGrave, EntityData.Type type)
    Constructs a new EntityData instance.
  • Method Summary

    Modifier and Type
    Method
    Description
    org.bukkit.Location
    Gets the location of the entity.
    Gets the type of the entity.
    Gets the UUID of the entity.
    Gets the UUID of the associated grave.
    boolean
    isForEntity(UUID entityUUID)
    Returns true if this entity data is for the given entity UUID.
    boolean
    isForGrave(UUID graveUUID)
    Returns true if this entity data is associated with the given grave UUID.
    boolean
    isSameWorld(org.bukkit.Location other)
    Returns true if this entity is in the same world as the provided location.
    boolean
    isWithinDistanceSquared(org.bukkit.Location other, double maxDistanceSq)
    Returns true if this entity location is within the given squared distance of the provided location.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • EntityData

      public EntityData(org.bukkit.Location location, UUID uuidEntity, UUID uuidGrave, EntityData.Type type)
      Constructs a new EntityData instance.
      Parameters:
      location - The location of the entity.
      uuidEntity - The UUID of the entity.
      uuidGrave - The UUID of the associated grave.
      type - The type of the entity.
  • Method Details

    • getLocation

      public org.bukkit.Location getLocation()
      Gets the location of the entity.
      Returns:
      The location of the entity.
    • getUUIDEntity

      public UUID getUUIDEntity()
      Gets the UUID of the entity.
      Returns:
      The UUID of the entity.
    • getUUIDGrave

      public UUID getUUIDGrave()
      Gets the UUID of the associated grave.
      Returns:
      The UUID of the associated grave.
    • getType

      public EntityData.Type getType()
      Gets the type of the entity.
      Returns:
      The type of the entity.
    • isForGrave

      public boolean isForGrave(UUID graveUUID)
      Returns true if this entity data is associated with the given grave UUID.
      Parameters:
      graveUUID - the grave UUID to compare
      Returns:
      true if graveUUID matches this entry's grave UUID
    • isForEntity

      public boolean isForEntity(UUID entityUUID)
      Returns true if this entity data is for the given entity UUID.
      Parameters:
      entityUUID - the entity UUID to compare
      Returns:
      true if entityUUID matches this entry's entity UUID
    • isSameWorld

      public boolean isSameWorld(org.bukkit.Location other)
      Returns true if this entity is in the same world as the provided location.
      Parameters:
      other - the other location to compare
      Returns:
      true if both locations have non-null worlds and they match
    • isWithinDistanceSquared

      public boolean isWithinDistanceSquared(org.bukkit.Location other, double maxDistanceSq)
      Returns true if this entity location is within the given squared distance of the provided location.

      Uses Location.distanceSquared(Location) to avoid a sqrt.

      Parameters:
      other - the other location
      maxDistanceSq - max allowed squared distance (e.g. 16 for 4 blocks)
      Returns:
      true if within range and in the same world