use of com.sk89q.worldguard.protection.regions.RegionContainer in project TriggerReactor by wysohn.
the class WorldguardSupport method getRegionNames.
/**
* List all the names of regions that is covering the provided location
*
* @param loc location to check
* @return set of region names. It may be empty but never be null.
*/
public Set<String> getRegionNames(Location loc) {
Set<String> names = new HashSet<>();
RegionContainer container = wg.getPlatform().getRegionContainer();
for (ProtectedRegion region : container.get(BukkitAdapter.adapt(loc.getWorld())).getApplicableRegions(toVector3(loc)).getRegions()) {
names.add(region.getId());
}
return names;
}
use of com.sk89q.worldguard.protection.regions.RegionContainer in project EliteMobs by MagmaGuy.
the class WorldGuardFlagChecker method getIntegerFlagValue.
@Nullable
public static Integer getIntegerFlagValue(Location location, Flag flag) {
com.sk89q.worldedit.util.Location wgLocation = BukkitAdapter.adapt(location);
RegionContainer container = WorldGuard.getInstance().getPlatform().getRegionContainer();
RegionQuery query = container.createQuery();
ApplicableRegionSet set = query.getApplicableRegions(wgLocation);
Object object = set.queryValue(null, flag);
return object == null ? null : (Integer) object;
}
use of com.sk89q.worldguard.protection.regions.RegionContainer in project EliteMobs by MagmaGuy.
the class WorldGuardCompatibility method protectMinidungeonArea.
public static boolean protectMinidungeonArea(String regionName, Location location) {
try {
RegionContainer container = WorldGuard.getInstance().getPlatform().getRegionContainer();
RegionManager regions = container.get(BukkitAdapter.adapt(location.getWorld()));
ProtectedRegion protectedRegion = regions.getRegion(regionName);
if (protectedRegion == null) {
new WarningMessage("The region name picked did not exist!");
return false;
}
protectMinidungeonArea(protectedRegion);
return true;
} catch (Exception ex) {
new WarningMessage("Failed to protect region " + regionName + " !");
return false;
}
}
use of com.sk89q.worldguard.protection.regions.RegionContainer in project EliteMobs by MagmaGuy.
the class WorldGuardFlagChecker method doEventFlag.
public static boolean doEventFlag(Location location) {
com.sk89q.worldedit.util.Location wgLocation = BukkitAdapter.adapt(location);
RegionContainer container = WorldGuard.getInstance().getPlatform().getRegionContainer();
RegionQuery query = container.createQuery();
ApplicableRegionSet set = query.getApplicableRegions(wgLocation);
return set.testState(null, WorldGuardCompatibility.getEliteMobsEventsFlag());
}
use of com.sk89q.worldguard.protection.regions.RegionContainer in project EliteMobs by MagmaGuy.
the class WorldGuardFlagChecker method doEliteMobsSpawnFlag.
public static boolean doEliteMobsSpawnFlag(Location location) {
com.sk89q.worldedit.util.Location wgLocation = BukkitAdapter.adapt(location);
RegionContainer container = WorldGuard.getInstance().getPlatform().getRegionContainer();
RegionQuery query = container.createQuery();
ApplicableRegionSet set = query.getApplicableRegions(wgLocation);
return set.testState(null, WorldGuardCompatibility.getEliteMobsSpawnFlag());
}
Aggregations