From 31908090b8f564186dd8f3dda2af59f92cb56c27 Mon Sep 17 00:00:00 2001 From: Jesse Boyd Date: Sat, 23 Sep 2017 14:07:52 +1000 Subject: [PATCH] Buld height check --- .../plotsquared/bukkit/listeners/PlayerEvents.java | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/Bukkit/src/main/java/com/plotsquared/bukkit/listeners/PlayerEvents.java b/Bukkit/src/main/java/com/plotsquared/bukkit/listeners/PlayerEvents.java index 5b6ea8251..577b72694 100644 --- a/Bukkit/src/main/java/com/plotsquared/bukkit/listeners/PlayerEvents.java +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/listeners/PlayerEvents.java @@ -701,6 +701,10 @@ public class PlayerEvents extends PlotListener implements Listener { event.setCancelled(true); return; } + } else if ((location.getY() > area.MAX_BUILD_HEIGHT || location.getY() < area.MIN_BUILD_HEIGHT) && !Permissions + .hasPermission(plotPlayer, C.PERMISSION_ADMIN_BUILD_HEIGHTLIMIT)) { + event.setCancelled(true); + MainUtil.sendMessage(plotPlayer, C.HEIGHT_LIMIT.s().replace("{limit}", String.valueOf(area.MAX_BUILD_HEIGHT))); } if (!plot.hasOwner()) { if (Permissions.hasPermission(plotPlayer, C.PERMISSION_ADMIN_DESTROY_UNOWNED)) { @@ -2390,6 +2394,11 @@ public class PlayerEvents extends PlotListener implements Listener { PlotPlayer pp = BukkitUtil.getPlayer(player); Plot plot = area.getPlot(location); if (plot != null) { + if ((location.getY() > area.MAX_BUILD_HEIGHT || location.getY() < area.MIN_BUILD_HEIGHT) && !Permissions + .hasPermission(pp, C.PERMISSION_ADMIN_BUILD_HEIGHTLIMIT)) { + event.setCancelled(true); + MainUtil.sendMessage(pp, C.HEIGHT_LIMIT.s().replace("{limit}", String.valueOf(area.MAX_BUILD_HEIGHT))); + } if (!plot.hasOwner()) { if (!Permissions.hasPermission(pp, C.PERMISSION_ADMIN_BUILD_UNOWNED)) { MainUtil.sendMessage(pp, C.NO_PERMISSION_EVENT, C.PERMISSION_ADMIN_BUILD_UNOWNED); @@ -2422,11 +2431,6 @@ public class PlayerEvents extends PlotListener implements Listener { sendBlockChange(block.getLocation(), block.getType(), block.getData()); } } - if (location.getY() > area.MAX_BUILD_HEIGHT && location.getY() < area.MIN_BUILD_HEIGHT && !Permissions - .hasPermission(pp, C.PERMISSION_ADMIN_BUILD_HEIGHTLIMIT)) { - event.setCancelled(true); - MainUtil.sendMessage(pp, C.HEIGHT_LIMIT.s().replace("{limit}", String.valueOf(area.MAX_BUILD_HEIGHT))); - } } else if (!Permissions.hasPermission(pp, C.PERMISSION_ADMIN_BUILD_ROAD)) { MainUtil.sendMessage(pp, C.NO_PERMISSION_EVENT, C.PERMISSION_ADMIN_BUILD_ROAD); event.setCancelled(true);