Class ServerLocation
java.lang.Object
de.rexlcloud.core.api.ServerLocation
- All Implemented Interfaces:
Serializable
A position in a world of a server, independent of the server software (Bukkit
Location, Minestom
Pos); the Bridge and MinestomBridge convert it. The arithmetic methods change this object and return it.- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionServerLocation(double x, double y, double z) A position in the player's current world, looking straight ahead.ServerLocation(double x, double y, double z, float yaw, float pitch) A position and viewing direction in the player's current world.ServerLocation(@Nullable String worldName, double x, double y, double z) A position in a world, looking straight ahead.ServerLocation(@Nullable String worldName, double x, double y, double z, float yaw, float pitch) A position and viewing direction in a world. -
Method Summary
Modifier and TypeMethodDescriptionadd(double x, double y, double z) Moves this location.add(ServerLocation serverLocation) Moves this location by the coordinates of another one.booleanintintintfloatgetPitch()@Nullable StringName of the world (Minestom: the UUID of the instance),nullfor the player's current one.doublegetX()X coordinate.doublegetY()Y coordinate.floatgetYaw()Viewing direction in degrees.doublegetZ()Z coordinate.inthashCode()multiply(double multi) Multiplies all coordinates.multiply(double multiX, double multiY, double multiZ) Multiplies each coordinate.subtract(double x, double y, double z) Moves this location back.subtract(ServerLocation serverLocation) Moves this location back by the coordinates of another one.toString()
-
Constructor Details
-
ServerLocation
public ServerLocation(double x, double y, double z) A position in the player's current world, looking straight ahead. -
ServerLocation
public ServerLocation(double x, double y, double z, float yaw, float pitch) A position and viewing direction in the player's current world. -
ServerLocation
public ServerLocation(@Nullable @Nullable String worldName, double x, double y, double z, float yaw, float pitch) A position and viewing direction in a world. -
ServerLocation
A position in a world, looking straight ahead.
-
-
Method Details
-
add
-
add
Moves this location by the coordinates of another one.- Returns:
- this location
-
subtract
Moves this location back.- Returns:
- this location
-
subtract
Moves this location back by the coordinates of another one.- Returns:
- this location
-
multiply
-
multiply
Multiplies each coordinate.- Returns:
- this location
-
toString
-
equals
-
hashCode
-
getBlockX
public int getBlockX()- Returns:
- the X coordinate of the block
-
getBlockY
public int getBlockY()- Returns:
- the Y coordinate of the block
-
getBlockZ
public int getBlockZ()- Returns:
- the Z coordinate of the block
-
getWorldName
Name of the world (Minestom: the UUID of the instance),nullfor the player's current one. -
getX
public double getX()X coordinate. -
getY
public double getY()Y coordinate. -
getZ
public double getZ()Z coordinate. -
getYaw
public float getYaw()Viewing direction in degrees. -
getPitch
public float getPitch()
-