com.sk89q.worldguard.protection.regions.GlobalProtectedRegion Java Examples

The following examples show how to use com.sk89q.worldguard.protection.regions.GlobalProtectedRegion. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: RadiationCommandHandler.java    From CraftserveRadiation with Apache License 2.0 5 votes vote down vote up
private void flagGlobal(RegionManager regionManager, boolean value) {
    Objects.requireNonNull(regionManager, "regionMark");

    if (regionManager.hasRegion(GLOBAL_REGION_ID)) {
        ProtectedRegion existing = Objects.requireNonNull(regionManager.getRegion(GLOBAL_REGION_ID));
        this.flag(existing, value);
    } else {
        ProtectedRegion region = new GlobalProtectedRegion(GLOBAL_REGION_ID);
        this.flag(region, value);
        regionManager.addRegion(region);
    }
}
 
Example #2
Source File: Worldguard.java    From FastAsyncWorldedit with GNU General Public License v3.0 5 votes vote down vote up
private static Region adapt(ProtectedRegion region) {
    if (region instanceof ProtectedCuboidRegion) {
        return new CuboidRegion(region.getMinimumPoint(), region.getMaximumPoint());
    }
    if (region instanceof GlobalProtectedRegion) {
        return RegionWrapper.GLOBAL();
    }
    if (region instanceof ProtectedPolygonalRegion) {
        ProtectedPolygonalRegion casted = (ProtectedPolygonalRegion) region;
        BlockVector max = region.getMaximumPoint();
        BlockVector min = region.getMinimumPoint();
        return new Polygonal2DRegion(null, casted.getPoints(), min.getBlockY(), max.getBlockY());
    }
    return new AdaptedRegion(region);
}
 
Example #3
Source File: WorldGuardHandler.java    From uSkyBlock with GNU General Public License v3.0 5 votes vote down vote up
public static Set<ProtectedRegion> getIntersectingRegions(Location islandLocation) {
    log.entering(CN, "getIntersectingRegions", islandLocation);
    RegionManager regionManager = getRegionManager(islandLocation.getWorld());
    ApplicableRegionSet applicableRegions = regionManager.getApplicableRegions(getIslandRegion(islandLocation));
    Set<ProtectedRegion> regions = getRegions(applicableRegions);
    for (Iterator<ProtectedRegion> iterator = regions.iterator(); iterator.hasNext(); ) {
        if (iterator.next() instanceof GlobalProtectedRegion) {
            iterator.remove();
        }
    }
    log.exiting(CN, "getIntersectingRegions");
    return regions;
}