Fix explosion check order

If the explosion is blocked and the block damage is also blocked, it's necessary to block the explosion (which includes the damage) instead of just the block damage.
This commit is contained in:
steffen 2013-04-02 00:30:05 +02:00 committed by wizjany
parent 2a8131780f
commit cef7d5bb12

View File

@ -568,15 +568,14 @@ public void onEntityExplode(EntityExplodeEvent event) {
}
if (ent instanceof Creeper) {
if (wcfg.blockCreeperBlockDamage) {
event.blockList().clear();
return;
}
if (wcfg.blockCreeperExplosions) {
event.setCancelled(true);
return;
}
if (wcfg.blockCreeperBlockDamage) {
event.blockList().clear();
return;
}
if (wcfg.useRegions) {
RegionManager mgr = plugin.getGlobalRegionManager().get(world);
@ -608,15 +607,14 @@ public void onEntityExplode(EntityExplodeEvent event) {
}
}
} else if (ent instanceof TNTPrimed || (ent != null && ent.getType() == tntMinecartType)) {
if (wcfg.blockTNTBlockDamage) {
event.blockList().clear();
return;
}
if (wcfg.blockTNTExplosions) {
event.setCancelled(true);
return;
}
if (wcfg.blockTNTBlockDamage) {
event.blockList().clear();
return;
}
if (wcfg.useRegions) {
RegionManager mgr = plugin.getGlobalRegionManager().get(world);
@ -631,25 +629,23 @@ public void onEntityExplode(EntityExplodeEvent event) {
}
} else if (ent instanceof Fireball) {
if (ent instanceof WitherSkull) {
if (wcfg.blockWitherSkullBlockDamage) {
event.blockList().clear();
return;
}
if (wcfg.blockWitherSkullExplosions) {
event.setCancelled(true);
return;
}
} else {
if (wcfg.blockFireballBlockDamage) {
if (wcfg.blockWitherSkullBlockDamage) {
event.blockList().clear();
return;
}
} else {
if (wcfg.blockFireballExplosions) {
event.setCancelled(true);
return;
}
if (wcfg.blockFireballBlockDamage) {
event.blockList().clear();
return;
}
}
// allow wither skull blocking since there is no dedicated flag atm
if (wcfg.useRegions) {
@ -664,15 +660,14 @@ public void onEntityExplode(EntityExplodeEvent event) {
}
}
} else if (ent instanceof Wither) {
if (wcfg.blockWitherBlockDamage) {
event.blockList().clear();
return;
}
if (wcfg.blockWitherExplosions) {
event.setCancelled(true);
return;
}
if (wcfg.blockWitherBlockDamage) {
event.blockList().clear();
return;
}
} else {
// unhandled entity
if (wcfg.blockOtherExplosions) {