Hi, I Want To Check If The Player Has An Items That Required By The Plugin Example : The Plugin Need 2 Feathers , Then The Plugin Check The Player's Inventory, If True Then The Plugins Will Take 2 Feathers From The Player's Inventory One More, Is It Possible To Check An Items With Name From The Player's Inventory? Example : I Want To Check If The Players Have 2 Feathers Named "BirdFeather" , Then The PLugin Take The 2 Feathers Named "BirdFeather" Im Sorry For My Bad English
PHP: $player = $event->getPlayer(); // Use this if you're using an event$inventory = $player->getInventory();if($inventory->contains(Item::get(288, 0, 2))) { $inventory->removeItem(Item::get(288, 0, 2));}
but, How To Check If The Item Had A Custom Name ? Coz, I Only Want To Take An Item WIth A Custom Name
Anvils are not added to PocketMine yet (they are, but you cannot use them). I don't know any way to do that. I tried adding a new item called "Bird Feather" also as a feather item, but it won't work.
PHP: $player = $event->getPlayer(); // Use this if you're using an event$inventory = $player->getInventory();$item = Item::get(288, 0, 2);if($inventory->contains($item) and $item->getName() === "BirdFeather") { $inventory->removeItem(Item::get(288, 0, 2));} and to set custom item name use PHP: /* @var $item = Item */$item->setCustomName("BirdFeather");