Package com.ranull.graves.data
Class EntityData
java.lang.Object
com.ranull.graves.data.EntityData
- All Implemented Interfaces:
Serializable
- Direct Known Subclasses:
HologramData
Represents data for an entity associated with a grave, including its location, UUID, and type.
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumEnum representing the different types of entities that can be associated with a grave. -
Constructor Summary
ConstructorsConstructorDescriptionEntityData(org.bukkit.Location location, UUID uuidEntity, UUID uuidGrave, EntityData.Type type) Constructs a new EntityData instance. -
Method Summary
Modifier and TypeMethodDescriptionorg.bukkit.LocationGets the location of the entity.getType()Gets the type of the entity.Gets the UUID of the entity.Gets the UUID of the associated grave.booleanisForEntity(UUID entityUUID) Returnstrueif this entity data is for the given entity UUID.booleanisForGrave(UUID graveUUID) Returnstrueif this entity data is associated with the given grave UUID.booleanisSameWorld(org.bukkit.Location other) Returnstrueif this entity is in the same world as the provided location.booleanisWithinDistanceSquared(org.bukkit.Location other, double maxDistanceSq) Returnstrueif this entity location is within the given squared distance of the provided location.
-
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
Gets the UUID of the entity.- Returns:
- The UUID of the entity.
-
getUUIDGrave
Gets the UUID of the associated grave.- Returns:
- The UUID of the associated grave.
-
getType
Gets the type of the entity.- Returns:
- The type of the entity.
-
isForGrave
Returnstrueif this entity data is associated with the given grave UUID.- Parameters:
graveUUID- the grave UUID to compare- Returns:
trueifgraveUUIDmatches this entry's grave UUID
-
isForEntity
Returnstrueif this entity data is for the given entity UUID.- Parameters:
entityUUID- the entity UUID to compare- Returns:
trueifentityUUIDmatches this entry's entity UUID
-
isSameWorld
public boolean isSameWorld(org.bukkit.Location other) Returnstrueif this entity is in the same world as the provided location.- Parameters:
other- the other location to compare- Returns:
trueif both locations have non-null worlds and they match
-
isWithinDistanceSquared
public boolean isWithinDistanceSquared(org.bukkit.Location other, double maxDistanceSq) Returnstrueif 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 locationmaxDistanceSq- max allowed squared distance (e.g.16for 4 blocks)- Returns:
trueif within range and in the same world
-