From a1d0bd21b06893fcb9200655bd69538ff777155f Mon Sep 17 00:00:00 2001 From: Max Klaversma Date: Sat, 25 Jan 2014 22:32:05 +0100 Subject: [PATCH] Fixed double add queue bug --- application/plugins/QueuePlugin.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/application/plugins/QueuePlugin.php b/application/plugins/QueuePlugin.php index 0b0ce840..a2a1f89f 100644 --- a/application/plugins/QueuePlugin.php +++ b/application/plugins/QueuePlugin.php @@ -274,8 +274,16 @@ class QueuePlugin implements CallbackListener, CommandListener, ManialinkPageAns * Function adds a player to the queue. * * @param Player $player + * @return bool */ 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)) { $this->queue[count($this->queue)] = $player; $this->maniaControl->chat->sendChat('$z$s$090[Queue] $<$fff' . $player->nickname . '$> just joined the queue!');