hey , how can i remove an item with a custom name? heres my code i was using but it deletes the entire stack of items , i only want one to get removed from the entire stack. PHP: foreach($player->getInventory()->getContents() as $item) { if($item->getId() === 340 and $item->getCustomName() === "CrateKey") { $item->setCount(1); $player->getInventory()->removeItem($item);
PHP: if($item->getId() === 340 and $item->getCustomName() === "CrateKey") $item->setCount($item->getCount() - 1);
thx , just to save time , how can i create an array like $names = [1 => "name", 2 => "name"]; then make it were the number is the id(1 for example) and the following is the item names.