Class SimpleLocationManipulation

    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      org.bukkit.Location getBlockLocation​(org.bukkit.Location l)
      This method simply does some rounding, rather than forcing a call to the server to get the blockdata.
      java.lang.String getDirection​(org.bukkit.Location location)
      Return the NESW Direction a Location is facing.
      org.bukkit.Location getNextBlock​(org.bukkit.entity.Vehicle v)
      Returns the next Location that a Vehicle is traveling at.
      float getSpeed​(org.bukkit.util.Vector v)
      Returns a speed float from a given vector.
      org.bukkit.util.Vector getTranslatedVector​(org.bukkit.util.Vector v, java.lang.String direction)
      Returns a translated vector from the given direction.
      float getYaw​(java.lang.String orientation)
      Returns the float yaw position for the given cardinal direction.
      java.lang.String locationToString​(org.bukkit.Location location)
      Convert a Location into a Colon separated string to allow us to store it in text.
      java.lang.String strCoords​(org.bukkit.Location l)
      Returns a colored string with the coords.
      java.lang.String strCoordsRaw​(org.bukkit.Location l)
      Converts a location to a printable readable formatted string including pitch/yaw.
      org.bukkit.Location stringToLocation​(java.lang.String locationString)
      Returns a new location from a given string.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • SimpleLocationManipulation

        public SimpleLocationManipulation()
    • Method Detail

      • locationToString

        public java.lang.String locationToString​(org.bukkit.Location location)
        Convert a Location into a Colon separated string to allow us to store it in text.

        WORLD:X,Y,Z:yaw:pitch

        The corresponding String2Loc function is LocationManipulation.stringToLocation(java.lang.String)

        Specified by:
        locationToString in interface LocationManipulation
        Parameters:
        location - The Location to save.
        Returns:
        The location as a string in this format: WORLD:x,y,z:yaw:pitch
      • getBlockLocation

        public org.bukkit.Location getBlockLocation​(org.bukkit.Location l)
        This method simply does some rounding, rather than forcing a call to the server to get the blockdata.
        Specified by:
        getBlockLocation in interface LocationManipulation
        Parameters:
        l - The location to round to the block location
        Returns:
        A rounded location.
      • stringToLocation

        public org.bukkit.Location stringToLocation​(java.lang.String locationString)
        Returns a new location from a given string. The format is as follows:

        WORLD:X,Y,Z:yaw:pitch

        The corresponding Location2String function is LocationManipulation.stringToLocation(java.lang.String)

        Specified by:
        stringToLocation in interface LocationManipulation
        Parameters:
        locationString - The location represented as a string (WORLD:X,Y,Z:yaw:pitch)
        Returns:
        A new location defined by the string or null if the string was invalid.
      • strCoords

        public java.lang.String strCoords​(org.bukkit.Location l)
        Returns a colored string with the coords.
        Specified by:
        strCoords in interface LocationManipulation
        Parameters:
        l - The Location
        Returns:
        The String
      • strCoordsRaw

        public java.lang.String strCoordsRaw​(org.bukkit.Location l)
        Converts a location to a printable readable formatted string including pitch/yaw.
        Specified by:
        strCoordsRaw in interface LocationManipulation
        Parameters:
        l - The Location
        Returns:
        The String
      • getDirection

        public java.lang.String getDirection​(org.bukkit.Location location)
        Return the NESW Direction a Location is facing.
        Specified by:
        getDirection in interface LocationManipulation
        Parameters:
        location - The Location
        Returns:
        The NESW Direction
      • getYaw

        public float getYaw​(java.lang.String orientation)
        Returns the float yaw position for the given cardinal direction.
        Specified by:
        getYaw in interface LocationManipulation
        Parameters:
        orientation - The cardinal direction
        Returns:
        The yaw
      • getSpeed

        public float getSpeed​(org.bukkit.util.Vector v)
        Returns a speed float from a given vector.
        Specified by:
        getSpeed in interface LocationManipulation
        Parameters:
        v - The Vector
        Returns:
        The speed
      • getTranslatedVector

        public org.bukkit.util.Vector getTranslatedVector​(org.bukkit.util.Vector v,
                                                          java.lang.String direction)
        Returns a translated vector from the given direction.
        Specified by:
        getTranslatedVector in interface LocationManipulation
        Parameters:
        v - The old Vector
        direction - The new direction
        Returns:
        The translated Vector
      • getNextBlock

        public org.bukkit.Location getNextBlock​(org.bukkit.entity.Vehicle v)
        Returns the next Location that a Vehicle is traveling at.
        Specified by:
        getNextBlock in interface LocationManipulation
        Parameters:
        v - The Vehicle
        Returns:
        The Location