queue plugin fix

This commit is contained in:
kremsy 2014-02-01 19:32:17 +01:00 committed by Steffen Schröder
parent e792c706c7
commit 737b3f8507

View File

@ -283,8 +283,19 @@ class QueuePlugin implements CallbackListener, CommandListener, ManialinkPageAns
*/
private function forcePlayerToPlay(Player $player) {
if ($this->maniaControl->client->getMaxPlayers()['CurrentValue'] > (count($this->maniaControl->playerManager->players) - count($this->spectators))) {
try {
$this->maniaControl->client->forceSpectator($player->login, 2);
} catch(\Exception $e) {
$this->maniaControl->chat->sendError("Error while leaving the Queue", $player->login);
return;
}
try {
$this->maniaControl->client->forceSpectator($player->login, 0);
} catch(\Exception $e) {
//do nothing
}
if (isset($this->spectators[$player->login])) {
unset($this->spectators[$player->login]);
}
@ -292,6 +303,7 @@ class QueuePlugin implements CallbackListener, CommandListener, ManialinkPageAns
$this->showPlayWidget($player);
$this->maniaControl->chat->sendChat('$z$s$090[Queue] $<$fff' . $player->nickname . '$> has a free spot and is now playing!');
}
}
/**