From 420682bc33a42ed486d416101003e9df677862fb Mon Sep 17 00:00:00 2001 From: d0by Date: Tue, 20 Dec 2022 00:17:15 +0100 Subject: [PATCH] Damage & Heal displays - blacklist ArmorStand --- .../holograms/plugin/features/DamageDisplayFeature.java | 5 +++-- .../holograms/plugin/features/HealingDisplayFeature.java | 3 ++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/main/java/eu/decentsoftware/holograms/plugin/features/DamageDisplayFeature.java b/src/main/java/eu/decentsoftware/holograms/plugin/features/DamageDisplayFeature.java index fbe9df70..614d75d5 100644 --- a/src/main/java/eu/decentsoftware/holograms/plugin/features/DamageDisplayFeature.java +++ b/src/main/java/eu/decentsoftware/holograms/plugin/features/DamageDisplayFeature.java @@ -9,6 +9,7 @@ import lombok.NonNull; import org.bukkit.Location; import org.bukkit.Material; +import org.bukkit.entity.ArmorStand; import org.bukkit.entity.Entity; import org.bukkit.entity.LivingEntity; import org.bukkit.entity.Player; @@ -95,7 +96,7 @@ public void onDamage(EntityDamageEvent e) { Entity entity = e.getEntity(); - if (!(entity instanceof LivingEntity)) { + if (!(entity instanceof LivingEntity) || entity instanceof ArmorStand) { return; } @@ -137,7 +138,7 @@ private boolean isCritical(@NonNull Player player) { } try { // Slow Falling is not in all versions - if (player.hasPotionEffect(PotionEffectType.SLOW_FALLING)) { + if (player.hasPotionEffect(PotionEffectType.getByName("SLOW_FALLING"))) { return false; } } catch (Exception ignored) { diff --git a/src/main/java/eu/decentsoftware/holograms/plugin/features/HealingDisplayFeature.java b/src/main/java/eu/decentsoftware/holograms/plugin/features/HealingDisplayFeature.java index 5b35e1bc..762d49d8 100644 --- a/src/main/java/eu/decentsoftware/holograms/plugin/features/HealingDisplayFeature.java +++ b/src/main/java/eu/decentsoftware/holograms/plugin/features/HealingDisplayFeature.java @@ -7,6 +7,7 @@ import eu.decentsoftware.holograms.api.utils.config.FileConfig; import eu.decentsoftware.holograms.api.utils.location.LocationUtils; import org.bukkit.Location; +import org.bukkit.entity.ArmorStand; import org.bukkit.entity.Entity; import org.bukkit.entity.LivingEntity; import org.bukkit.entity.Player; @@ -86,7 +87,7 @@ public void onRegain(EntityRegainHealthEvent e) { Entity entity = e.getEntity(); - if (!(entity instanceof LivingEntity)) { + if (!(entity instanceof LivingEntity) || entity instanceof ArmorStand) { return; }