Use Chat::formatMessage in Configurator/*, ManiaExchange/* and Maps/*

This commit is contained in:
Alexander Nell
2020-05-27 00:01:36 +02:00
parent 1d0215df52
commit 06f24a1bfb
9 changed files with 292 additions and 127 deletions

View File

@ -371,7 +371,11 @@ class DirectoryBrowser implements ManialinkPageAnswerListener {
$this->maniaControl->getMapManager()->updateMapTimestamp($map->uid);
// Message
$message = $player->getEscapedNickname() . ' added ' . $map->getEscapedName() . '!';
$message = $this->maniaControl->getChat()->formatMessage(
'%s added %s!',
$player,
$map
);
$this->maniaControl->getChat()->sendSuccess($message);
Logger::logInfo($message, true);
@ -391,10 +395,18 @@ class DirectoryBrowser implements ManialinkPageAnswerListener {
$folderPath = $player->getCache($this, self::CACHE_FOLDER_PATH);
$filePath = $folderPath . $fileName;
if (@unlink($filePath)) {
$this->maniaControl->getChat()->sendSuccess("Erased {$fileName}!");
$message = $this->maniaControl->getChat()->formatMessage(
'Erased %s!',
$fileName
);
$this->maniaControl->getChat()->sendSuccess($message, $player);
$this->showManiaLink($player);
} else {
$this->maniaControl->getChat()->sendError("Couldn't erase {$fileName}!");
$message = $this->maniaControl->getChat()->formatMessage(
'Could not erase %s!',
$fileName
);
$this->maniaControl->getChat()->sendError($message, $player);
}
}
}