Fireballs are now treated as projectiles.

Apparently this has existed for a few years now. Don't even ask.
Fixes WORLDGUARD-3611, WORLDGUARD-3476.
Potentially fixes lots of other issues with fireballs as well.
Other settings and so on seemed to have covered a lot though.
This commit is contained in:
wizjany 2016-01-05 01:09:07 -05:00
parent 9222b3d364
commit a7c2026414

View File

@ -197,29 +197,6 @@ private void onEntityDamageByEntity(EntityDamageByEntityEvent event) {
}
}
if (attacker instanceof Fireball) {
if (attacker instanceof WitherSkull) {
if (wcfg.blockWitherSkullExplosions) {
event.setCancelled(true);
return;
}
} else {
if (wcfg.blockFireballExplosions) {
event.setCancelled(true);
return;
}
}
if (wcfg.useRegions) {
Fireball fireball = (Fireball) attacker;
RegionQuery query = plugin.getRegionContainer().createQuery();
if (!query.testState(defender.getLocation(), (Player) defender, DefaultFlag.GHAST_FIREBALL) && wcfg.explosionFlagCancellation) {
event.setCancelled(true);
return;
}
}
}
if (attacker instanceof LivingEntity && !(attacker instanceof Player)) {
if (attacker instanceof Creeper && wcfg.blockCreeperExplosions) {
event.setCancelled(true);
@ -281,6 +258,28 @@ private void onEntityDamageByProjectile(EntityDamageByEntityEvent event) {
return;
}
}
if (event.getDamager() instanceof Fireball) {
Fireball fireball = (Fireball) event.getDamager();
if (fireball instanceof WitherSkull) {
if (wcfg.blockWitherSkullExplosions) {
event.setCancelled(true);
return;
}
} else {
if (wcfg.blockFireballExplosions) {
event.setCancelled(true);
return;
}
}
if (wcfg.useRegions) {
RegionQuery query = plugin.getRegionContainer().createQuery();
if (!query.testState(defender.getLocation(), (Player) defender, DefaultFlag.GHAST_FIREBALL) && wcfg.explosionFlagCancellation) {
event.setCancelled(true);
return;
}
}
}
}
} else if (defender instanceof ItemFrame) {
if (checkItemFrameProtection(attacker, (ItemFrame) defender)) {