Class LocationData

java.lang.Object
com.ranull.graves.data.LocationData
All Implemented Interfaces:
Serializable

public class LocationData extends Object implements Serializable
Represents serialized location data including world UUID, coordinates, and orientation.
See Also:
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private final float
    The pitch (rotation around the horizontal axis) of the entity.
    private static final long
     
    private final UUID
    The unique identifier for the entity.
    private final String
    Optional world namespaced key for safer cross-platform/world resolution (Paper/Folia).
    private final String
    Fallback world name (legacy Bukkit).
    private final double
    The x-coordinate of the entity's position.
    private final double
    The y-coordinate of the entity's position.
    private final float
    The yaw (rotation around the vertical axis) of the entity.
    private final double
    The z-coordinate of the entity's position.
  • Constructor Summary

    Constructors
    Constructor
    Description
    LocationData(org.bukkit.Location location)
    Constructs a new LocationData instance from a given Location.
  • Method Summary

    Modifier and Type
    Method
    Description
    org.bukkit.Location
    Converts the serialized data back into a Location object.
    private static org.bukkit.NamespacedKey
    safeGetKey(org.bukkit.World world)
    Safely retrieves the world's namespaced key without hard-crashing on non-Paper servers.

    Methods inherited from class java.lang.Object

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

    • serialVersionUID

      private static final long serialVersionUID
      See Also:
    • uuid

      private final UUID uuid
      The unique identifier for the entity.

      This UUID uniquely identifies the entity within the application.

    • worldKey

      private final String worldKey
      Optional world namespaced key for safer cross-platform/world resolution (Paper/Folia).

      This is used as a secondary lookup if the UUID-based lookup fails.

    • worldName

      private final String worldName
      Fallback world name (legacy Bukkit).
    • yaw

      private final float yaw
      The yaw (rotation around the vertical axis) of the entity.

      This float value represents the yaw of the entity, which controls its horizontal orientation.

    • pitch

      private final float pitch
      The pitch (rotation around the horizontal axis) of the entity.

      This float value represents the pitch of the entity, which controls its vertical orientation.

    • x

      private final double x
      The x-coordinate of the entity's position.

      This double value represents the entity's location on the x-axis in the world.

    • y

      private final double y
      The y-coordinate of the entity's position.

      This double value represents the entity's location on the y-axis in the world.

    • z

      private final double z
      The z-coordinate of the entity's position.

      This double value represents the entity's location on the z-axis in the world.

  • Constructor Details

    • LocationData

      public LocationData(org.bukkit.Location location)
      Constructs a new LocationData instance from a given Location.
      Parameters:
      location - The location to serialize.
  • Method Details

    • getLocation

      public org.bukkit.Location getLocation()
      Converts the serialized data back into a Location object.

      On Folia and other Paper-family servers, this attempts resolution by world UUID first, then by namespaced key (if present), and finally by legacy world name. This method only resolves the World reference and constructs a Location; it does not schedule any thread/region actions. Ensure you use the returned Location on the correct region thread.

      Returns:
      The deserialized Location, or null if the world cannot be resolved.
    • safeGetKey

      private static org.bukkit.NamespacedKey safeGetKey(org.bukkit.World world)
      Safely retrieves the world's namespaced key without hard-crashing on non-Paper servers.