Cancel Entity Death on /kill

Hey there!

I have a question. I need to cancel the death of some entities after e.g. /kill @e is called. Which event is fired before the entity will die? DestructEntityEvent and HarvestEntityEvent are not fired.

Thanks for your help.

If im not mistaken command /kill damages an entity by 1000 health points. Better approach would be cancelling the entity damage

Hmm… The entity is an ArmorStand nur neither the EntityDamageEvent nor the BlockInteractEvent ist called when i hit an ArmorStand.

There wouldn’t be a BlockInteractEvent, since an armor stand isn’t a block. There also wouldn’t be a HarvestEntityEvent since there’s no experience.

Yes, you’re right but the DamageEntityEvent isn’t working, too :frowning:

I opened an Github Issue.

1 Like

I’m not sure that HarvestEntityEvent wouldn’t be thrown, but regardless, it wouldn’t let you cancel the damage, it would be used for adding drops or experience to an armorstand when it dies.

/kill @e[type=!ArmorStand]