Oops my bad.. Item::get(397,3,1); But you should really look at the error and pocketmine API.. it explains all..
PHP: use pocketmine\Server;use pocketmine\Player;use pocketmine\event\player\PlayerDeathEvent;use pocketmine\event\entity\EntityDamageEvent;use pocketmine\event\entity\EntityDamageByEntityEvent;use pocketmine\inventory\Inventory;use pocketmine\event\Listener;use pocketmine\plugin\PluginBase;use pocketmine\item\Item;use pocketmine\entity\Entity;class Main extends PluginBase implements Listener{ public function onEnable(){ $this->getServer()->getPluginManager()->registerEvents($this,$this); } public function onDeath(PlayerDeathEvent $ev){ $player = $ev->getPlayer(); $cause = $player->getLastDamageCause(); if($cause instanceof EntityDamageByEntityEvent){ $damager = $cause->getDamager(); if($damager instanceof Player){ $inv = $damager->getInventory(); $head = Item::get(937,3,1); $name = $player->getName(); $head->setCustomName("$name's Head"); $inv->addItem($head); $damager->getInventory()->sendContents($damager->getInventory()); $damager->sendMessage("you got $name's Head"); }}}
CRITICAL> "Could not pass event 'pocketmine\event\player\PlayerDeathEvent' to 'PlayerHead v1': Call to a member function getWindowId() on integer on PlayerHead\Main CRITICAL> Error: "Call to a member function getWindowId() on integer" (EXCEPTION) in "/src/pocketmine/inventory/PlayerInventory" at line 521
Code looks a little messy try to fix the line spacing and lineup, also the problem is your passing the inventory instead of the player, PHP: $damager->getInventory()->sendContents($damager);
I fixed the plug in no more errors and I'm able to get Steve head thanks guys The plugin is public in my github