small fixes
This commit is contained in:
parent
6d2aa1b487
commit
a7212c13c5
@ -59,8 +59,7 @@ class MapList implements ManialinkPageAnswerListener, CallbackListener {
|
||||
|
||||
// Register for Callbacks
|
||||
$this->maniaControl->callbackManager->registerCallbackListener(ManialinkManager::CB_MAIN_WINDOW_CLOSED, $this, 'closeWidget');
|
||||
$this->maniaControl->callbackManager->registerCallbackListener(CallbackManager::CB_MP_PLAYERMANIALINKPAGEANSWER, $this,
|
||||
'handleManialinkPageAnswer');
|
||||
$this->maniaControl->callbackManager->registerCallbackListener(CallbackManager::CB_MP_PLAYERMANIALINKPAGEANSWER, $this, 'handleManialinkPageAnswer');
|
||||
$this->maniaControl->callbackManager->registerCallbackListener(MapQueue::CB_MAPQUEUE_CHANGED, $this, 'updateWidget');
|
||||
$this->maniaControl->callbackManager->registerCallbackListener(MapManager::CB_MAPS_UPDATED, $this, 'updateWidget');
|
||||
$this->maniaControl->callbackManager->registerCallbackListener(MapManager::CB_KARMA_UPDATED, $this, 'updateWidget');
|
||||
@ -88,22 +87,19 @@ class MapList implements ManialinkPageAnswerListener, CallbackListener {
|
||||
// TODO also get actual environment
|
||||
$recent = true;
|
||||
|
||||
if (count($params) > 1) {
|
||||
foreach ($params as $param) {
|
||||
if ($param == '/xlist') {
|
||||
if(count($params) > 1) {
|
||||
foreach($params as $param) {
|
||||
if($param == '/xlist') {
|
||||
continue;
|
||||
}
|
||||
if (strtolower(substr($param, 0, 5)) == 'auth:') {
|
||||
if(strtolower(substr($param, 0, 5)) == 'auth:') {
|
||||
$author = substr($param, 5);
|
||||
}
|
||||
elseif (strtolower(substr($param, 0, 4)) == 'env:') {
|
||||
} elseif(strtolower(substr($param, 0, 4)) == 'env:') {
|
||||
$environment = substr($param, 4);
|
||||
}
|
||||
else {
|
||||
if ($mapName == '') {
|
||||
} else {
|
||||
if($mapName == '') {
|
||||
$mapName = $param;
|
||||
}
|
||||
else { // concatenate words in name
|
||||
} else { // concatenate words in name
|
||||
$mapName .= '%20' . $param;
|
||||
}
|
||||
}
|
||||
@ -116,9 +112,9 @@ class MapList implements ManialinkPageAnswerListener, CallbackListener {
|
||||
$maps = new MXInfoSearcher($title, $mapName, $author, $environment, $recent);
|
||||
|
||||
// check if there are any results
|
||||
if (!$maps->valid()) {
|
||||
if(!$maps->valid()) {
|
||||
$this->maniaControl->chat->sendError('No maps found, or MX is down!', $player->login);
|
||||
if ($maps->error != '') {
|
||||
if($maps->error != '') {
|
||||
trigger_error($maps->error, E_USER_WARNING);
|
||||
}
|
||||
return;
|
||||
@ -147,14 +143,14 @@ class MapList implements ManialinkPageAnswerListener, CallbackListener {
|
||||
|
||||
$i = 0;
|
||||
$y -= 10;
|
||||
foreach ($maps as $map) {
|
||||
foreach($maps as $map) {
|
||||
$mapFrame = new Frame();
|
||||
$frame->add($mapFrame);
|
||||
$array = array($map->id => $x + 5, $map->name => $x + 17, $map->author => $x + 65, $map->mood => $x + 100, $map->maptype => $x + 115);
|
||||
$this->maniaControl->manialinkManager->labelLine($mapFrame, $array);
|
||||
$mapFrame->setY($y);
|
||||
|
||||
if ($this->maniaControl->authenticationManager->checkRight($player, AuthenticationManager::AUTH_LEVEL_ADMIN)) {
|
||||
if($this->maniaControl->authenticationManager->checkRight($player, AuthenticationManager::AUTH_LEVEL_ADMIN)) {
|
||||
// TODO: SET as setting who can add maps Add-Map-Button
|
||||
$addQuad = new Quad_Icons64x64_1();
|
||||
$mapFrame->add($addQuad);
|
||||
@ -178,7 +174,7 @@ class MapList implements ManialinkPageAnswerListener, CallbackListener {
|
||||
|
||||
$y -= 4;
|
||||
$i++;
|
||||
if ($i == self::MAX_MAPS_PER_PAGE) {
|
||||
if($i == self::MAX_MAPS_PER_PAGE) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -250,7 +246,7 @@ class MapList implements ManialinkPageAnswerListener, CallbackListener {
|
||||
$pagerSize = 6.;
|
||||
$pagesId = 'MapListPages';
|
||||
|
||||
if (count($mapList) > self::MAX_MAPS_PER_PAGE) {
|
||||
if(count($mapList) > self::MAX_MAPS_PER_PAGE) {
|
||||
$pagerPrev = new Quad_Icons64x64_1();
|
||||
$frame->add($pagerPrev);
|
||||
$pagerPrev->setPosition($width * 0.42, $height * -0.44, 2);
|
||||
@ -280,8 +276,7 @@ class MapList implements ManialinkPageAnswerListener, CallbackListener {
|
||||
$frame->add($headFrame);
|
||||
$headFrame->setY($height / 2 - 5);
|
||||
$x = -$width / 2;
|
||||
$array = array('Id' => $x + 5, 'Mx Id' => $x + 10, 'Map Name' => $x + 20, 'Author' => $x + 68, 'Karma' => $x + 115,
|
||||
'Actions' => $width / 2 - 15);
|
||||
$array = array('Id' => $x + 5, 'Mx Id' => $x + 10, 'Map Name' => $x + 20, 'Author' => $x + 68, 'Karma' => $x + 115, 'Actions' => $width / 2 - 15);
|
||||
$this->maniaControl->manialinkManager->labelLine($headFrame, $array);
|
||||
|
||||
// Predefine Description Label
|
||||
@ -306,12 +301,12 @@ class MapList implements ManialinkPageAnswerListener, CallbackListener {
|
||||
*
|
||||
* @var Map $map
|
||||
*/
|
||||
foreach ($mapList as $map) {
|
||||
foreach($mapList as $map) {
|
||||
|
||||
if (!isset($pageFrame)) {
|
||||
if(!isset($pageFrame)) {
|
||||
$pageFrame = new Frame();
|
||||
$frame->add($pageFrame);
|
||||
if (!empty($pageFrames)) {
|
||||
if(!empty($pageFrames)) {
|
||||
$pageFrame->setVisible(false);
|
||||
}
|
||||
array_push($pageFrames, $pageFrame);
|
||||
@ -325,7 +320,7 @@ class MapList implements ManialinkPageAnswerListener, CallbackListener {
|
||||
$mapFrame->setZ(0.1);
|
||||
$mapFrame->setY($y);
|
||||
|
||||
if ($id % 2 != 0) {
|
||||
if($id % 2 != 0) {
|
||||
$lineQuad = new Quad_BgsPlayerCard();
|
||||
$mapFrame->add($lineQuad);
|
||||
$lineQuad->setSize($width, 4);
|
||||
@ -333,7 +328,7 @@ class MapList implements ManialinkPageAnswerListener, CallbackListener {
|
||||
$lineQuad->setZ(0.001);
|
||||
}
|
||||
|
||||
if ($this->maniaControl->mapManager->getCurrentMap() === $map) {
|
||||
if($this->maniaControl->mapManager->getCurrentMap() === $map) {
|
||||
$currentQuad = new Quad_Icons64x64_1();
|
||||
$mapFrame->add($currentQuad);
|
||||
$currentQuad->setX($x + 3.5);
|
||||
@ -343,7 +338,7 @@ class MapList implements ManialinkPageAnswerListener, CallbackListener {
|
||||
}
|
||||
|
||||
$mxId = '-';
|
||||
if (isset($map->mx->id)) {
|
||||
if(isset($map->mx->id)) {
|
||||
$mxId = $map->mx->id;
|
||||
}
|
||||
|
||||
@ -358,7 +353,7 @@ class MapList implements ManialinkPageAnswerListener, CallbackListener {
|
||||
$frame->add($descriptionLabel);
|
||||
|
||||
// Map-Queue-Map-Label
|
||||
if (isset($queuedMaps[$map->uid])) {
|
||||
if(isset($queuedMaps[$map->uid])) {
|
||||
$label = new Label_Text();
|
||||
$mapFrame->add($label);
|
||||
$label->setX($width / 2 - 15);
|
||||
@ -368,8 +363,7 @@ class MapList implements ManialinkPageAnswerListener, CallbackListener {
|
||||
$label->setText($queuedMaps[$map->uid]);
|
||||
$label->setTextColor('fff');
|
||||
$descriptionLabel->setText('$<' . $map->name . '$> is on Map-Queue Position: ' . $queuedMaps[$map->uid]);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
// Map-Queue-Map-Button
|
||||
$queueLabel = new Label_Button();
|
||||
$mapFrame->add($queueLabel);
|
||||
@ -384,7 +378,7 @@ class MapList implements ManialinkPageAnswerListener, CallbackListener {
|
||||
$script->addTooltip($queueLabel, $descriptionLabel);
|
||||
}
|
||||
|
||||
if ($this->maniaControl->authenticationManager->checkRight($player, AuthenticationManager::AUTH_LEVEL_ADMIN)) {
|
||||
if($this->maniaControl->authenticationManager->checkRight($player, AuthenticationManager::AUTH_LEVEL_ADMIN)) {
|
||||
// TODO SET as setting who can add maps
|
||||
// erase map quad
|
||||
$eraseLabel = new Label_Button();
|
||||
@ -407,7 +401,7 @@ class MapList implements ManialinkPageAnswerListener, CallbackListener {
|
||||
$script->addTooltip($eraseLabel, $descriptionLabel);
|
||||
}
|
||||
|
||||
if ($this->maniaControl->authenticationManager->checkRight($player, AuthenticationManager::AUTH_LEVEL_MODERATOR)) {
|
||||
if($this->maniaControl->authenticationManager->checkRight($player, AuthenticationManager::AUTH_LEVEL_MODERATOR)) {
|
||||
// TODO SET as setting who can add maps
|
||||
// Switch to map
|
||||
$switchLabel = new Label_Button();
|
||||
@ -430,10 +424,10 @@ class MapList implements ManialinkPageAnswerListener, CallbackListener {
|
||||
}
|
||||
|
||||
// Display Karma bar
|
||||
if ($karmaPlugin) {
|
||||
if($karmaPlugin) {
|
||||
$karma = $karmaPlugin->getMapKarma($map);
|
||||
$votes = $karmaPlugin->getMapVotes($map);
|
||||
if (is_numeric($karma)) {
|
||||
if(is_numeric($karma)) {
|
||||
$karmaGauge = new Gauge();
|
||||
$mapFrame->add($karmaGauge);
|
||||
$karmaGauge->setZ(2);
|
||||
@ -458,12 +452,11 @@ class MapList implements ManialinkPageAnswerListener, CallbackListener {
|
||||
}
|
||||
|
||||
$y -= 4;
|
||||
if ($id % self::MAX_MAPS_PER_PAGE == 0) {
|
||||
if($id % self::MAX_MAPS_PER_PAGE == 0) {
|
||||
unset($pageFrame);
|
||||
}
|
||||
$id++;
|
||||
}
|
||||
// TODO page 0 bug?
|
||||
$this->maniaControl->manialinkManager->displayWidget($maniaLink, $player);
|
||||
}
|
||||
|
||||
@ -510,13 +503,12 @@ class MapList implements ManialinkPageAnswerListener, CallbackListener {
|
||||
// $buttLabel->setTextSize(1);
|
||||
$buttLabel->setAlign(Control::CENTER, Control::CENTER);
|
||||
|
||||
if (!$mapUid) {
|
||||
if(!$mapUid) {
|
||||
$quad->setAction(self::ACTION_SWITCH_MAP . '.' . ($id - 1));
|
||||
$buttLabel->setText('»');
|
||||
$buttLabel->setTextColor('0f0');
|
||||
$buttLabel->setTextSize(2);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
$buttLabel->setTextSize(1);
|
||||
$buttLabel->setText('x');
|
||||
$buttLabel->setTextColor('a00');
|
||||
@ -553,24 +545,26 @@ class MapList implements ManialinkPageAnswerListener, CallbackListener {
|
||||
public function handleManialinkPageAnswer(array $callback) {
|
||||
$actionId = $callback[1][2];
|
||||
$actionArray = explode('.', $actionId);
|
||||
if (count($actionArray) <= 2) return;
|
||||
if(count($actionArray) <= 2) {
|
||||
return;
|
||||
}
|
||||
|
||||
$action = $actionArray[0] . '.' . $actionArray[1];
|
||||
$login = $callback[1][1];
|
||||
$player = $this->maniaControl->playerManager->getPlayer($login);
|
||||
$mapId = (int) $actionArray[2];
|
||||
$mapId = (int)$actionArray[2];
|
||||
|
||||
switch ($action) {
|
||||
switch($action) {
|
||||
case self::ACTION_ADD_MAP:
|
||||
$this->maniaControl->mapManager->addMapFromMx($mapId, $player->login);
|
||||
break;
|
||||
case self::ACTION_ERASE_MAP:
|
||||
$this->maniaControl->mapManager->eraseMap($mapId, $actionArray[3]);
|
||||
$this->maniaControl->mapManager->removeMap($mapId, $actionArray[3]);
|
||||
$this->showMapList($player);
|
||||
break;
|
||||
case self::ACTION_SWITCH_MAP:
|
||||
$this->maniaControl->client->query('JumpToMapIndex', $mapId);
|
||||
$mapList = $this->maniaControl->mapManager->getMapList();
|
||||
$mapList = $this->maniaControl->mapManager->getMaps();
|
||||
$map = $mapList[$mapId];
|
||||
|
||||
$message = '$<' . $player->nickname . '$> skipped to Map $z$<' . $map->name . '$>!';
|
||||
@ -591,18 +585,16 @@ class MapList implements ManialinkPageAnswerListener, CallbackListener {
|
||||
* @param array $callback
|
||||
*/
|
||||
public function updateWidget(array $callback) {
|
||||
foreach ($this->mapListShown as $login => $shown) {
|
||||
if ($shown) {
|
||||
foreach($this->mapListShown as $login => $shown) {
|
||||
if($shown) {
|
||||
$player = $this->maniaControl->playerManager->getPlayer($login);
|
||||
if ($player != null) {
|
||||
if ($shown == self::SHOW_MX_LIST) {
|
||||
// TODO
|
||||
}
|
||||
else if ($shown == self::SHOW_MAP_LIST) {
|
||||
if($player != null) {
|
||||
if($shown == self::SHOW_MX_LIST) {
|
||||
//TODO
|
||||
} else if($shown == self::SHOW_MAP_LIST) {
|
||||
$this->showMapList($player);
|
||||
}
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
unset($this->mapListShown[$login]);
|
||||
}
|
||||
}
|
||||
|
@ -2,11 +2,10 @@
|
||||
|
||||
namespace ManiaControl\Maps;
|
||||
|
||||
use ManiaControl\FileUtil;
|
||||
use ManiaControl\Formatter;
|
||||
use ManiaControl\ManiaControl;
|
||||
use ManiaControl\Callbacks\CallbackListener;
|
||||
use ManiaControl\Callbacks\CallbackManager;
|
||||
use ManiaControl\FileUtil;
|
||||
use ManiaControl\ManiaControl;
|
||||
|
||||
require_once __DIR__ . '/Map.php';
|
||||
require_once __DIR__ . '/MapCommands.php';
|
||||
@ -81,7 +80,7 @@ class MapManager implements CallbackListener {
|
||||
UNIQUE KEY `uid` (`uid`)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Map data' AUTO_INCREMENT=1;";
|
||||
$result = $mysqli->query($query);
|
||||
if ($mysqli->error) {
|
||||
if($mysqli->error) {
|
||||
trigger_error($mysqli->error, E_USER_ERROR);
|
||||
return false;
|
||||
}
|
||||
@ -108,13 +107,13 @@ class MapManager implements CallbackListener {
|
||||
) ON DUPLICATE KEY UPDATE
|
||||
`index` = LAST_INSERT_ID(`index`);";
|
||||
$mapStatement = $mysqli->prepare($mapQuery);
|
||||
if ($mysqli->error) {
|
||||
if($mysqli->error) {
|
||||
trigger_error($mysqli->error);
|
||||
return false;
|
||||
}
|
||||
$mapStatement->bind_param('ssssss', $map->uid, $map->name, $map->authorLogin, $map->fileName, $map->environment, $map->mapType);
|
||||
$mapStatement->execute();
|
||||
if ($mapStatement->error) {
|
||||
if($mapStatement->error) {
|
||||
trigger_error($mapStatement->error);
|
||||
$mapStatement->close();
|
||||
return false;
|
||||
@ -131,7 +130,7 @@ class MapManager implements CallbackListener {
|
||||
* @param string $uid
|
||||
* @param bool $eraseFile
|
||||
*/
|
||||
public function removeMap($id, $uid, $eraseFile = false) {
|
||||
public function removeMap($id, $uid, $eraseFile = false) { //TODO erasefile?
|
||||
$map = $this->mapsUids[$uid];
|
||||
$this->maniaControl->client->query('RemoveMap', $map->fileName);
|
||||
$this->maniaControl->chat->sendSuccess('Map $<' . $map->name . '$> removed!');
|
||||
@ -145,7 +144,7 @@ class MapManager implements CallbackListener {
|
||||
* Updates the full Map list, needed on Init, addMap and on ShuffleMaps
|
||||
*/
|
||||
private function updateFullMapList() {
|
||||
if (!$this->maniaControl->client->query('GetMapList', 100, 0)) {
|
||||
if(!$this->maniaControl->client->query('GetMapList', 100, 0)) {
|
||||
trigger_error("Couldn't fetch mapList. " . $this->maniaControl->getClientErrorText());
|
||||
return null;
|
||||
}
|
||||
@ -153,12 +152,11 @@ class MapManager implements CallbackListener {
|
||||
$tempList = array();
|
||||
|
||||
$maps = $this->maniaControl->client->getResponse();
|
||||
foreach ($maps as $rpcMap) {
|
||||
if (array_key_exists($rpcMap["UId"], $this->mapsUids)) {
|
||||
foreach($maps as $rpcMap) {
|
||||
if(array_key_exists($rpcMap["UId"], $this->mapsUids)) {
|
||||
// Map already exists, only update index
|
||||
$tempList[] = $this->mapsUids[$rpcMap["UId"]];
|
||||
}
|
||||
else { // Insert Map Object
|
||||
} else { // Insert Map Object
|
||||
$map = new Map($this->maniaControl, $rpcMap);
|
||||
$this->saveMap($map);
|
||||
$tempList[] = $map;
|
||||
@ -179,12 +177,12 @@ class MapManager implements CallbackListener {
|
||||
* @return bool
|
||||
*/
|
||||
private function fetchCurrentMap() {
|
||||
if (!$this->maniaControl->client->query('GetCurrentMapInfo')) {
|
||||
if(!$this->maniaControl->client->query('GetCurrentMapInfo')) {
|
||||
trigger_error("Couldn't fetch map info. " . $this->maniaControl->getClientErrorText());
|
||||
return false;
|
||||
}
|
||||
$rpcMap = $this->maniaControl->client->getResponse();
|
||||
if (!array_key_exists($rpcMap["UId"], $this->mapsUids)) {
|
||||
if(!array_key_exists($rpcMap["UId"], $this->mapsUids)) {
|
||||
$this->currentMap = $this->mapsUids[$rpcMap["UId"]];
|
||||
return true;
|
||||
}
|
||||
@ -222,7 +220,7 @@ class MapManager implements CallbackListener {
|
||||
* @return mixed
|
||||
*/
|
||||
public function getMapByUid($uid) {
|
||||
if (!isset($this->mapsUids[$uid])) {
|
||||
if(!isset($this->mapsUids[$uid])) {
|
||||
return null;
|
||||
}
|
||||
return $this->mapsUids[$uid];
|
||||
@ -234,11 +232,10 @@ class MapManager implements CallbackListener {
|
||||
* @param array $callback
|
||||
*/
|
||||
public function handleBeginMap(array $callback) {
|
||||
if (array_key_exists($callback[1][0]["UId"], $this->mapsUids)) {
|
||||
if(array_key_exists($callback[1][0]["UId"], $this->mapsUids)) {
|
||||
// Map already exists, only update index
|
||||
$this->currentMap = $this->mapsUids[$callback[1][0]["UId"]];
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
// can this ever happen?
|
||||
$this->fetchCurrentMap();
|
||||
}
|
||||
@ -269,21 +266,21 @@ class MapManager implements CallbackListener {
|
||||
*/
|
||||
public function addMapFromMx($mapId, $login) {
|
||||
// Check if ManiaControl can even write to the maps dir
|
||||
if (!$this->maniaControl->client->query('GetMapsDirectory')) {
|
||||
if(!$this->maniaControl->client->query('GetMapsDirectory')) {
|
||||
trigger_error("Couldn't get map directory. " . $this->maniaControl->getClientErrorText());
|
||||
$this->maniaControl->chat->sendError("ManiaControl couldn't retrieve the maps directory.", $login);
|
||||
return;
|
||||
}
|
||||
|
||||
$mapDir = $this->maniaControl->client->getResponse();
|
||||
if (!is_dir($mapDir)) {
|
||||
if(!is_dir($mapDir)) {
|
||||
trigger_error("ManiaControl doesn't have have access to the maps directory in '{$mapDir}'.");
|
||||
$this->maniaControl->chat->sendError("ManiaControl doesn't have access to the maps directory.", $login);
|
||||
return;
|
||||
}
|
||||
$downloadDirectory = $this->maniaControl->settingManager->getSetting($this, 'MapDownloadDirectory', 'MX');
|
||||
// Create download directory if necessary
|
||||
if (!is_dir($mapDir . $downloadDirectory) && !mkdir($mapDir . $downloadDirectory)) {
|
||||
if(!is_dir($mapDir . $downloadDirectory) && !mkdir($mapDir . $downloadDirectory)) {
|
||||
trigger_error("ManiaControl doesn't have to rights to save maps in '{$mapDir}{$downloadDirectory}'.");
|
||||
$this->maniaControl->chat->sendError("ManiaControl doesn't have the rights to save maps.", $login);
|
||||
return;
|
||||
@ -291,7 +288,7 @@ class MapManager implements CallbackListener {
|
||||
$mapDir .= $downloadDirectory . '/';
|
||||
|
||||
// Download the map
|
||||
if (is_numeric($mapId)) {
|
||||
if(is_numeric($mapId)) {
|
||||
// Load from MX
|
||||
$serverInfo = $this->maniaControl->server->getSystemInfo();
|
||||
$title = strtolower(substr($serverInfo['TitleId'], 0, 2));
|
||||
@ -301,7 +298,7 @@ class MapManager implements CallbackListener {
|
||||
|
||||
$mapInfo = FileUtil::loadFile($url, "application/json");
|
||||
|
||||
if (!$mapInfo || strlen($mapInfo) <= 0) {
|
||||
if(!$mapInfo || strlen($mapInfo) <= 0) {
|
||||
// Invalid id
|
||||
$this->maniaControl->chat->sendError('Invalid MX-Id!', $login);
|
||||
return;
|
||||
@ -312,7 +309,7 @@ class MapManager implements CallbackListener {
|
||||
|
||||
$url = "http://{$title}.mania-exchange.com/tracks/download/{$mapId}";
|
||||
$file = FileUtil::loadFile($url);
|
||||
if (!$file) {
|
||||
if(!$file) {
|
||||
// Download error
|
||||
$this->maniaControl->chat->sendError('Download failed!', $login);
|
||||
return;
|
||||
@ -320,7 +317,7 @@ class MapManager implements CallbackListener {
|
||||
// Save map
|
||||
$fileName = $mapId . '_' . $mapInfo['Name'] . '.Map.Gbx';
|
||||
$fileName = FileUtil::getClearedFileName($fileName);
|
||||
if (!file_put_contents($mapDir . $fileName, $file)) {
|
||||
if(!file_put_contents($mapDir . $fileName, $file)) {
|
||||
// Save error
|
||||
$this->maniaControl->chat->sendError('Saving map failed!', $login);
|
||||
return;
|
||||
@ -328,19 +325,19 @@ class MapManager implements CallbackListener {
|
||||
// Check for valid map
|
||||
$mapFileName = $downloadDirectory . '/' . $fileName;
|
||||
|
||||
if (!$this->maniaControl->client->query('CheckMapForCurrentServerParams', $mapFileName)) {
|
||||
if(!$this->maniaControl->client->query('CheckMapForCurrentServerParams', $mapFileName)) {
|
||||
trigger_error("Couldn't check if map is valid ('{$mapFileName}'). " . $this->maniaControl->getClientErrorText());
|
||||
$this->maniaControl->chat->sendError('Error checking map!', $login);
|
||||
return;
|
||||
}
|
||||
$response = $this->maniaControl->client->getResponse();
|
||||
if (!$response) {
|
||||
if(!$response) {
|
||||
// Invalid map type
|
||||
$this->maniaControl->chat->sendError("Invalid map type.", $login);
|
||||
return;
|
||||
}
|
||||
// Add map to map list
|
||||
if (!$this->maniaControl->client->query('InsertMap', $mapFileName)) {
|
||||
if(!$this->maniaControl->client->query('InsertMap', $mapFileName)) {
|
||||
// TODO irgendein bug?
|
||||
$this->maniaControl->chat->sendError("Couldn't add map to match settings!", $login);
|
||||
return;
|
||||
|
Loading…
Reference in New Issue
Block a user