|
@@ 135-138 (lines=4) @@
|
| 132 |
|
$playerCount = count($this->playerStorage->getOnline()); |
| 133 |
|
|
| 134 |
|
// Check if vote passes when we suppose that all palyers that didn't vote would vote NO. |
| 135 |
|
if ($playerCount > 0 && ($this->currentVote->getYes() / $playerCount) > $this->ratio) { |
| 136 |
|
$this->votePassed(); |
| 137 |
|
return; |
| 138 |
|
} |
| 139 |
|
|
| 140 |
|
// If the vote is still not decided wait for the end to decide. |
| 141 |
|
if (($time - $this->currentVote->getStartTime()) > $this->duration) { |
|
@@ 144-148 (lines=5) @@
|
| 141 |
|
if (($time - $this->currentVote->getStartTime()) > $this->duration) { |
| 142 |
|
$totalVotes = $this->currentVote->getYes() + $this->currentVote->getNo() * 1.0; |
| 143 |
|
|
| 144 |
|
if ($totalVotes >= 1 && ($this->currentVote->getYes() / $totalVotes) > $this->ratio) { |
| 145 |
|
$this->votePassed(); |
| 146 |
|
} else { |
| 147 |
|
$this->voteFailed(); |
| 148 |
|
} |
| 149 |
|
} |
| 150 |
|
} |
| 151 |
|
|