Fixed compatibility for queue with PHP5.3

This commit is contained in:
Max Klaversma 2014-02-13 19:03:06 +01:00 committed by Steffen Schröder
parent 56ca076bec
commit e51670a2ac

View File

@ -232,7 +232,8 @@ class QueuePlugin implements CallbackListener, CommandListener, ManialinkPageAns
* Function called on every second.
*/
public function handleEverySecond() {
if($this->maniaControl->client->getMaxPlayers()['CurrentValue'] > (count($this->maniaControl->playerManager->players) - count($this->spectators))) {
$maxPlayers = $this->maniaControl->client->getMaxPlayers();
if($maxPlayers['CurrentValue'] > (count($this->maniaControl->playerManager->players) - count($this->spectators))) {
$this->moveFirstPlayerToPlay();
}
@ -287,7 +288,8 @@ class QueuePlugin implements CallbackListener, CommandListener, ManialinkPageAns
* @param Player $player
*/
private function forcePlayerToPlay(Player $player) {
if($this->maniaControl->client->getMaxPlayers()['CurrentValue'] > (count($this->maniaControl->playerManager->players) - count($this->spectators))) {
$maxPlayers = $this->maniaControl->client->getMaxPlayers();
if($maxPlayers['CurrentValue'] > (count($this->maniaControl->playerManager->players) - count($this->spectators))) {
try {
$this->maniaControl->client->forceSpectator($player->login, 2);
} catch(Exception $e) {