PHP: public function onItemUse(PlayerItemConsumeEvent $event){ //$item = $event->getItem(); If you want to use that //$player = $event->getPlayer(); same $event->setCancelled(); }
nope PlayerItemConsumeEvent //ITEMSSSSSSSSS https://github.com/pmmp/PocketMine-...tmine/event/player/PlayerItemConsumeEvent.php PlayerExhaustEvent //PlayerLoose Foooood https://github.com/pmmp/PocketMine-MP/blob/master/src/pocketmine/event/player/PlayerExhaustEvent.php
You can set the item's damage to 0 at events like BlockBreakEvent or EntityDamageEvent. Old forums: http://forums.pocketmine.net/threads/no-breaking.18048/
PHP: $item->setUnbreakable(); It only works with items that have a durability though. Reference: https://github.com/pmmp/PocketMine-MP/blob/master/src/pocketmine/item/Durable.php#L45
i get an error : Could not pass event 'pocketmine\event\entity\EntityDamageByEntityEvent' to 'PitchOut v1.0.0': Call to undefined method pocketmine\item\WoodenShovel::setUnbreakable()
And are you sure you're calling it on an item instanceof Durable? You'll have to add a check for that.
I linked him the Durable class, and the line it was on, in hopes he would add: PHP: if($item instanceof Durable) { //bla bla}
$player->getInventory()->setItem(0, Item::get(Item::WOODEN_SHOVEL)->setUnbreakable()) is not work, normal ?