com.sk89q.worldguard.protection.flags.Flags Java Examples
The following examples show how to use
com.sk89q.worldguard.protection.flags.Flags.
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: WorldGuardSupport.java From QualityArmory with GNU General Public License v3.0 | 5 votes |
public static boolean a(Location loc){ WorldGuard wGuard = WorldGuard.getInstance(); for (ProtectedRegion k : wGuard.getPlatform().getRegionContainer().get(BukkitAdapter.adapt(loc.getWorld())).getRegions().values()) { if (k.contains(loc.getBlockX(), loc.getBlockY(), loc.getBlockZ())) { if (k.getFlag(Flags.PVP) == com.sk89q.worldguard.protection.flags.StateFlag.State.DENY) return false; } } return true; }
Example #2
Source File: WorldGuardSupport.java From QualityArmory with GNU General Public License v3.0 | 5 votes |
public static boolean canExplode(Location loc){ WorldGuard wGuard = WorldGuard.getInstance(); for (ProtectedRegion k : wGuard.getPlatform().getRegionContainer().get(BukkitAdapter.adapt(loc.getWorld())).getRegions().values()) { if (k.contains(loc.getBlockX(), loc.getBlockY(), loc.getBlockZ())) { if (k.getFlag(Flags.OTHER_EXPLOSION) == com.sk89q.worldguard.protection.flags.StateFlag.State.DENY) return false; } } return true; }
Example #3
Source File: WorldGuard7FAWEHook.java From Skript with GNU General Public License v3.0 | 5 votes |
@Override public boolean canBuild_i(final Player p, final Location l) { if (p.hasPermission("worldguard.region.bypass." + l.getWorld().getName())) return true; RegionQuery query = WorldGuard.getInstance().getPlatform().getRegionContainer().createQuery(); LocalPlayer player = WorldGuardPlugin.inst().wrapPlayer(p); return query.testState(BukkitAdapter.adapt(l), player, Flags.BUILD); }
Example #4
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 #5
Source File: WorldGuardHandler.java From uSkyBlock with GNU General Public License v3.0 | 5 votes |
private static void updateLockStatus(ProtectedRegion region, boolean isLocked) { if (isLocked) { region.setFlag(Flags.ENTRY, StateFlag.State.DENY); } else { region.setFlag(Flags.ENTRY, null); } }
Example #6
Source File: RadiationCommandHandler.java From CraftserveRadiation with Apache License 2.0 | 4 votes |
private void define(RegionManager regionManager, ProtectedRegion region) { Objects.requireNonNull(regionManager, "regionManager"); Objects.requireNonNull(region, "region"); String id = region.getId(); if (regionManager.hasRegion(id)) { ProtectedRegion existing = Objects.requireNonNull(regionManager.getRegion(id)); region.copyFrom(existing); } this.flag(region, false); region.setFlag(Flags.PASSTHROUGH, StateFlag.State.ALLOW); regionManager.addRegion(region); }
Example #7
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; }
Example #8
Source File: WorldGuardIntegration.java From QuickShop-Reremake with GNU General Public License v3.0 | 4 votes |
@Override public boolean canTradeShopHere(@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 : tradeFlags) { switch (flag) { case BUILD: if (!query.testState(wgLoc, localPlayer, Flags.BUILD)) { return false; } break; case FLAG: if (!query.testState(wgLoc, localPlayer, this.tradeFlag)) { return false; } break; case CHEST_ACCESS: if (!query.testState(wgLoc, localPlayer, Flags.CHEST_ACCESS)) { return false; } break; case INTERACT: if (!query.testState(wgLoc, localPlayer, Flags.INTERACT)) { return false; } break; } } return true; }
Example #9
Source File: WorldGuardHandler.java From uSkyBlock with GNU General Public License v3.0 | 4 votes |
private static ProtectedCuboidRegion setRegionFlags(IslandInfo islandConfig, String regionName) { Location islandLocation = islandConfig.getIslandLocation(); BlockVector3 minPoint = getProtectionVectorRight(islandLocation); BlockVector3 maxPoint = getProtectionVectorLeft(islandLocation); if (regionName != null && regionName.endsWith("nether")) { minPoint = minPoint.withY(6); maxPoint = maxPoint.withY(120); } ProtectedCuboidRegion region = new ProtectedCuboidRegion(regionName, minPoint, maxPoint); final DefaultDomain owners = new DefaultDomain(); DefaultDomain members = new DefaultDomain(); for (UUID member : islandConfig.getMemberUUIDs()) { owners.addPlayer(member); } for (UUID trust : islandConfig.getTrusteeUUIDs()) { members.addPlayer(trust); } region.setOwners(owners); region.setMembers(members); region.setPriority(100); if (uSkyBlock.getInstance().getConfig().getBoolean("worldguard.entry-message", true)) { if (owners.size() == 0) { region.setFlag(Flags.GREET_MESSAGE, tr("\u00a74** You are entering a protected - but abandoned - island area.")); } else { region.setFlag(Flags.GREET_MESSAGE, tr("\u00a7d** You are entering \u00a7b{0}''s \u00a7disland.", islandConfig.getLeader())); } } else { region.setFlag(Flags.GREET_MESSAGE, null); } if (uSkyBlock.getInstance().getConfig().getBoolean("worldguard.exit-message", true)) { if (owners.size() == 0) { region.setFlag(Flags.FAREWELL_MESSAGE, tr("\u00a74** You are leaving an abandoned island.")); } else { region.setFlag(Flags.FAREWELL_MESSAGE, tr("\u00a7d** You are leaving \u00a7b{0}''s \u00a7disland.", islandConfig.getLeader())); } } else { region.setFlag(Flags.FAREWELL_MESSAGE, null); } region.setFlag(Flags.PVP, null); boolean isLocked = islandConfig.isLocked(); updateLockStatus(region, isLocked); return region; }
Example #10
Source File: WorldGuard7Hook.java From RandomTeleport with GNU General Public License v3.0 | 4 votes |
private boolean canBuild(LocalPlayer player, Location location) { return WorldGuard.getInstance().getPlatform().getRegionContainer().createQuery().testBuild(location, player, Flags.BUILD); }
Example #11
Source File: WorldGuardHandler7_beta_2.java From AreaShop with GNU General Public License v3.0 | 4 votes |
@Override public Flag<?> fuzzyMatchFlag(String flagName) { return Flags.fuzzyMatchFlag(WorldGuard.getInstance().getFlagRegistry(), flagName); }
Example #12
Source File: FastAsyncWorldEditWorldGuardHandler.java From AreaShop with GNU General Public License v3.0 | 4 votes |
@Override public Flag<?> fuzzyMatchFlag(String flagName) { return Flags.fuzzyMatchFlag(WorldGuard.getInstance().getFlagRegistry(), flagName); }
Example #13
Source File: WorldGuardHandler7_beta_1.java From AreaShop with GNU General Public License v3.0 | 4 votes |
@Override public Flag<?> fuzzyMatchFlag(String flagName) { return Flags.fuzzyMatchFlag(WorldGuard.getInstance().getFlagRegistry(), flagName); }