some small fixes for the web SDK

This commit is contained in:
kremsy 2017-05-24 21:02:47 +02:00
parent cb095b15c6
commit a9b01f139f
3 changed files with 12 additions and 9 deletions

View File

@ -72,11 +72,12 @@ class Chat implements CallbackListener, CommunicationListener, UsageInformationA
* @param string $message
* @param string $login
* @param string|bool $prefix
* @param bool $multiCall
* @return bool
*/
public function sendInformation($message, $login = null, $prefix = true) {
public function sendInformation($message, $login = null, $prefix = true, $multiCall = true) {
$format = $this->maniaControl->getSettingManager()->getSettingValue($this, self::SETTING_FORMAT_INFORMATION);
return $this->sendChat($format . $message, $login, $prefix);
return $this->sendChat($format . $message, $login, $prefix, $multiCall);
}
/**
@ -85,9 +86,10 @@ class Chat implements CallbackListener, CommunicationListener, UsageInformationA
* @param string $message
* @param string $login
* @param string|bool $prefix
* @param bool $multiCall
* @return bool
*/
public function sendChat($message, $login = null, $prefix = true) {
public function sendChat($message, $login = null, $prefix = true, $multiCall = true) {
if (!$this->maniaControl->getClient()) {
return false;
}
@ -100,13 +102,13 @@ class Chat implements CallbackListener, CommunicationListener, UsageInformationA
$login = Player::parseLogin($login);
}
try {
return $this->maniaControl->getClient()->chatSendServerMessage($chatMessage, $login, true);
return $this->maniaControl->getClient()->chatSendServerMessage($chatMessage, $login, $multiCall);
} catch (UnknownPlayerException $e) {
return false;
}
}
return $this->maniaControl->getClient()->chatSendServerMessage($chatMessage, null, true);
return $this->maniaControl->getClient()->chatSendServerMessage($chatMessage, null, $multiCall);
}
/**
@ -252,7 +254,7 @@ class Chat implements CallbackListener, CommunicationListener, UsageInformationA
* Handles SendChat Communication Request
*
* @param $data
* @return array
* @return CommunicationAnswer
*/
public function communcationSendChat($data) {
if (!is_object($data) || !property_exists($data, "message")) {

View File

@ -221,8 +221,9 @@ class ManiaControl implements CallbackListener, CommandListener, TimerListener,
$this->getTimerManager()->registerOneTimeListening($this, function () use ($data) {
if (is_object($data) && property_exists($data, "message")) {
$this->restart($data->message);
} else {
$this->restart();
}
$this->restart();
}, 3000);
return new CommunicationAnswer();
});
@ -514,7 +515,7 @@ class ManiaControl implements CallbackListener, CommandListener, TimerListener,
// Announce restart
try {
$this->getChat()->sendInformation('Restarting ManiaControl...');
$this->getChat()->sendInformation('Restarting ManiaControl...', null, true, false);
} catch (TransportException $e) {
}
Logger::log('Restarting ManiaControl... ' . $message);

View File

@ -110,7 +110,7 @@ class DedimaniaWebHandler implements TimerListener {
if (!$serverInfo || !$playerInfo || !$mapInfo || !$gameMode) {
$data = array($this->dedimaniaData->sessionId, $mapInfo, $gameMode, $serverInfo, $playerInfo);
if(!$serverInfo){ // No Players
if($serverInfo){ // No Players
Logger::logError("Dedimania Records could not be fetched, debuginfo:" . json_encode($data));
}
return false;