how can I set an item's durability\damage to like a brand new one? my try : PHP: public function execute(CommandSender $sender, string $commandLable, array $args): bool { if (!$sender instanceof Player) { $sender->sendMessage($this->plugin->p); return true; } if ($sender->hasPermission("fix")) { $item = $sender->getInventory()->getItemInHand(); $item->setDamage(1000); }else{ $sender->sendMessage($this->plugin->noperm); } return true; }
PHP: public function execute(CommandSender $sender, string $commandLabel, array $args): bool{ if (!$sender instanceof Player) { $sender->sendMessage($this->plugin->p); return true; } if ($sender->hasPermission("fix")) { $item = $sender->getInventory()->getItemInHand(); if($item instanceof Tool) $item->setDamage($item->getMaxDurability()); // if not then it's 0 }else{ $sender->sendMessage($this->plugin->noperm); } return true;}