From 7a97c69d4fd1b7e8e151320731d220689fef49e6 Mon Sep 17 00:00:00 2001 From: Jesse Boyd Date: Sat, 27 Feb 2016 16:44:29 +1100 Subject: [PATCH] Fix bed explosion in hell biome when flag not present --- .../bukkit/listeners/PlayerEvents_1_8_3.java | 31 +++++++++---------- 1 file changed, 14 insertions(+), 17 deletions(-) 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; } }