Class IntXYZ

java.lang.Object
de.marcely.bedwars.tools.location.IntXYZ
All Implemented Interfaces:
Cloneable, ConfigurationSerializable

public class IntXYZ extends Object implements Cloneable, ConfigurationSerializable
Represents a 3-dimensional int position (i.a. block coord)
  • Field Details

    • x

      protected int x
    • y

      protected int y
    • z

      protected int z
  • Constructor Details

    • IntXYZ

      public IntXYZ()
    • IntXYZ

      public IntXYZ(Location loc)
    • IntXYZ

      public IntXYZ(Vector vec)
    • IntXYZ

      public IntXYZ(XYZ xyz)
    • IntXYZ

      public IntXYZ(Block block)
    • IntXYZ

      public IntXYZ(int x, int y, int z)
  • Method Details

    • getX

      public int getX()
      Returns the x-coordinate
      Returns:
      The x value
    • getY

      public int getY()
      Returns the y-coordinate
      Returns:
      The y value
    • getZ

      public int getZ()
      Returns the z-coordinate
      Returns:
      The z value
    • setX

      public IntXYZ setX(int x)
      Sets the x-coordinate
      Parameters:
      x - The new x-coordinate
      Returns:
      This IntXYZ instance
    • setY

      public IntXYZ setY(int y)
      Sets the y-coordinate
      Parameters:
      y - The new y-coordinate
      Returns:
      This IntXYZ instance
    • setZ

      public IntXYZ setZ(int z)
      Sets the z-coordinate
      Parameters:
      z - The new z-coordinate
      Returns:
      This IntXYZ instance
    • set

      public IntXYZ set(int x, int y, int z)
      Sets the new coordinates
      Parameters:
      x - The new x-coordinate
      y - The new y-coordinate
      z - The new z-coordinate
      Returns:
      This IntXYZ instance
    • set

      public IntXYZ set(XYZ xyz)
      Copies and sets the xyz coordinates from the given object
      Parameters:
      xyz - The object from which it shall be taken from
      Returns:
      This IntXYZ instance
    • set

      public IntXYZ set(Location loc)
      Copies and sets the xyz coordinates from the given object
      Parameters:
      loc - The object from which it shall be taken from
      Returns:
      This IntXYZ instance
    • set

      public IntXYZ set(Block block)
      Copies and sets the xyz coordinates from the given block
      Parameters:
      block - The object from which it shall be taken from
      Returns:
      This IntXYZ instance
    • add

      public IntXYZ add(int x, int y, int z)
      Adds the x-coordinates
      Parameters:
      x - The added x-coordinate
      y - The added y-coordinate
      z - The added z-coordinate
      Returns:
      This IntXYZ instance
    • add

      public IntXYZ add(IntXYZ xyz)
    • subtract

      public IntXYZ subtract(int x, int y, int z)
    • subtract

      public IntXYZ subtract(IntXYZ xyz)
    • multiply

      public IntXYZ multiply(int amount)
    • multiply

      public IntXYZ multiply(int x, int y, int z)
    • zero

      public IntXYZ zero()
      Sets all coordinates to 0
      Returns:
      This IntXYZ instance
    • isZero

      public boolean isZero()
      Get whether all coordinates are set to 0
      Returns:
      true if X, Y and Z are set to 0
    • distance

      public double distance(IntXYZ o)
    • distanceSquared

      public double distanceSquared(IntXYZ o)
    • toLocation

      public Location toLocation(World world)
      Converts this XYZ object to a new Location object
      Parameters:
      world - The world needed for creating the Location
      Returns:
      A new location whose coordinates where taken from this object
    • toVector

      public Vector toVector()
      Converts this XYZ object to a new Vector object
      Returns:
      A new vector whose coordinates where taken from this object
    • getBlock

      public Block getBlock(World world)
      Get the Bukkit block that you can find at the given position.
      Parameters:
      world - The world in which we want to look up the block
      Returns:
      The matching block
    • equalsBlockCoords

      public boolean equalsBlockCoords(XYZ xyz)
      Check whether the block coords match.
      Parameters:
      xyz - The other object to compare with
      Returns:
      true if the floored coordinates match
    • equalsBlockCoords

      public boolean equalsBlockCoords(Location loc)
      Check whether the block coords match.
      Parameters:
      loc - The other object to compare with
      Returns:
      true if the floored coordinates match
    • equalsBlockCoords

      public boolean equalsBlockCoords(Block block)
      Check whether the block coords match.
      Parameters:
      block - The other object to compare with
      Returns:
      true if the floored coordinates match
    • clone

      public IntXYZ clone()
      Overrides:
      clone in class Object
    • serialize

      public Map<String,Object> serialize()
      Specified by:
      serialize in interface ConfigurationSerializable
    • deserialize

      public static IntXYZ deserialize(Map<String,Object> data)
      Required method for deserialization
      Parameters:
      data - map to deserialize
      Returns:
      deserialized xyz instance