Permalink
Browse files

Add a flag that blocks the damage from withers.

Doesn't cover the skull projectiles, just body damage.
Fixes WORLDGUARD-3787.
  • Loading branch information...
wizjany committed Jan 8, 2017
1 parent fb90b14 commit e019890f1df3280b7cf9f03e4bcab1faf22247ae
@@ -462,8 +462,6 @@ public void onEntityExplode(EntityExplodeEvent event) {
}
// allow wither skull blocking since there is no dedicated flag atm
if (wcfg.useRegions) {
RegionManager mgr = plugin.getGlobalRegionManager().get(world);
for (Block block : event.blockList()) {
if (!plugin.getRegionContainer().createQuery().getApplicableRegions(block.getLocation()).allows(DefaultFlag.GHAST_FIREBALL)) {
event.blockList().clear();
@@ -481,6 +479,15 @@ public void onEntityExplode(EntityExplodeEvent event) {
event.blockList().clear();
return;
}
if (wcfg.useRegions) {
for (Block block : event.blockList()) {
if (!plugin.getGlobalRegionManager().allows(DefaultFlag.WITHER_DAMAGE, block.getLocation())) {
event.blockList().clear();
event.setCancelled(true);
return;
}
}
}
} else {
// unhandled entity
if (wcfg.blockOtherExplosions) {
@@ -691,6 +698,12 @@ public void onEntityChangeBlock(EntityChangeBlockEvent event) {
event.setCancelled(true);
return;
}
if (wcfg.useRegions) {
if (!plugin.getGlobalRegionManager().allows(DefaultFlag.WITHER_DAMAGE, location)) {
event.setCancelled(true);
return;
}
}
} else if (/*ent instanceof Zombie && */event instanceof EntityBreakDoorEvent) {
if (wcfg.blockZombieDoorDestruction) {
event.setCancelled(true);
@@ -75,6 +75,7 @@
public static final StateFlag GHAST_FIREBALL = new StateFlag("ghast-fireball", true);
public static final StateFlag FIREWORK_DAMAGE = new StateFlag("firework-damage", true);
public static final StateFlag OTHER_EXPLOSION = new StateFlag("other-explosion", true);
public static final StateFlag WITHER_DAMAGE = new StateFlag("wither-damage", true);
public static final StateFlag FIRE_SPREAD = new StateFlag("fire-spread", true);
public static final StateFlag LAVA_FIRE = new StateFlag("lava-fire", true);
public static final StateFlag LIGHTNING = new StateFlag("lightning", true);
@@ -146,7 +147,7 @@
public static final Flag<?>[] flagsList = new Flag<?>[] {
PASSTHROUGH, BUILD, BLOCK_BREAK, BLOCK_PLACE, PVP, CHEST_ACCESS, PISTONS,
TNT, LIGHTER, RIDE, USE, INTERACT, PLACE_VEHICLE, DESTROY_VEHICLE, DAMAGE_ANIMALS, SLEEP,
MOB_DAMAGE, MOB_SPAWNING, DENY_SPAWN, INVINCIBILITY, EXP_DROPS, FIREWORK_DAMAGE,
MOB_DAMAGE, MOB_SPAWNING, DENY_SPAWN, INVINCIBILITY, EXP_DROPS, FIREWORK_DAMAGE, WITHER_DAMAGE,
CREEPER_EXPLOSION, OTHER_EXPLOSION, ENDERDRAGON_BLOCK_DAMAGE, GHAST_FIREBALL, ENDER_BUILD,
DENY_MESSAGE, ENTRY_DENY_MESSAGE, EXIT_DENY_MESSAGE, EXIT_OVERRIDE, EXIT_VIA_TELEPORT,
GREET_MESSAGE, FAREWELL_MESSAGE, NOTIFY_ENTER, NOTIFY_LEAVE,

0 comments on commit e019890

Please sign in to comment.