diff --git a/Bukkit/src/main/java/com/plotsquared/bukkit/listeners/PlayerEvents_1_8_3.java b/Bukkit/src/main/java/com/plotsquared/bukkit/listeners/PlayerEvents_1_8_3.java index a52e78268..dd8342307 100644 --- a/Bukkit/src/main/java/com/plotsquared/bukkit/listeners/PlayerEvents_1_8_3.java +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/listeners/PlayerEvents_1_8_3.java @@ -1,19 +1,18 @@ package com.plotsquared.bukkit.listeners; -import java.util.Iterator; - -import org.bukkit.block.Block; -import org.bukkit.event.EventHandler; -import org.bukkit.event.EventPriority; -import org.bukkit.event.Listener; -import org.bukkit.event.block.BlockExplodeEvent; - import com.intellectualcrafters.plot.PS; import com.intellectualcrafters.plot.flag.FlagManager; import com.intellectualcrafters.plot.object.Location; import com.intellectualcrafters.plot.object.Plot; import com.intellectualcrafters.plot.object.PlotArea; import com.plotsquared.bukkit.util.BukkitUtil; +import org.bukkit.block.Block; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.Listener; +import org.bukkit.event.block.BlockExplodeEvent; + +import java.util.Iterator; public class PlayerEvents_1_8_3 implements Listener { @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true) @@ -36,18 +35,16 @@ public class PlayerEvents_1_8_3 implements Listener { return; } Plot plot = area.getOwnedPlot(loc); - if (plot == null) { + if (plot == null || !FlagManager.isPlotFlagTrue(plot, "explosion")) { event.setCancelled(true); } - if (FlagManager.isPlotFlagTrue(plot, "explosion")) { - final Iterator iter = event.blockList().iterator(); - while (iter.hasNext()) { - final Block b = iter.next(); - if (!plot.equals(BukkitUtil.getLocation(b.getLocation()).getPlotAbs())) { - iter.remove(); - } + final Iterator iter = event.blockList().iterator(); + while (iter.hasNext()) { + final Block b = iter.next(); + if (!plot.equals(area.getOwnedPlot(BukkitUtil.getLocation(b.getLocation())))) { + iter.remove(); } - return; } + return; } }