Class LocationObj

java.lang.Object
tk.airshipcraft.commonlib.db.model.LocationObj

public class LocationObj extends Object

Represents a location in the world.

Locations are stored in the database and are used to store the location of a block or entity.

Locations are identified by a unique identifier, which is generated when the location is created. This identifier is used to identify the location when it is stored in the database.

Locations are stored in the database in the following format:

     CREATE TABLE locations (
     id UUID PRIMARY KEY,
     world_name VARCHAR(255) NOT NULL,
     x DOUBLE PRECISION NOT NULL,
     y DOUBLE PRECISION NOT NULL,
     z DOUBLE PRECISION NOT NULL,
     pitch FLOAT,
     yaw FLOAT
 );
 
Since:
2024-01-06
Version:
1.0.0
Author:
notzune
  • Constructor Summary

    Constructors
    Constructor
    Description
    Default constructor.
    LocationObj(UUID id, String worldName, double x, double y, double z)
    Constructs a new LocationObj with no pitch or yaw.
    LocationObj(UUID id, String worldName, double x, double y, double z, float pitch, float yaw)
    Constructs a new LocationObj with specified details.
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    Checks if this object is equal to another object.
    Gets the unique identifier for the location.
    float
    Gets the pitch.
    Gets the name of the world.
    double
    Gets the X-coordinate.
    double
    Gets the Y-coordinate.
    float
    Gets the yaw.
    double
    Gets the Z-coordinate.
    int
    Gets the hash code for this object.
    void
    setId(UUID id)
    Sets the unique identifier for the location.
    void
    setPitch(float pitch)
    Sets the pitch.
    void
    setWorldName(String worldName)
    Sets the name of the world.
    void
    setX(double x)
    Sets the X-coordinate.
    void
    setY(double y)
    Sets the Y-coordinate.
    void
    setYaw(float yaw)
    Sets the yaw.
    void
    setZ(double z)
    Sets the Z-coordinate.
    org.bukkit.Location
    Converts this LocationObj to a Bukkit Location.
    Gets a string representation of this object.

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • LocationObj

      public LocationObj()
      Default constructor.
      See Also:
    • LocationObj

      public LocationObj(UUID id, String worldName, double x, double y, double z)
      Constructs a new LocationObj with no pitch or yaw.
      Parameters:
      id - The unique identifier for the location.
      worldName - The name of the world.
      x - The X-coordinate.
      y - The Y-coordinate.
      z - The Z-coordinate.
    • LocationObj

      public LocationObj(UUID id, String worldName, double x, double y, double z, float pitch, float yaw)
      Constructs a new LocationObj with specified details.
      Parameters:
      id - The unique identifier for the location.
      worldName - The name of the world.
      x - The X-coordinate.
      y - The Y-coordinate.
      z - The Z-coordinate.
      pitch - The pitch.
      yaw - The yaw.
  • Method Details

    • getId

      public UUID getId()
      Gets the unique identifier for the location.
      Returns:
      The unique identifier for the location.
    • setId

      public void setId(UUID id)
      Sets the unique identifier for the location.
      Parameters:
      id - The unique identifier for the location.
    • getWorldName

      public String getWorldName()
      Gets the name of the world.
      Returns:
      The name of the world.
    • setWorldName

      public void setWorldName(String worldName)
      Sets the name of the world.
      Parameters:
      worldName - The name of the world.
    • getX

      public double getX()
      Gets the X-coordinate.
      Returns:
      The X-coordinate.
    • setX

      public void setX(double x)
      Sets the X-coordinate.
      Parameters:
      x - The X-coordinate.
    • getY

      public double getY()
      Gets the Y-coordinate.
      Returns:
      The Y-coordinate.
    • setY

      public void setY(double y)
      Sets the Y-coordinate.
      Parameters:
      y - The Y-coordinate.
    • getZ

      public double getZ()
      Gets the Z-coordinate.
      Returns:
      The Z-coordinate.
    • setZ

      public void setZ(double z)
      Sets the Z-coordinate.
      Parameters:
      z - The Z-coordinate.
    • getPitch

      public float getPitch()
      Gets the pitch.
      Returns:
      The pitch.
    • setPitch

      public void setPitch(float pitch)
      Sets the pitch.
      Parameters:
      pitch - The pitch.
    • getYaw

      public float getYaw()
      Gets the yaw.
      Returns:
      The yaw.
    • setYaw

      public void setYaw(float yaw)
      Sets the yaw.
      Parameters:
      yaw - The yaw.
    • hashCode

      public int hashCode()
      Gets the hash code for this object.
      Overrides:
      hashCode in class Object
      Returns:
      The hash code for this object.
    • equals

      public boolean equals(Object obj)
      Checks if this object is equal to another object.
      Overrides:
      equals in class Object
      Parameters:
      obj - The object to compare to.
      Returns:
      True if the objects are equal, false otherwise.
    • toString

      public String toString()
      Gets a string representation of this object.
      Overrides:
      toString in class Object
      Returns:
      A string representation of this object.
    • toBukkitLocation

      public org.bukkit.Location toBukkitLocation()
      Converts this LocationObj to a Bukkit Location.
      Returns:
      The Bukkit Location representation of this LocationObj.