From f006a9584cc86beaf22b8c52157faf866fd05167 Mon Sep 17 00:00:00 2001 From: wizjany Date: Wed, 22 Jun 2016 14:52:19 -0400 Subject: [PATCH] Fix Location flag bounding. Fixes WORLDGUARD-3716. --- .../worldguard/protection/flags/LocationFlag.java | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/worldguard-legacy/src/main/java/com/sk89q/worldguard/protection/flags/LocationFlag.java b/worldguard-legacy/src/main/java/com/sk89q/worldguard/protection/flags/LocationFlag.java index d6753f53..b8782bf7 100644 --- a/worldguard-legacy/src/main/java/com/sk89q/worldguard/protection/flags/LocationFlag.java +++ b/worldguard-legacy/src/main/java/com/sk89q/worldguard/protection/flags/LocationFlag.java @@ -73,17 +73,20 @@ public Location parseInput(FlagContext context) throws InvalidFlagFormat { if (obj instanceof ProtectedRegion) { ProtectedRegion rg = (ProtectedRegion) obj; if (WorldGuardPlugin.inst().getGlobalStateManager().get(player.getWorld()).boundedLocationFlags) { - if (!rg.contains(loc.getPosition()) && new RegionPermissionModel(WorldGuardPlugin.inst(), player).mayOverrideLocationFlagBounds(rg)) { - player.sendMessage(ChatColor.GRAY + "WARNING: Flag location is outside of region."); - } else { - // no permission - throw new InvalidFlagFormat("You can't set that flag outside of the region boundaries."); + if (!rg.contains(loc.getPosition())) { + if (new RegionPermissionModel(WorldGuardPlugin.inst(), player).mayOverrideLocationFlagBounds(rg)) { + player.sendMessage(ChatColor.GRAY + "WARNING: Flag location is outside of region."); + } else { + // no permission + throw new InvalidFlagFormat("You can't set that flag outside of the region boundaries."); + } } // clamp height to world limits loc.setPosition(loc.getPosition().clampY(0, player.getWorld().getMaxHeight())); return loc; } } + return loc; } throw new InvalidFlagFormat("Expected 'here' or x,y,z."); }