From 20b359c11ae8793de5db5333878267cf38210b3c Mon Sep 17 00:00:00 2001 From: Brettflan Date: Tue, 6 Nov 2012 11:58:14 -0600 Subject: [PATCH] Wither boss second stage will no longer be able to destroy blocks in territory which has explosion protection (explosion faction flag turned off) --- .../listeners/FactionsEntityListener.java | 20 ++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/src/com/massivecraft/factions/listeners/FactionsEntityListener.java b/src/com/massivecraft/factions/listeners/FactionsEntityListener.java index d052b60d..b506237e 100644 --- a/src/com/massivecraft/factions/listeners/FactionsEntityListener.java +++ b/src/com/massivecraft/factions/listeners/FactionsEntityListener.java @@ -17,6 +17,7 @@ import org.bukkit.entity.LivingEntity; import org.bukkit.entity.Player; import org.bukkit.entity.Projectile; import org.bukkit.entity.TNTPrimed; +import org.bukkit.entity.Wither; import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; import org.bukkit.event.Listener; @@ -413,14 +414,23 @@ public class FactionsEntityListener implements Listener { if (event.isCancelled()) return; - // for now, only interested in Enderman tomfoolery - if (!(event.getEntity() instanceof Enderman)) return; + Entity entity = event.getEntity(); + + // for now, only interested in Enderman and Wither boss tomfoolery + if (!(entity instanceof Enderman) && !(entity instanceof Wither)) return; FLocation floc = new FLocation(event.getBlock()); Faction faction = Board.getFactionAt(floc); - if (faction.getFlag(FFlag.ENDERGRIEF)) return; - - event.setCancelled(true); + if (entity instanceof Enderman) + { + if ( ! faction.getFlag(FFlag.ENDERGRIEF)) + event.setCancelled(true); + } + else if (entity instanceof Wither) + { + if ( ! faction.getFlag(FFlag.EXPLOSIONS)) + event.setCancelled(true); + } } }