I'm trying to make it so if player wear diamond chestplate and died it will send "L" as a message to the killer but nothing happened public function onDeath(PlayerDeathEvent $event){ if($event->getEntity()->getLastDamageCause() instanceof EntityDamageByEntityEvent){ $killer = $event->getEntity()->getLastDamageCause()->getDamager(); $dead = $event->getEntity(); if($killer instanceof Player && $dead instanceof Player){ if($dead->getArmorInventory()->getChestplate()); $killer->sendMessage(TF::BOLD . TF:ARK_AQUA . "+L"); } } } i think i'm missing something?
PHP: if($dead->getArmorInventory()->getChestplate()->getId() == Item::DIAMOND_CHESTPLATE) { $killer->sendMessage(TF::BOLD . TF::DARK_AQUA . "+L");}
First, did you register events? Then did you use \pocketmine\event\entity\EntityDamageByEntityEvent and \pocketmine\Player?
PHP: public function onDeath(PlayerDeathEvent $event) { $player = $event->getPlayer(); $lastDamageCause = $player->getLastDamageCause(); if($lastDamageCause instanceof EntityDamageByEntityEvent) { $killer = $lastDamageCause->getDamager(); if($killer instanceof Player) { if($player->getArmorInventory()->getChestplate()->getId() == Item::DIAMOND_CHESTPLATE) { $killer->sendMessage("+L"); } } }}