From 0e8ae9e6e41239130b5810af262852d076ba60d0 Mon Sep 17 00:00:00 2001 From: boy0001 Date: Tue, 25 Aug 2015 05:56:22 +1000 Subject: [PATCH] WE tweak / Fix teleport event --- .../plotsquared/bukkit/listeners/PlayerEvents.java | 13 +++---------- .../bukkit/listeners/worldedit/WEManager.java | 2 +- 2 files changed, 4 insertions(+), 11 deletions(-) diff --git a/src/main/java/com/plotsquared/bukkit/listeners/PlayerEvents.java b/src/main/java/com/plotsquared/bukkit/listeners/PlayerEvents.java index 35c8c64d0..83e357db0 100644 --- a/src/main/java/com/plotsquared/bukkit/listeners/PlayerEvents.java +++ b/src/main/java/com/plotsquared/bukkit/listeners/PlayerEvents.java @@ -1422,7 +1422,6 @@ public class PlayerEvents extends com.plotsquared.listener.PlotListener implemen } final org.bukkit.Location from = event.getFrom(); final org.bukkit.Location to = event.getTo(); - int x2; if (MathMan.roundInt(from.getX()) != (x2 = MathMan.roundInt(to.getX()))) { Player player = event.getPlayer(); @@ -1440,10 +1439,7 @@ public class PlayerEvents extends com.plotsquared.listener.PlotListener implemen PlotId id = plotManager.getPlotId(plotworld, x2, 0, MathMan.roundInt(to.getZ())); Plot lastPlot = (Plot) pp.getMeta("lastplot"); if (id == null) { - if (lastPlot == null) { - return; - } - if (!plotExit(pp, lastPlot)) { + if (lastPlot != null && !plotExit(pp, lastPlot)) { MainUtil.sendMessage(pp, C.NO_PERMISSION_EVENT, C.PERMISSION_ADMIN_EXIT_DENIED); if (lastPlot.equals(MainUtil.getPlot(BukkitUtil.getLocation(from)))) { player.teleport(from); @@ -1456,7 +1452,7 @@ public class PlayerEvents extends com.plotsquared.listener.PlotListener implemen } } else if (lastPlot != null && id.equals(lastPlot.id)) { - return; + return; } else { Plot plot = MainUtil.getPlot(worldname, id); @@ -1506,10 +1502,7 @@ public class PlayerEvents extends com.plotsquared.listener.PlotListener implemen PlotId id = plotManager.getPlotId(plotworld, x2, 0, z2); Plot lastPlot = (Plot) pp.getMeta("lastplot"); if (id == null) { - if (lastPlot == null) { - return; - } - if (!plotExit(pp, lastPlot)) { + if (lastPlot != null && !plotExit(pp, lastPlot)) { MainUtil.sendMessage(pp, C.NO_PERMISSION_EVENT, C.PERMISSION_ADMIN_EXIT_DENIED); if (lastPlot.equals(MainUtil.getPlot(BukkitUtil.getLocation(from)))) { player.teleport(from); diff --git a/src/main/java/com/plotsquared/bukkit/listeners/worldedit/WEManager.java b/src/main/java/com/plotsquared/bukkit/listeners/worldedit/WEManager.java index 9a80e04a5..3bed10e2b 100644 --- a/src/main/java/com/plotsquared/bukkit/listeners/worldedit/WEManager.java +++ b/src/main/java/com/plotsquared/bukkit/listeners/worldedit/WEManager.java @@ -28,7 +28,7 @@ public class WEManager { HashSet regions = new HashSet<>(); UUID uuid = player.getUUID(); for (Plot plot : PS.get().getPlotsInWorld(player.getLocation().getWorld())) { - if (!plot.isBasePlot() || Settings.DONE_RESTRICTS_BUILDING && FlagManager.getPlotFlag(plot, "done") != null) { + if (!plot.isBasePlot() || (Settings.DONE_RESTRICTS_BUILDING && FlagManager.getPlotFlag(plot, "done") != null)) { continue; } if (Settings.WE_ALLOW_HELPER ? plot.isAdded(uuid) : (plot.isOwner(uuid) || plot.getTrusted().contains(uuid))) {