Search in sources :

Example 26 with ProtectedRegion

use of com.sk89q.worldguard.protection.regions.ProtectedRegion in project LandLord by SpatiumPrinceps.

the class ManageAll method onManageAll.

public void onManageAll(Player player) {
    List<OwnedLand> lands = new ArrayList<>();
    for (World world : Bukkit.getWorlds()) {
        for (ProtectedRegion pr : plugin.getWgHandler().getRegions(player.getUniqueId(), world)) {
            lands.add(plugin.getLand(pr));
        }
    }
    ManageGUIAll gui = new ManageGUIAll(player, lands);
    gui.display();
}
Also used : ManageGUIAll(biz.princeps.landlord.guis.ManageGUIAll) OwnedLand(biz.princeps.landlord.util.OwnedLand) ArrayList(java.util.ArrayList) ProtectedRegion(com.sk89q.worldguard.protection.regions.ProtectedRegion) World(org.bukkit.World)

Example 27 with ProtectedRegion

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;
}
Also used : ProtectedRegion(com.sk89q.worldguard.protection.regions.ProtectedRegion) RegionManager(com.sk89q.worldguard.protection.managers.RegionManager) ProtectedCuboidRegion(com.sk89q.worldguard.protection.regions.ProtectedCuboidRegion)

Example 28 with ProtectedRegion

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);
}
Also used : OwnedLand(biz.princeps.landlord.util.OwnedLand) ProtectedRegion(com.sk89q.worldguard.protection.regions.ProtectedRegion) RegionManager(com.sk89q.worldguard.protection.managers.RegionManager)

Example 29 with ProtectedRegion

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;
}
Also used : OwnedLand(biz.princeps.landlord.util.OwnedLand) ProtectedRegion(com.sk89q.worldguard.protection.regions.ProtectedRegion)

Aggregations

ProtectedRegion (com.sk89q.worldguard.protection.regions.ProtectedRegion)29 ArrayList (java.util.ArrayList)7 World (org.bukkit.World)7 RegionManager (com.sk89q.worldguard.protection.managers.RegionManager)6 OwnedLand (biz.princeps.landlord.util.OwnedLand)5 BuyRegion (me.wiefferink.areashop.regions.BuyRegion)5 GeneralRegion (me.wiefferink.areashop.regions.GeneralRegion)5 RentRegion (me.wiefferink.areashop.regions.RentRegion)5 Vector (com.sk89q.worldedit.Vector)4 HashSet (java.util.HashSet)4 Location (org.bukkit.Location)4 Player (org.bukkit.entity.Player)4 LandlordCommand (biz.princeps.landlord.commands.LandlordCommand)3 BlockVector (com.sk89q.worldedit.BlockVector)3 Flag (com.sk89q.worldguard.protection.flags.Flag)3 StateFlag (com.sk89q.worldguard.protection.flags.StateFlag)3 List (java.util.List)3 Landlord (biz.princeps.landlord.Landlord)2 ManageGUIAll (biz.princeps.landlord.guis.ManageGUIAll)2 EditSession (com.sk89q.worldedit.EditSession)2