Cancel damage to players by pets.

This is technically not necessary when pets are simple entities like
wolves and zombies, because these types of pets will never target and
thus attack other players in the arena. However, projectile entities
such as Blazes and Ghasts may hit players in the line of fire, and so
any such damage should be cancelled.

Fixes #712
This commit is contained in:
Andreas Troelsen
2022-02-12 17:55:58 +01:00
parent d5ea15fa08
commit 77b2525707
2 changed files with 7 additions and 0 deletions
+1
View File
@@ -36,6 +36,7 @@ These changes will (most likely) be included in the next version.
- Block explosion events cancelled by other plugins now remain cancelled unless MobArena specifically uncancels them for an arena.
- Flaming arrows now ignite TNT blocks in the arena.
- Players no longer take fall damage when they leave (or get removed from) an arena while falling.
- Players no longer take damage from projectiles shot by pets of other players.
## [0.106] - 2021-05-09
### Added
@@ -731,6 +731,12 @@ public class ArenaListener
}
if (arena.inArena(player)) {
// Cancel damage from pets (and their projectiles)
if (monsters.hasPet(damager)) {
event.setCancelled(true);
return;
}
// Cancel PvP damage if disabled
if (!pvpEnabled && damager instanceof Player && !damager.equals(player)) {
event.setCancelled(true);