public function update($time = null)
    {
        if (!$this->currentVote || $this->currentVote->getStatus() == Vote::STATUS_CANCEL) {
            return;
        }

        if (is_null($time)) {
            $time = time();
        }

        $playerCount = count($this->playerStorage->getOnline());

        // Check if vote passes when we suppose that all palyers that didn't vote would vote NO.
        if ($playerCount > 0 && ($this->currentVote->getYes() / $playerCount) > $this->ratio) {
            $this->votePassed();
            return;
        }

        // If the vote is still not decided wait for the end to decide.
        if (($time - $this->currentVote->getStartTime()) > $this->duration) {
            $totalVotes = $this->currentVote->getYes() + $this->currentVote->getNo() * 1.0;

            if ($totalVotes >= 1 && ($this->currentVote->getYes() / $totalVotes) > $this->ratio) {
                $this->votePassed();
            } else {
                $this->voteFailed();
            }
        }
    }