From 7d8893b5d7edd623565e1fae55c0e49612d00c5a Mon Sep 17 00:00:00 2001 From: Jesse Boyd Date: Sat, 27 Feb 2016 17:07:15 +1100 Subject: [PATCH] Fixes #900 --- .../plotsquared/bukkit/listeners/PlayerEvents.java | 12 +++++++----- 1 file changed, 7 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 b5057353c..50699755b 100644 --- a/Bukkit/src/main/java/com/plotsquared/bukkit/listeners/PlayerEvents.java +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/listeners/PlayerEvents.java @@ -753,14 +753,16 @@ public class PlayerEvents extends com.plotsquared.listener.PlotListener implemen @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true) public void onChange(final BlockFromToEvent e) { - final Block b = e.getBlock(); - Location loc = BukkitUtil.getLocation(b.getLocation()); - PlotArea area = loc.getPlotArea(); + Block from = e.getBlock(); + Block to = e.getToBlock(); + Location tloc = BukkitUtil.getLocation(to.getLocation()); + PlotArea area = tloc.getPlotArea(); if (area == null) { return; } - Plot plot = area.getOwnedPlot(loc); - if (plot == null || FlagManager.isPlotFlagTrue(plot, "disable-physics")) { + Plot plot = area.getOwnedPlot(tloc); + Location floc = BukkitUtil.getLocation(from.getLocation()); + if (!area.contains(floc.getX(), floc.getZ()) || !Objects.equals(plot, area.getOwnedPlot(floc)) || (plot != null && FlagManager.isPlotFlagTrue(plot, "disable-physics"))) { e.setCancelled(true); } }