From 7144f4264c2495ff4f840ed6c392d4039c6e193a Mon Sep 17 00:00:00 2001 From: kremsy Date: Wed, 26 Feb 2014 13:27:42 +0100 Subject: [PATCH] mxkarma fix --- application/plugins/Karma.php | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/application/plugins/Karma.php b/application/plugins/Karma.php index 143058b6..e2ba7979 100644 --- a/application/plugins/Karma.php +++ b/application/plugins/Karma.php @@ -221,6 +221,17 @@ class KarmaPlugin implements CallbackListener, TimerListener, Plugin { * @param Map $map */ public function handleBeginMap(Map $map) { + //send Map Karma to MX from previous Map + if(isset($this->mxKarma['map'])){ + $votes = array(); + foreach($this->mxKarma['votes'] as $login => $value) { + $player = $this->maniaControl->playerManager->getPlayer($login); + array_push($votes, array("login" => $login, "nickname" => $player->rawNickname, "vote" => $value)); + } + $this->postKarmaVotes($this->mxKarma['map'], $votes); + unset($this->mxKarma['map']); + } + unset($this->mxKarma['votes']); $this->updateManialink = true; } @@ -689,13 +700,7 @@ class KarmaPlugin implements CallbackListener, TimerListener, Plugin { return; } - $votes = array(); - foreach($this->mxKarma['votes'] as $login => $value) { - $player = $this->maniaControl->playerManager->getPlayer($login); - array_push($votes, array("login" => $login, "nickname" => $player->rawNickname, "vote" => $value)); - } - - $this->postKarmaVotes($map, $votes); + $this->mxKarma['map'] = $map; } /**