From 7e0c0cab3d5dc5902045ebe47c8e15a6a51b88d4 Mon Sep 17 00:00:00 2001 From: Auxilor Date: Fri, 10 Nov 2023 13:54:45 +0000 Subject: [PATCH] take_damage no longer fires with void, kill, or suicide --- .../libreforge/triggers/impl/TriggerTakeDamage.kt | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/core/src/main/kotlin/com/willfp/libreforge/triggers/impl/TriggerTakeDamage.kt b/core/src/main/kotlin/com/willfp/libreforge/triggers/impl/TriggerTakeDamage.kt index fbb425be4..f3b6ffa86 100644 --- a/core/src/main/kotlin/com/willfp/libreforge/triggers/impl/TriggerTakeDamage.kt +++ b/core/src/main/kotlin/com/willfp/libreforge/triggers/impl/TriggerTakeDamage.kt @@ -13,6 +13,12 @@ object TriggerTakeDamage : Trigger("take_damage") { TriggerParameter.EVENT ) + private val ignoredCauses = setOf( + EntityDamageEvent.DamageCause.KILL, + EntityDamageEvent.DamageCause.VOID, + EntityDamageEvent.DamageCause.SUICIDE + ) + @EventHandler(ignoreCancelled = true) fun handle(event: EntityDamageEvent) { val victim = event.entity @@ -21,6 +27,10 @@ object TriggerTakeDamage : Trigger("take_damage") { return } + if (event.cause in ignoredCauses) { + return + } + this.dispatch( victim, TriggerData(