Search in sources :

Example 1 with AbstractRegion

use of com.sk89q.worldedit.regions.AbstractRegion in project kit-api by HGLabor.

the class GladiatorKit method getGladiatorLocation.

// one day stackoverflow haha
private Region getGladiatorLocation(Location location, int radius, int height) {
    Random random = new Random();
    AbstractRegion region = new CylinderRegion(BukkitAdapter.adapt(location.getWorld()), BukkitAdapter.asBlockVector(location), Vector2.at(radius, radius), location.getBlockY(), location.getBlockY() + height);
    if (hasEnoughSpace(region)) {
        return region;
    } else {
        return getGladiatorLocation(location.add(random.nextBoolean() ? -10 : 10, 5, random.nextBoolean() ? -10 : 10), radius, height);
    }
}
Also used : Random(java.util.Random) CylinderRegion(com.sk89q.worldedit.regions.CylinderRegion) AbstractRegion(com.sk89q.worldedit.regions.AbstractRegion)

Aggregations

AbstractRegion (com.sk89q.worldedit.regions.AbstractRegion)1 CylinderRegion (com.sk89q.worldedit.regions.CylinderRegion)1 Random (java.util.Random)1