What I want to do is repair a little bit of the pickaxe I'm holding after mining a diamond block PHP: if($block->getId() == 57) { $hand->setDamage($hand->getDamage() + 1000); $player->getInventory()->setItemInHand($hand); It doesn't work, and there is no error. Someone told me to use PHP: $item->getMaxDurability() but i dont want to repair it to max durability Thanks!
To repair the pickaxe you need to make the damage number smaller, not larger (make sure you don't make it smaller than zero tho). btw You should usually use === and !== for future projects instead of == and !=, see here why: https://stackoverflow.com/a/40392064/11825425
The server will set the item back regardless whether the item changed duing the event, you would have to delay the set item eg using ClosureTask