Java Code Examples for com.sk89q.worldguard.protection.regions.RegionQuery#queryState()
The following examples show how to use
com.sk89q.worldguard.protection.regions.RegionQuery#queryState() .
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: HookWorldGuard_V7_0.java From CombatLogX with GNU General Public License v3.0 | 6 votes |
public static boolean allowsMobCombat(Location location) { WorldGuard api = getAPI(); WorldGuardPlatform platform = api.getPlatform(); RegionContainer container = platform.getRegionContainer(); RegionQuery query = container.createQuery(); com.sk89q.worldedit.util.Location weLocation = BukkitAdapter.adapt(location); if(MOB_COMBAT_FLAG instanceof StateFlag) { StateFlag mobCombatFlag = (StateFlag) MOB_COMBAT_FLAG; State state = query.queryState(weLocation, null, mobCombatFlag); return (state != State.DENY); } return true; }
Example 2
Source File: HookWorldGuard_V7_0.java From CombatLogX with GNU General Public License v3.0 | 5 votes |
public static boolean allowsPVP(Location location) { WorldGuard api = getAPI(); WorldGuardPlatform platform = api.getPlatform(); RegionContainer container = platform.getRegionContainer(); RegionQuery query = container.createQuery(); com.sk89q.worldedit.util.Location weLocation = BukkitAdapter.adapt(location); StateFlag.State state = query.queryState(weLocation, null, Flags.PVP); return (state != StateFlag.State.DENY); }
Example 3
Source File: WorldGuardIntegration.java From QuickShop-Reremake with GNU General Public License v3.0 | 4 votes |
@Override public boolean canCreateShopHere(@NotNull Player player, @NotNull Location location) { LocalPlayer localPlayer = WorldGuardPlugin.inst().wrapPlayer(player); com.sk89q.worldedit.util.Location wgLoc = BukkitAdapter.adapt(location); boolean canBypass = WorldGuard.getInstance() .getPlatform() .getSessionManager() .hasBypass(localPlayer, BukkitAdapter.adapt(location.getWorld())); if (canBypass) { Util.debugLog( "Player " + player.getName() + " bypassing the protection checks, because player have bypass permission in WorldGuard"); return true; } RegionContainer container = WorldGuard.getInstance().getPlatform().getRegionContainer(); RegionQuery query = container.createQuery(); if (query.getApplicableRegions(wgLoc).getRegions().isEmpty()) { return !whiteList; } for (WorldGuardFlags flag : createFlags) { switch (flag) { case BUILD: if (query.queryState(wgLoc, localPlayer, Flags.BUILD) == StateFlag.State.DENY) { return false; } break; case FLAG: if (query.queryState(wgLoc, localPlayer, this.createFlag) == StateFlag.State.DENY) { return false; } break; case CHEST_ACCESS: if (query.queryState(wgLoc, localPlayer, Flags.CHEST_ACCESS) == StateFlag.State.DENY) { return false; } break; case INTERACT: if (query.queryState(wgLoc, localPlayer, Flags.INTERACT) == StateFlag.State.DENY) { return false; } break; } } return true; }