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

This commit is contained in:
Brettflan 2012-11-06 11:58:16 -06:00
parent 7a31fb8217
commit a71e1bf8b2

View File

@ -166,6 +166,7 @@ public class FactionsEntityListener implements Listener
} }
else if 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) (boomer instanceof Fireball || boomer instanceof WitherSkull || boomer instanceof Wither)
&& &&
( (
@ -579,12 +580,33 @@ public class FactionsEntityListener implements Listener
{ {
if (event.isCancelled()) return; if (event.isCancelled()) return;
// for now, only interested in Enderman tomfoolery Entity entity = event.getEntity();
if (!(event.getEntity() instanceof Enderman)) return;
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);
} }
} }