From a71e1bf8b20bf81e32eb074bacba9acaa3e7c5f2 Mon Sep 17 00:00:00 2001 From: Brettflan Date: Tue, 6 Nov 2012 11:58:16 -0600 Subject: [PATCH] Wither boss second stage will no longer be able to destroy blocks in territory which has fireball protection; a bit crude just using fireball protection for Wither boss too, but I'd rather not add in a whole new set of xxxBlockWitherExplosion settings --- .../listeners/FactionsEntityListener.java | 30 ++++++++++++++++--- 1 file changed, 26 insertions(+), 4 deletions(-) diff --git a/src/com/massivecraft/factions/listeners/FactionsEntityListener.java b/src/com/massivecraft/factions/listeners/FactionsEntityListener.java index 4ba3cd0a..93d4756f 100644 --- a/src/com/massivecraft/factions/listeners/FactionsEntityListener.java +++ b/src/com/massivecraft/factions/listeners/FactionsEntityListener.java @@ -166,6 +166,7 @@ public class FactionsEntityListener implements Listener } else if ( + // it's a bit crude just using fireball protection for Wither boss too, but I'd rather not add in a whole new set of xxxBlockWitherExplosion or whatever (boomer instanceof Fireball || boomer instanceof WitherSkull || boomer instanceof Wither) && ( @@ -579,12 +580,33 @@ 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(); - if (stopEndermanBlockManipulation(event.getBlock().getLocation())) + // for now, only interested in Enderman and Wither boss tomfoolery + if (!(entity instanceof Enderman) && !(entity instanceof Wither)) return; + + Location loc = event.getBlock().getLocation(); + + if (entity instanceof Enderman) { - event.setCancelled(true); + if (stopEndermanBlockManipulation(loc)) + event.setCancelled(true); + } + else if (entity instanceof Wither) + { + Faction faction = Board.getFactionAt(new FLocation(loc)); + // it's a bit crude just using fireball protection, but I'd rather not add in a whole new set of xxxBlockWitherExplosion or whatever + if + ( + (faction.isNone() && Conf.wildernessBlockFireballs && !Conf.worldsNoWildernessProtection.contains(loc.getWorld().getName())) + || + (faction.isNormal() && (faction.hasPlayersOnline() ? Conf.territoryBlockFireballs : Conf.territoryBlockFireballsWhenOffline)) + || + (faction.isWarZone() && Conf.warZoneBlockFireballs) + || + faction.isSafeZone() + ) + event.setCancelled(true); } }