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);
}
}
Aggregations