pocketmine\item\Item::getRepairCost PHP Method

getRepairCost() public method

public getRepairCost ( ) : integer
return integer
    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;
    }

Usage Example

コード例 #1
0
 public function onRename(Item $item, Player $player) : bool
 {
     if ($player->getExpLevel() > $item->getRepairCost()) {
         $player->setExpLevel($player->getExpLevel() - $item->getRepairCost());
         return true;
     }
     return false;
 }
All Usage Examples Of pocketmine\item\Item::getRepairCost