karma fix
This commit is contained in:
parent
60b13c8bbc
commit
53ddea9d45
@ -578,6 +578,7 @@ class KarmaPlugin implements CallbackListener, TimerListener, Plugin {
|
||||
$query .= '&applicationIdentifier=' . urlencode($applicationIdentifier);
|
||||
$query .= '&testMode=' . $testMode;
|
||||
|
||||
$this->mxKarma['connectionInProgress'] = true;
|
||||
|
||||
$this->maniaControl->fileReader->loadFile($query, function ($data, $error) use ($mxKarmaCode) {
|
||||
if (!$error) {
|
||||
@ -589,11 +590,13 @@ class KarmaPlugin implements CallbackListener, TimerListener, Plugin {
|
||||
$this->maniaControl->log("Error while authenticating on Mania-Exchange Karma");
|
||||
//TODO remove temp trigger
|
||||
$this->maniaControl->errorHandler->triggerDebugNotice("Error while authenticating on Mania-Exchange Karma " . $data->data->message);
|
||||
$this->mxKarma['connectionInProgress'] = false;
|
||||
}
|
||||
} else {
|
||||
$this->maniaControl->log($error);
|
||||
//TODO remove temp trigger
|
||||
$this->maniaControl->errorHandler->triggerDebugNotice("Error while authenticating on Mania-Exchange Karma " . $error);
|
||||
$this->mxKarma['connectionInProgress'] = false;
|
||||
}
|
||||
}, "application/json", 1000);
|
||||
}
|
||||
@ -615,15 +618,18 @@ class KarmaPlugin implements CallbackListener, TimerListener, Plugin {
|
||||
$data = json_decode($data);
|
||||
if ($data->success && $data->data->activated) {
|
||||
$this->maniaControl->log("Successfully authenticated on Mania-Exchange Karma");
|
||||
$this->mxKarma['connectionInProgress'] = false;
|
||||
} else {
|
||||
$this->maniaControl->log("Error while authenticating on Mania-Exchange Karma " . $data->data->message);
|
||||
//TODO remove temp trigger
|
||||
$this->maniaControl->errorHandler->triggerDebugNotice("Error while authenticating on Mania-Exchange Karma " . $data->data->message . " url Query " . $query);
|
||||
$this->mxKarma['connectionInProgress'] = false;
|
||||
}
|
||||
} else {
|
||||
//TODO remove temp trigger
|
||||
$this->maniaControl->errorHandler->triggerDebugNotice("Error while authenticating on Mania-Exchange Karma " . $error);
|
||||
$this->maniaControl->log($error);
|
||||
$this->mxKarma['connectionInProgress'] = false;
|
||||
}
|
||||
}, "application/json", 1000);
|
||||
}
|
||||
@ -642,7 +648,7 @@ class KarmaPlugin implements CallbackListener, TimerListener, Plugin {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!isset($this->mxKarma['session'])) {
|
||||
if (!isset($this->mxKarma['session']) && isset($this->mxKarma['connectionInProgress']) && $this->mxKarma['connectionInProgress'] != true) {
|
||||
$this->mxKarmaOpenSession();
|
||||
return;
|
||||
}
|
||||
@ -693,7 +699,7 @@ class KarmaPlugin implements CallbackListener, TimerListener, Plugin {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!isset($this->mxKarma['session'])) {
|
||||
if (!isset($this->mxKarma['session']) && isset($this->mxKarma['connectionInProgress']) && $this->mxKarma['connectionInProgress'] != true) {
|
||||
$this->mxKarmaOpenSession();
|
||||
return;
|
||||
}
|
||||
@ -715,8 +721,9 @@ class KarmaPlugin implements CallbackListener, TimerListener, Plugin {
|
||||
private function postKarmaVotes(Map $map, array $votes, $import = false) {
|
||||
$gameMode = $this->maniaControl->server->getGameMode(true);
|
||||
|
||||
if(count($votes) == 0)
|
||||
if (count($votes) == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
$properties = array();
|
||||
if ($gameMode == 'Script') {
|
||||
|
Loading…
Reference in New Issue
Block a user