Class LocationObj
java.lang.Object
tk.airshipcraft.commonlib.db.model.LocationObj
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
ConstructorsConstructorDescriptionDefault 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 TypeMethodDescriptionboolean
Checks if this object is equal to another object.getId()
Gets the unique identifier for the location.float
getPitch()
Gets the pitch.Gets the name of the world.double
getX()
Gets the X-coordinate.double
getY()
Gets the Y-coordinate.float
getYaw()
Gets the yaw.double
getZ()
Gets the Z-coordinate.int
hashCode()
Gets the hash code for this object.void
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.toString()
Gets a string representation of this object.
-
Constructor Details
-
LocationObj
public LocationObj()Default constructor. -
LocationObj
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
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
Gets the unique identifier for the location.- Returns:
- The unique identifier for the location.
-
setId
Sets the unique identifier for the location.- Parameters:
id
- The unique identifier for the location.
-
getWorldName
Gets the name of the world.- Returns:
- The name of the world.
-
setWorldName
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. -
equals
Checks if this object is equal to another object. -
toString
Gets 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.
-