public static List<String> getRegionNames(Location location) { ApplicableRegionSet regionSet = getRegionSet(location); return regionSet == null ? null : regionSet.getRegions().stream() .map(ProtectedRegion::getId) .collect(Collectors.toList()); }
@Override public Association getAssociation(List<ProtectedRegion> regions) { if (source == null) { ApplicableRegionSet result = query.getApplicableRegions(location); source = result.getRegions(); } for (ProtectedRegion region : regions) { if ((region.getId().equals(ProtectedRegion.GLOBAL_REGION) && source.isEmpty()) || source.contains(region)) { return Association.OWNER; } } return Association.NON_MEMBER; }
public static boolean isInIgnoredRegion(Location location) { if (!isInRegion(location)) { return false; } PluginConfig config = Settings.getConfig(); return getRegionSet(location).getRegions() .stream() .anyMatch(region -> config.assistsRegionsIgnored.contains(region.getId())); }
Set<ProtectedRegion> entered = Sets.difference(toSet.getRegions(), lastRegionSet); Set<ProtectedRegion> exited = Sets.difference(lastRegionSet, toSet.getRegions()); lastRegionSet = toSet.getRegions();
/** * Initialize the session. * * @param player The player */ public void initialize(LocalPlayer player) { RegionQuery query = WorldGuard.getInstance().getPlatform().getRegionContainer().createQuery(); Location location = player.getLocation(); ApplicableRegionSet set = query.getApplicableRegions(location); lastValid = location; lastRegionSet = set.getRegions(); for (Handler handler : handlers.values()) { handler.initialize(player, location, set); } }