Hi, How can i check if player death cause is void?? Now, i'm using this and it's not working PHP: if($e->getEntity()->getLastDamageCause() == 11){ //CODE} Of course, it give me this error: Code: 12.11 18:34:37 [Server] Server thread/NOTICE ClassCastException: "Object of class pocketmine\event\entity\EntityDamageEvent could not be converted to int" (E_NOTICE) in "/MinedoxCore-Smash_v1.0.0.phar/src/MDCore/MDCore" at line 303 12.11 18:34:37 [Server] Server thread/CRITICAL "Could not pass event 'pocketmine\event\player\PlayerDeathEvent' to 'MinedoxCore-Smash v1.0.0': Object of class pocketmine\event\entity\EntityDamageEvent could not be converted to int on MDCore\MDCore i cant use that "11" or "EntityDamageEvent::CAUSE_VOID" at there... So, anyway to check it? Pls help
Entity->getLastDamageCause() returns EntityDamageEvent or null, not an integer. Please look at the source code next time before creating a thread: https://github.com/PocketMine/Pocke...3589b64/src/pocketmine/entity/Entity.php#L647 So it should be $e->getEntity()->getLastDamageCause()->getCause(), which will return an integer. Leave a like if this helped!
PHP: public function onPlayerDeath(PlayerDeathEvent $event){$player = $event->getPlayer(); $cid = $player->getLastDamageCause()->getCause(); switch($cid){ case EntityDamageEvent::CAUSE_VOID: /*code*/ break;/*keep going on*/ Lol, just did something like this for someone else