mirror of
https://github.com/EngineHub/WorldGuard.git
synced 2024-11-26 20:45:43 +01:00
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:
parent
9222b3d364
commit
a7c2026414
@ -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)) {
|
||||
|
Loading…
Reference in New Issue
Block a user