Fix spectators being affected by a combat ability (#3591)

* Fix spectators being affected by a combat ability
This commit is contained in:
ProfLuz 2018-10-01 22:21:22 -04:00 committed by t00thpick1
parent 592c3a2142
commit 2a43bce849

View File

@ -4,6 +4,7 @@ import java.util.EnumMap;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
import org.bukkit.GameMode;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.entity.AnimalTamer; import org.bukkit.entity.AnimalTamer;
import org.bukkit.entity.Animals; import org.bukkit.entity.Animals;
@ -544,6 +545,11 @@ public final class CombatUtils {
if (!player.canSee(defender)) { if (!player.canSee(defender)) {
return false; return false;
} }
// Spectators should not be affected
if (defender.getGameMode() == GameMode.SPECTATOR) {
return false;
}
// It may seem a bit redundant but we need a check here to prevent bleed from being applied in applyAbilityAoE() // It may seem a bit redundant but we need a check here to prevent bleed from being applied in applyAbilityAoE()
if (callFakeDamageEvent(player, entity, 1.0) == 0) { if (callFakeDamageEvent(player, entity, 1.0) == 0) {