From f72d39ed85870b12f0ac801014d166e8becec1c8 Mon Sep 17 00:00:00 2001 From: MattBDev <4009945+MattBDev@users.noreply.github.com> Date: Wed, 1 May 2019 12:11:35 -0400 Subject: [PATCH] Fixes #1318 --- .../bukkit/listeners/PlayerEvents.java | 33 ++++++++++++------- 1 file changed, 21 insertions(+), 12 deletions(-) diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/listeners/PlayerEvents.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/listeners/PlayerEvents.java index be4a24c65..ebb7a8617 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/listeners/PlayerEvents.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/listeners/PlayerEvents.java @@ -1808,7 +1808,7 @@ import org.bukkit.util.Vector; @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true) public void onInteract(PlayerInteractAtEntityEvent e) { Entity entity = e.getRightClicked(); - if (!(entity instanceof ArmorStand)) { + if (!(entity instanceof ArmorStand) && !(entity instanceof ItemFrame)) { return; } Location location = BukkitUtil.getLocation(e.getRightClicked().getLocation()); @@ -1816,25 +1816,34 @@ import org.bukkit.util.Vector; if (area == null) { return; } - EntitySpawnListener.testNether(entity); - - Plot plot = area.getPlotAbs(location); + Plot plot = location.getPlotAbs(); PlotPlayer pp = BukkitUtil.getPlayer(e.getPlayer()); if (plot == null) { if (!Permissions.hasPermission(pp, "plots.admin.interact.road")) { - MainUtil.sendMessage(pp, Captions.NO_PERMISSION_EVENT, "plots.admin.interact.road"); - e.setCancelled(true); - } - } else if (!plot.hasOwner()) { - if (!Permissions.hasPermission(pp, "plots.admin.interact.unowned")) { MainUtil - .sendMessage(pp, Captions.NO_PERMISSION_EVENT, "plots.admin.interact.unowned"); + .sendMessage(pp, Captions.NO_PERMISSION_EVENT, "plots.admin.interact.road"); e.setCancelled(true); } } else { - UUID uuid = pp.getUUID(); - if (!plot.isAdded(uuid)) { + if (Settings.Done.RESTRICT_BUILDING && plot.hasFlag(Flags.DONE)) { + if (!Permissions.hasPermission(pp, Captions.PERMISSION_ADMIN_BUILD_OTHER)) { + MainUtil.sendMessage(pp, Captions.NO_PERMISSION_EVENT, Captions.PERMISSION_ADMIN_BUILD_OTHER); + e.setCancelled(true); + return; + } + } + if (!plot.hasOwner()) { + if (!Permissions.hasPermission(pp, "plots.admin.interact.unowned")) { + MainUtil.sendMessage(pp, Captions.NO_PERMISSION_EVENT, + "plots.admin.interact.unowned"); + e.setCancelled(true); + } + } else { + UUID uuid = pp.getUUID(); + if (plot.isAdded(uuid)) { + return; + } if (Flags.MISC_INTERACT.isTrue(plot)) { return; }