Hi, I have a problem with addEnchantment. If I add the Item to the players inventory without an Enchantment it works... The Code: PHP: $killer->getInventory()->setItem(0, Item::get(271, 0, 1)->addEnchantment(Enchantment::getEnchantment(12)->setLevel(1))); Error: Code: Argument 2 passed to pocketmine\inventory \PlayerInventory::setItem() must be an instance of pock etmine\item\Item, null given I hope someone could help me
addEnchantment does not return the item object. It just modifies the object. PHP: $item = Item::get(271, 0, 1);$item->addEnchantment(Enchantment::getEnchantment(12)->setLevel(1));$killer->getInventory()->setItem(0, $item);