Class LocationUtils

java.lang.Object
dev.sefiraat.sefilib.world.LocationUtils

public final class LocationUtils extends Object
This class contains static methods for dealing with locations.
  • Method Details

    • randomLocation

      @Nonnull public static Location randomLocation(@Nonnull Location centreLocation, int range)
      Picks a random location within a given range around a point
      Parameters:
      centreLocation - The Location which acts as the centre of the random check
      range - The range in blocks in which to spread out from
      Returns:
      The Location randomly selected
    • randomLocation

      @Nonnull public static Location randomLocation(@Nonnull Location centreLocation, int rangeX, int rangeY, int rangeZ)
      Picks a random location within a given range around a point
      Parameters:
      centreLocation - The Location which acts as the centre of the random check
      rangeX - The range in blocks in which to spread out from on the X axis
      rangeY - The range in blocks in which to spread out from on the Y axis
      rangeZ - The range in blocks in which to spread out from on the Z axis
      Returns:
      The Location randomly selected
    • centre

      public static Location centre(@Nonnull Location location)
      Returns a location in the centre of a block at the given location.
      Parameters:
      location - The location to centre on.
      Returns:
      The centre location.