pocketmine\block\Anvil::onActivate PHP Method

onActivate() public method

public onActivate ( Item $item, Player $player = null )
$item pocketmine\item\Item
$player pocketmine\Player
    public function onActivate(Item $item, Player $player = null)
    {
        if (!$this->getLevel()->getServer()->anvilEnabled) {
            return true;
        }
        if ($player instanceof Player) {
            if ($player->isCreative() and $player->getServer()->limitedCreative) {
                return true;
            }
            $player->addWindow(new AnvilInventory($this));
            $player->craftingType = Player::CRAFTING_ANVIL;
        }
        return true;
    }