use of com.sk89q.worldguard.protection.regions.ProtectedRegion in project LandLord by SpatiumPrinceps.
the class WorldGuardHandler method canClaim.
public boolean canClaim(Player player, Chunk currChunk) {
RegionManager regionManager = wg.getRegionManager(player.getWorld());
if (regionManager != null) {
ProtectedRegion check = new ProtectedCuboidRegion("check", toVector(currChunk.getBlock(0, 0, 0)), toVector(currChunk.getBlock(15, 127, 15)));
List<ProtectedRegion> intersects = check.getIntersectingRegions(new ArrayList<>(regionManager.getRegions().values()));
for (ProtectedRegion intersect : intersects) {
if (!regionManager.getApplicableRegions(intersect).canBuild(wg.wrapPlayer(player))) {
return false;
}
}
}
return true;
}
use of com.sk89q.worldguard.protection.regions.ProtectedRegion in project LandLord by SpatiumPrinceps.
the class WorldGuardHandler method getRegion.
public OwnedLand getRegion(Chunk chunk) {
RegionManager manager = wg.getRegionContainer().get(chunk.getWorld());
ProtectedRegion pr = manager != null ? manager.getRegion(OwnedLand.getName(chunk)) : null;
return (pr != null ? new OwnedLand(pr, chunk) : null);
}
use of com.sk89q.worldguard.protection.regions.ProtectedRegion in project LandLord by SpatiumPrinceps.
the class WorldGuardHandler method getRegionsAsOL.
public List<OwnedLand> getRegionsAsOL(UUID id) {
List<OwnedLand> list = new ArrayList<>();
OfflinePlayer op = Bukkit.getOfflinePlayer(id);
if (op != null)
for (World world : Bukkit.getWorlds()) {
// Only count enabled worlds
if (!Landlord.getInstance().getConfig().getStringList("disabled-worlds").contains(world.getName()))
for (ProtectedRegion protectedRegion : getRegions(id, world)) {
list.add(getRegion(protectedRegion));
}
}
return list;
}
Aggregations