pocketmine\entity\FishingHook::reelLine PHP Method

reelLine() public method

public reelLine ( )
    public function reelLine()
    {
        $this->damageRod = false;
        if ($this->shootingEntity instanceof Player && $this->coughtTimer > 0) {
            $fishes = [ItemItem::RAW_FISH, ItemItem::RAW_SALMON, ItemItem::CLOWN_FISH, ItemItem::PUFFER_FISH];
            $fish = array_rand($fishes, 1);
            $item = ItemItem::get($fishes[$fish]);
            $this->getLevel()->getServer()->getPluginManager()->callEvent($ev = new PlayerFishEvent($this->shootingEntity, $item, $this));
            if (!$ev->isCancelled()) {
                $this->shootingEntity->getInventory()->addItem($item);
                $this->shootingEntity->addExperience(mt_rand(1, 6));
                $this->damageRod = true;
            }
        }
        if ($this->shootingEntity instanceof Player) {
            $this->shootingEntity->unlinkHookFromPlayer();
        }
        if (!$this->closed) {
            $this->kill();
            $this->close();
        }
        return $this->damageRod;
    }