public function getRepairCost() : int { if (!$this->hasCompoundTag()) { return 1; } $tag = $this->getNamedTag(); if (isset($tag->display)) { $tag = $tag->RepairCost; if ($tag instanceof IntTag) { return $tag->getValue(); } } return 1; }
public function onRename(Item $item, Player $player) : bool { if ($player->getExpLevel() > $item->getRepairCost()) { $player->setExpLevel($player->getExpLevel() - $item->getRepairCost()); return true; } return false; }