Fix bed explosion in hell biome when flag not present

This commit is contained in:
Jesse Boyd 2016-02-27 16:44:29 +11:00
parent 1a80b344b9
commit 7a97c69d4f

View file

@ -1,19 +1,18 @@
package com.plotsquared.bukkit.listeners; 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.PS;
import com.intellectualcrafters.plot.flag.FlagManager; import com.intellectualcrafters.plot.flag.FlagManager;
import com.intellectualcrafters.plot.object.Location; import com.intellectualcrafters.plot.object.Location;
import com.intellectualcrafters.plot.object.Plot; import com.intellectualcrafters.plot.object.Plot;
import com.intellectualcrafters.plot.object.PlotArea; import com.intellectualcrafters.plot.object.PlotArea;
import com.plotsquared.bukkit.util.BukkitUtil; 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 { public class PlayerEvents_1_8_3 implements Listener {
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true) @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
@ -36,18 +35,16 @@ public class PlayerEvents_1_8_3 implements Listener {
return; return;
} }
Plot plot = area.getOwnedPlot(loc); Plot plot = area.getOwnedPlot(loc);
if (plot == null) { if (plot == null || !FlagManager.isPlotFlagTrue(plot, "explosion")) {
event.setCancelled(true); event.setCancelled(true);
} }
if (FlagManager.isPlotFlagTrue(plot, "explosion")) { final Iterator<Block> iter = event.blockList().iterator();
final Iterator<Block> iter = event.blockList().iterator(); while (iter.hasNext()) {
while (iter.hasNext()) { final Block b = iter.next();
final Block b = iter.next(); if (!plot.equals(area.getOwnedPlot(BukkitUtil.getLocation(b.getLocation())))) {
if (!plot.equals(BukkitUtil.getLocation(b.getLocation()).getPlotAbs())) { iter.remove();
iter.remove();
}
} }
return;
} }
return;
} }
} }