Class ServerLocation

java.lang.Object
de.rexlcloud.core.api.ServerLocation
All Implemented Interfaces:
Serializable

public class ServerLocation extends Object implements 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 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

      public ServerLocation(@Nullable @Nullable String worldName, double x, double y, double z)
      A position in a world, looking straight ahead.
  • Method Details

    • add

      public ServerLocation add(double x, double y, double z)
      Moves this location.
      Returns:
      this location
    • add

      public ServerLocation add(ServerLocation serverLocation)
      Moves this location by the coordinates of another one.
      Returns:
      this location
    • subtract

      public ServerLocation subtract(double x, double y, double z)
      Moves this location back.
      Returns:
      this location
    • subtract

      public ServerLocation subtract(ServerLocation serverLocation)
      Moves this location back by the coordinates of another one.
      Returns:
      this location
    • multiply

      public ServerLocation multiply(double multi)
      Multiplies all coordinates.
      Returns:
      this location
    • multiply

      public ServerLocation multiply(double multiX, double multiY, double multiZ)
      Multiplies each coordinate.
      Returns:
      this location
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • 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

      @Nullable public @Nullable String getWorldName()
      Name of the world (Minestom: the UUID of the instance), null for 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()