deepEquals() final public method

final public deepEquals ( Item $item, boolean $checkDamage = true, boolean $checkCompound = true, boolean $checkCount = false ) : boolean
$item Item
$checkDamage boolean
$checkCompound boolean
$checkCount boolean
return boolean
Example #1
0
 public function onRename(Player $player, Item $resultItem) : bool
 {
     if (!$resultItem->deepEquals($this->getItem(self::TARGET), true, false, true)) {
         //Item does not match target item. Everything must match except the tags.
         return false;
     }
     if ($player->getExpLevel() < $resultItem->getRepairCost()) {
         //Not enough exp
         return false;
     }
     $player->setExpLevel($player->getExpLevel() - $resultItem->getRepairCost());
     $this->clearAll();
     if (!$player->getServer()->allowInventoryCheats and !$player->isCreative()) {
         if (!$player->getFloatingInventory()->canAddItem($resultItem)) {
             return false;
         }
         $player->getFloatingInventory()->addItem($resultItem);
     }
     return true;
 }