Hi, I'm trying to make a quest plugins that required Player to kill some monster. My question is. How to check if the player already killed a spesific monster, example : enderman Thank You i'm sorry, i'm a newbie at php
Probably because this has been asked before. I'll list the answers I found in order of my preference: Muqsit's example Primus' example BECraft's example
Once you have the instance of EntityDamageByEntityEvent, $event->getDamager(). You'll have to check if it is a player though.
instanceof, yes. You don't have to check the name to confirm that it is a player, but if you want to see if it is a certain player, you would.
Listen for EntityDeathEvent, then use Entity->getLastDamageCause. From there, you can check if it's an EntityDamageByEntityEvent, etc.
Tried This, but not working. i kill player with lava its working when i use BlockBreakEvent PHP: public function onKill(EntityDeathEvent $event){ var_dump("Test");}
Any errors? Can I see what you used for BlockBreakEvent? Did you try them both in the exact same environments?
yep i tried them on the same enviroment. i used lava for entitydeathevent nothing shows on console. when i use blockbreakevent, its shows Test on console
im sorry to speak using local language (Bahasa Indonesia) i hope he will understand later. Jadi maksudnya gmna mas, saya bantu sini