Skip to content

Commit

Permalink
take_damage no longer fires with void, kill, or suicide
Browse files Browse the repository at this point in the history
  • Loading branch information
WillFP committed Nov 10, 2023
1 parent 93788f1 commit 7e0c0ca
Showing 1 changed file with 10 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -21,6 +27,10 @@ object TriggerTakeDamage : Trigger("take_damage") {
return
}

if (event.cause in ignoredCauses) {
return
}

this.dispatch(
victim,
TriggerData(
Expand Down

0 comments on commit 7e0c0ca

Please sign in to comment.