mirror of
https://github.com/EngineHub/WorldGuard.git
synced 2024-12-28 12:07:46 +01:00
Fix Location flag bounding.
Fixes WORLDGUARD-3716.
This commit is contained in:
parent
03cf9a668b
commit
f006a9584c
@ -73,17 +73,20 @@ public Location parseInput(FlagContext context) throws InvalidFlagFormat {
|
|||||||
if (obj instanceof ProtectedRegion) {
|
if (obj instanceof ProtectedRegion) {
|
||||||
ProtectedRegion rg = (ProtectedRegion) obj;
|
ProtectedRegion rg = (ProtectedRegion) obj;
|
||||||
if (WorldGuardPlugin.inst().getGlobalStateManager().get(player.getWorld()).boundedLocationFlags) {
|
if (WorldGuardPlugin.inst().getGlobalStateManager().get(player.getWorld()).boundedLocationFlags) {
|
||||||
if (!rg.contains(loc.getPosition()) && new RegionPermissionModel(WorldGuardPlugin.inst(), player).mayOverrideLocationFlagBounds(rg)) {
|
if (!rg.contains(loc.getPosition())) {
|
||||||
player.sendMessage(ChatColor.GRAY + "WARNING: Flag location is outside of region.");
|
if (new RegionPermissionModel(WorldGuardPlugin.inst(), player).mayOverrideLocationFlagBounds(rg)) {
|
||||||
} else {
|
player.sendMessage(ChatColor.GRAY + "WARNING: Flag location is outside of region.");
|
||||||
// no permission
|
} else {
|
||||||
throw new InvalidFlagFormat("You can't set that flag outside of the region boundaries.");
|
// no permission
|
||||||
|
throw new InvalidFlagFormat("You can't set that flag outside of the region boundaries.");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// clamp height to world limits
|
// clamp height to world limits
|
||||||
loc.setPosition(loc.getPosition().clampY(0, player.getWorld().getMaxHeight()));
|
loc.setPosition(loc.getPosition().clampY(0, player.getWorld().getMaxHeight()));
|
||||||
return loc;
|
return loc;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return loc;
|
||||||
}
|
}
|
||||||
throw new InvalidFlagFormat("Expected 'here' or x,y,z.");
|
throw new InvalidFlagFormat("Expected 'here' or x,y,z.");
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user