fix error when having one map and no re-order setting value

This commit is contained in:
Beu
2025-09-03 09:03:41 +02:00
parent 8796898167
commit 1ea9abfcda

View File

@@ -37,7 +37,7 @@ class MatchManagerTMWTDuoIntegration implements CallbackListener, ManialinkPageA
* Constants
*/
const PLUGIN_ID = 211;
const PLUGIN_VERSION = 1.2;
const PLUGIN_VERSION = 1.3;
const PLUGIN_NAME = 'MatchManager TMWT Duo Integration';
const PLUGIN_AUTHOR = 'Beu';
@@ -326,9 +326,8 @@ class MatchManagerTMWTDuoIntegration implements CallbackListener, ManialinkPageA
$this->maniaControl->getClient()->setModeScriptSettings(['S_IsMatchmaking' => true], false);
$this->maniaControl->getClient()->restartMap();
} else if ($this->state === self::STATE_PREMATCH) {
$teamsUrl = $this->maniaControl->getSettingManager()->getSettingValue($this->MatchManagerCore, 'S_TeamsUrl');
if ($teamsUrl !== '') {
if ($teamsUrl !== null && $teamsUrl !== '') {
$response = WebReader::getUrl($teamsUrl);
$content = $response->getContent();
$json = json_decode($content);
@@ -416,7 +415,10 @@ class MatchManagerTMWTDuoIntegration implements CallbackListener, ManialinkPageA
$mapUids = array_column($json->playlist, 'uid');
$order = explode(',', $this->maniaControl->getSettingManager()->getSettingValue($this, self::SETTING_PICKANDBAN_OVERRIDEMAPORDER));
$mapOrderSetting = $this->maniaControl->getSettingManager()->getSettingValue($this, self::SETTING_PICKANDBAN_OVERRIDEMAPORDER);
if ($mapOrderSetting !== '') {
$order = array_map('trim', explode(',', $mapOrderSetting));
if (count($order) === count($mapUids)) {
$this->log("Re-ordering maps");
@@ -431,6 +433,7 @@ class MatchManagerTMWTDuoIntegration implements CallbackListener, ManialinkPageA
$this->maniaControl->getChat()->sendErrorToAdmins($this->MatchManagerCore->getChatPrefix() ."Invalid Map order setting");
}
}
}
$mapList = [];
foreach ($this->maniaControl->getMapManager()->getMaps() as $map) {