Search in sources :

Example 6 with RegionContainer

use of com.sk89q.worldguard.protection.regions.RegionContainer in project EliteMobs by MagmaGuy.

the class WorldGuardFlagChecker method doExplosionRegenFlag.

public static boolean doExplosionRegenFlag(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.getEliteMobsExplosionRegen());
}
Also used : RegionContainer(com.sk89q.worldguard.protection.regions.RegionContainer) RegionQuery(com.sk89q.worldguard.protection.regions.RegionQuery) ApplicableRegionSet(com.sk89q.worldguard.protection.ApplicableRegionSet)

Example 7 with RegionContainer

use of com.sk89q.worldguard.protection.regions.RegionContainer in project EliteMobs by MagmaGuy.

the class WorldGuardFlagChecker method checkFlag.

public static boolean checkFlag(Location location, StateFlag stateFlag) {
    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, stateFlag);
}
Also used : RegionContainer(com.sk89q.worldguard.protection.regions.RegionContainer) RegionQuery(com.sk89q.worldguard.protection.regions.RegionQuery) ApplicableRegionSet(com.sk89q.worldguard.protection.ApplicableRegionSet)

Example 8 with RegionContainer

use of com.sk89q.worldguard.protection.regions.RegionContainer in project EliteMobs by MagmaGuy.

the class WorldGuardFlagChecker method doMobSpawnFlag.

public static boolean doMobSpawnFlag(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, Flags.MOB_SPAWNING);
}
Also used : RegionContainer(com.sk89q.worldguard.protection.regions.RegionContainer) RegionQuery(com.sk89q.worldguard.protection.regions.RegionQuery) ApplicableRegionSet(com.sk89q.worldguard.protection.ApplicableRegionSet)

Example 9 with RegionContainer

use of com.sk89q.worldguard.protection.regions.RegionContainer in project MyPet by xXKeyleXx.

the class WorldGuardHook method getDoubleValue.

public Collection<Double> getDoubleValue(Location loc, Player player, DoubleFlag flag) {
    if (is7) {
        RegionContainer rc = WorldGuard.getInstance().getPlatform().getRegionContainer();
        return rc.createQuery().queryAllValues(BukkitAdapter.adapt(loc), player != null ? WorldGuardPlugin.inst().wrapPlayer(player) : null, flag);
    } else {
        try {
            RegionManager mgr = (RegionManager) METHOD_getRegionManager.invoke(wgp, loc.getWorld());
            ApplicableRegionSet set = (ApplicableRegionSet) METHOD_getApplicableRegions.invoke(mgr, loc);
            return set.queryAllValues(player != null ? wgp.wrapPlayer(player) : null, flag);
        } catch (Exception ignored) {
            return Collections.emptyList();
        }
    }
}
Also used : RegionContainer(com.sk89q.worldguard.protection.regions.RegionContainer) RegionManager(com.sk89q.worldguard.protection.managers.RegionManager) ApplicableRegionSet(com.sk89q.worldguard.protection.ApplicableRegionSet)

Example 10 with RegionContainer

use of com.sk89q.worldguard.protection.regions.RegionContainer in project MyPet by xXKeyleXx.

the class WorldGuardHook method getState.

public StateFlag.State getState(Location loc, Player player, StateFlag... flags) {
    if (is7) {
        RegionContainer rc = WorldGuard.getInstance().getPlatform().getRegionContainer();
        if (rc != null) {
            return rc.createQuery().queryState(BukkitAdapter.adapt(loc), player != null ? WorldGuardPlugin.inst().wrapPlayer(player) : null, flags);
        }
    } else {
        try {
            RegionManager mgr = (RegionManager) METHOD_getRegionManager.invoke(wgp, loc.getWorld());
            ApplicableRegionSet set = (ApplicableRegionSet) METHOD_getApplicableRegions.invoke(mgr, loc);
            return set.queryState(player != null ? wgp.wrapPlayer(player) : null, flags);
        } catch (Exception ignored) {
        }
    }
    return StateFlag.State.ALLOW;
}
Also used : RegionContainer(com.sk89q.worldguard.protection.regions.RegionContainer) RegionManager(com.sk89q.worldguard.protection.managers.RegionManager) ApplicableRegionSet(com.sk89q.worldguard.protection.ApplicableRegionSet)

Aggregations

RegionContainer (com.sk89q.worldguard.protection.regions.RegionContainer)15 ApplicableRegionSet (com.sk89q.worldguard.protection.ApplicableRegionSet)8 RegionManager (com.sk89q.worldguard.protection.managers.RegionManager)8 WarningMessage (com.magmaguy.elitemobs.utils.WarningMessage)6 FlagConflictException (com.sk89q.worldguard.protection.flags.registry.FlagConflictException)6 ProtectedRegion (com.sk89q.worldguard.protection.regions.ProtectedRegion)6 RegionQuery (com.sk89q.worldguard.protection.regions.RegionQuery)6 GlobalProtectedRegion (com.sk89q.worldguard.protection.regions.GlobalProtectedRegion)5 DefaultDomain (com.sk89q.worldguard.domains.DefaultDomain)2 BlockVector3 (com.sk89q.worldedit.math.BlockVector3)1 ProtectedCuboidRegion (com.sk89q.worldguard.protection.regions.ProtectedCuboidRegion)1 HashSet (java.util.HashSet)1 Nullable (javax.annotation.Nullable)1