some small fixes for the web SDK
This commit is contained in:
		| @@ -72,11 +72,12 @@ class Chat implements CallbackListener, CommunicationListener, UsageInformationA | |||||||
| 	 * @param string      $message | 	 * @param string      $message | ||||||
| 	 * @param string      $login | 	 * @param string      $login | ||||||
| 	 * @param string|bool $prefix | 	 * @param string|bool $prefix | ||||||
|  | 	 * @param bool        $multiCall | ||||||
| 	 * @return bool | 	 * @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); | 		$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      $message | ||||||
| 	 * @param string      $login | 	 * @param string      $login | ||||||
| 	 * @param string|bool $prefix | 	 * @param string|bool $prefix | ||||||
|  | 	 * @param bool        $multiCall | ||||||
| 	 * @return bool | 	 * @return bool | ||||||
| 	 */ | 	 */ | ||||||
| 	public function sendChat($message, $login = null, $prefix = true) { | 	public function sendChat($message, $login = null, $prefix = true, $multiCall = true) { | ||||||
| 		if (!$this->maniaControl->getClient()) { | 		if (!$this->maniaControl->getClient()) { | ||||||
| 			return false; | 			return false; | ||||||
| 		} | 		} | ||||||
| @@ -100,13 +102,13 @@ class Chat implements CallbackListener, CommunicationListener, UsageInformationA | |||||||
| 				$login = Player::parseLogin($login); | 				$login = Player::parseLogin($login); | ||||||
| 			} | 			} | ||||||
| 			try { | 			try { | ||||||
| 				return $this->maniaControl->getClient()->chatSendServerMessage($chatMessage, $login, true); | 				return $this->maniaControl->getClient()->chatSendServerMessage($chatMessage, $login, $multiCall); | ||||||
| 			} catch (UnknownPlayerException $e) { | 			} catch (UnknownPlayerException $e) { | ||||||
| 				return false; | 				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 | 	 * Handles SendChat Communication Request | ||||||
| 	 * | 	 * | ||||||
| 	 * @param $data | 	 * @param $data | ||||||
| 	 * @return array | 	 * @return CommunicationAnswer | ||||||
| 	 */ | 	 */ | ||||||
| 	public function communcationSendChat($data) { | 	public function communcationSendChat($data) { | ||||||
| 		if (!is_object($data) || !property_exists($data, "message")) { | 		if (!is_object($data) || !property_exists($data, "message")) { | ||||||
|   | |||||||
| @@ -221,8 +221,9 @@ class ManiaControl implements CallbackListener, CommandListener, TimerListener, | |||||||
| 			$this->getTimerManager()->registerOneTimeListening($this, function () use ($data) { | 			$this->getTimerManager()->registerOneTimeListening($this, function () use ($data) { | ||||||
| 				if (is_object($data) && property_exists($data, "message")) { | 				if (is_object($data) && property_exists($data, "message")) { | ||||||
| 					$this->restart($data->message); | 					$this->restart($data->message); | ||||||
|  | 				} else { | ||||||
|  | 					$this->restart(); | ||||||
| 				} | 				} | ||||||
| 				$this->restart(); |  | ||||||
| 			}, 3000); | 			}, 3000); | ||||||
| 			return new CommunicationAnswer(); | 			return new CommunicationAnswer(); | ||||||
| 		}); | 		}); | ||||||
| @@ -514,7 +515,7 @@ class ManiaControl implements CallbackListener, CommandListener, TimerListener, | |||||||
|  |  | ||||||
| 		// Announce restart | 		// Announce restart | ||||||
| 		try { | 		try { | ||||||
| 			$this->getChat()->sendInformation('Restarting ManiaControl...'); | 			$this->getChat()->sendInformation('Restarting ManiaControl...', null, true, false); | ||||||
| 		} catch (TransportException $e) { | 		} catch (TransportException $e) { | ||||||
| 		} | 		} | ||||||
| 		Logger::log('Restarting ManiaControl... ' . $message); | 		Logger::log('Restarting ManiaControl... ' . $message); | ||||||
|   | |||||||
| @@ -110,7 +110,7 @@ class DedimaniaWebHandler implements TimerListener { | |||||||
|  |  | ||||||
| 		if (!$serverInfo || !$playerInfo || !$mapInfo || !$gameMode) { | 		if (!$serverInfo || !$playerInfo || !$mapInfo || !$gameMode) { | ||||||
| 			$data = array($this->dedimaniaData->sessionId, $mapInfo, $gameMode, $serverInfo, $playerInfo); | 			$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)); | 				Logger::logError("Dedimania Records could not be fetched, debuginfo:" . json_encode($data)); | ||||||
| 			} | 			} | ||||||
| 			return false; | 			return false; | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user