Prevent spectators from taking damage at all times.
Spectating is possible both during and before/after arena sessions. This means that an early return from the entity damage cancellation logic when the arena isn't running is going to allow damage to go through to spectators of non-running arenas, which means they can die. By simply removing the early return (and placing it in the one branch that actually requires it explicitly), spectators should no longer be able to take damage. This fixes #502.
This commit is contained in:
@@ -690,9 +690,6 @@ public class ArenaListener
|
||||
|
||||
public void onEntityDamage(EntityDamageEvent event) {
|
||||
Entity damagee = event.getEntity();
|
||||
if (!arena.isRunning() && !arena.getRegion().contains(damagee.getLocation())) {
|
||||
return;
|
||||
}
|
||||
|
||||
EntityDamageByEntityEvent edbe = (event instanceof EntityDamageByEntityEvent) ? (EntityDamageByEntityEvent) event : null;
|
||||
Entity damager = null;
|
||||
@@ -736,7 +733,9 @@ public class ArenaListener
|
||||
}
|
||||
// Snowmen melting
|
||||
else if (damagee instanceof Snowman && event.getCause() == DamageCause.MELTING) {
|
||||
event.setCancelled(true);
|
||||
if (arena.isRunning() && arena.getRegion().contains(damagee.getLocation())) {
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
// Boss monster
|
||||
else if (boss != null) {
|
||||
|
||||
Reference in New Issue
Block a user