mirror of
https://github.com/garbagemule/MobArena.git
synced 2024-11-26 12:36:00 +01:00
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:
parent
399b228999
commit
624b87f4d3
@ -13,6 +13,7 @@ These changes will (most likely) be included in the next version.
|
|||||||
## [Unreleased]
|
## [Unreleased]
|
||||||
- Like the other user commands, the permission for `/ma ready` now defaults to true.
|
- Like the other user commands, the permission for `/ma ready` now defaults to true.
|
||||||
- Unbreakable weapons and armor now use the unbreakable item flag instead of item durability and on-hit repairs. This means that MobArena's unbreakable items are now compatible with plugins that depend on special durability values, such as QualityArmory.
|
- Unbreakable weapons and armor now use the unbreakable item flag instead of item durability and on-hit repairs. This means that MobArena's unbreakable items are now compatible with plugins that depend on special durability values, such as QualityArmory.
|
||||||
|
- Spectators can no longer take damage when the arena isn't running.
|
||||||
|
|
||||||
## [0.103] - 2018-08-28
|
## [0.103] - 2018-08-28
|
||||||
- It is now possible to add a fixed delay (in seconds) between waves with the new per-arena setting `next-wave-delay`.
|
- It is now possible to add a fixed delay (in seconds) between waves with the new per-arena setting `next-wave-delay`.
|
||||||
|
@ -690,9 +690,6 @@ public class ArenaListener
|
|||||||
|
|
||||||
public void onEntityDamage(EntityDamageEvent event) {
|
public void onEntityDamage(EntityDamageEvent event) {
|
||||||
Entity damagee = event.getEntity();
|
Entity damagee = event.getEntity();
|
||||||
if (!arena.isRunning() && !arena.getRegion().contains(damagee.getLocation())) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
EntityDamageByEntityEvent edbe = (event instanceof EntityDamageByEntityEvent) ? (EntityDamageByEntityEvent) event : null;
|
EntityDamageByEntityEvent edbe = (event instanceof EntityDamageByEntityEvent) ? (EntityDamageByEntityEvent) event : null;
|
||||||
Entity damager = null;
|
Entity damager = null;
|
||||||
@ -736,8 +733,10 @@ public class ArenaListener
|
|||||||
}
|
}
|
||||||
// Snowmen melting
|
// Snowmen melting
|
||||||
else if (damagee instanceof Snowman && event.getCause() == DamageCause.MELTING) {
|
else if (damagee instanceof Snowman && event.getCause() == DamageCause.MELTING) {
|
||||||
|
if (arena.isRunning() && arena.getRegion().contains(damagee.getLocation())) {
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
// Boss monster
|
// Boss monster
|
||||||
else if (boss != null) {
|
else if (boss != null) {
|
||||||
onBossDamage(event, boss, damager);
|
onBossDamage(event, boss, damager);
|
||||||
|
Loading…
Reference in New Issue
Block a user