Fixed double add queue bug

This commit is contained in:
Max Klaversma 2014-01-25 22:32:05 +01:00 committed by Steffen Schröder
parent 616c72c9f9
commit a1d0bd21b0

View File

@ -274,8 +274,16 @@ class QueuePlugin implements CallbackListener, CommandListener, ManialinkPageAns
* Function adds a player to the queue. * Function adds a player to the queue.
* *
* @param Player $player * @param Player $player
* @return bool
*/ */
private function addPlayerToQueue(Player $player) { private function addPlayerToQueue(Player $player) {
foreach($this->queue as $queuedPlayer) {
if($queuedPlayer->login == $player->login) {
$this->maniaControl->chat->sendError('You\'re already in the queue!', $player->login);
return false;
}
}
if($this->maniaControl->settingManager->getSetting($this, self::QUEUE_MAX) > count($this->queue)) { if($this->maniaControl->settingManager->getSetting($this, self::QUEUE_MAX) > count($this->queue)) {
$this->queue[count($this->queue)] = $player; $this->queue[count($this->queue)] = $player;
$this->maniaControl->chat->sendChat('$z$s$090[Queue] $<$fff' . $player->nickname . '$> just joined the queue!'); $this->maniaControl->chat->sendChat('$z$s$090[Queue] $<$fff' . $player->nickname . '$> just joined the queue!');