small dedimania improvements

This commit is contained in:
kremsy 2017-05-09 14:02:00 +02:00
parent fc02be2352
commit 86e0eeda67

View File

@ -581,7 +581,6 @@ class DedimaniaPlugin implements CallbackListener, CommandListener, TimerListene
$content = $this->encode_request(self::DEDIMANIA_CHECK_SESSION, array($this->dedimaniaData->sessionId)); $content = $this->encode_request(self::DEDIMANIA_CHECK_SESSION, array($this->dedimaniaData->sessionId));
//$this->maniaControl->fileReader->postDataTest($this->request, self::DEDIMANIA_URL, function ($data, $error) {
$asyncHttpRequest = new AsyncHttpRequest($this->maniaControl, self::DEDIMANIA_URL); $asyncHttpRequest = new AsyncHttpRequest($this->maniaControl, self::DEDIMANIA_URL);
$asyncHttpRequest->setCallable(function ($data, $error) { $asyncHttpRequest->setCallable(function ($data, $error) {
if ($error) { if ($error) {
@ -638,7 +637,7 @@ class DedimaniaPlugin implements CallbackListener, CommandListener, TimerListene
$asyncHttpRequest = new AsyncHttpRequest($this->maniaControl, self::DEDIMANIA_URL); $asyncHttpRequest = new AsyncHttpRequest($this->maniaControl, self::DEDIMANIA_URL);
$asyncHttpRequest->setCallable(function ($data, $error) use (&$player) { $asyncHttpRequest->setCallable(function ($data, $error) use (&$player) {
if ($error) { if ($error) {
Logger::logError("Dedimania Error while player connect: " . $error); $this->openDedimaniaSession();
} }
$data = $this->decode($data); $data = $this->decode($data);
@ -690,7 +689,7 @@ class DedimaniaPlugin implements CallbackListener, CommandListener, TimerListene
$asyncHttpRequest = new AsyncHttpRequest($this->maniaControl, self::DEDIMANIA_URL); $asyncHttpRequest = new AsyncHttpRequest($this->maniaControl, self::DEDIMANIA_URL);
$asyncHttpRequest->setCallable(function ($data, $error) { $asyncHttpRequest->setCallable(function ($data, $error) {
if ($error) { if ($error) {
Logger::logError("Dedimania Error while player disconnect: " . $error); $this->openDedimaniaSession();
} }
$data = $this->decode($data); $data = $this->decode($data);
@ -732,6 +731,9 @@ class DedimaniaPlugin implements CallbackListener, CommandListener, TimerListene
return; return;
} }
//Make Sure Dedimania Session is okay
$this->checkDedimaniaSession();
// Send dedimania records // Send dedimania records
$gameMode = $this->getGameModeString(); $gameMode = $this->getGameModeString();
$times = array(); $times = array();