PHP: use pocketmine\event\entity\EntityDamageEvent;public function onDamage(EntityDamageEvent $e){if($e->getCause() === 3){//suffocation//do something}}
Code: const MODIFIER_BASE = 0 const MODIFIER_ARMOR = 1 const CAUSE_CONTACT = 0 const CAUSE_ENTITY_ATTACK = 1 const CAUSE_PROJECTILE = 2 const CAUSE_SUFFOCATION = 3 const CAUSE_FALL = 4 const CAUSE_FIRE = 5 const CAUSE_FIRE_TICK = 6 const CAUSE_LAVA = 7 const CAUSE_DROWNING = 8 const CAUSE_BLOCK_EXPLOSION = 9 const CAUSE_ENTITY_EXPLOSION = 10 const CAUSE_VOID = 11 const CAUSE_SUICIDE = 12 const CAUSE_MAGIC = 13 const CAUSE_CUSTOM = 14 You can use if($e->getCause() == EntityDamageEvent::CAUSE_SUFFOCATION or just 3 Documentation from: http://docs.pocketmine.net/d5/de3/classpocketmine_1_1event_1_1entity_1_1_entity_damage_event.html