possability to write an own matchsettings file for every server

This commit is contained in:
kremsy 2014-08-02 19:03:21 +02:00
parent 417d43c7cd
commit 1652da2359

View File

@ -45,6 +45,7 @@ class MapManager implements CallbackListener {
const SETTING_PERMISSION_RESTART_MAP = 'Restart Map'; const SETTING_PERMISSION_RESTART_MAP = 'Restart Map';
const SETTING_AUTOSAVE_MAPLIST = 'Autosave Maplist file'; const SETTING_AUTOSAVE_MAPLIST = 'Autosave Maplist file';
const SETTING_MAPLIST_FILE = 'File to write Maplist in'; const SETTING_MAPLIST_FILE = 'File to write Maplist in';
const SETTING_WRITE_OWN_MAPLIST_FILE = 'Write a own Maplist File for every Server called serverlogin.txt';
/* /*
* Public properties * Public properties
@ -111,6 +112,7 @@ class MapManager implements CallbackListener {
// Settings // Settings
$this->maniaControl->settingManager->initSetting($this, self::SETTING_AUTOSAVE_MAPLIST, true); $this->maniaControl->settingManager->initSetting($this, self::SETTING_AUTOSAVE_MAPLIST, true);
$this->maniaControl->settingManager->initSetting($this, self::SETTING_MAPLIST_FILE, "MatchSettings/tracklist.txt"); $this->maniaControl->settingManager->initSetting($this, self::SETTING_MAPLIST_FILE, "MatchSettings/tracklist.txt");
$this->maniaControl->settingManager->initSetting($this, self::SETTING_WRITE_OWN_MAPLIST_FILE, false);
} }
/** /**
@ -495,7 +497,12 @@ class MapManager implements CallbackListener {
// Write MapList // Write MapList
if ($this->maniaControl->settingManager->getSettingValue($this, self::SETTING_AUTOSAVE_MAPLIST)) { if ($this->maniaControl->settingManager->getSettingValue($this, self::SETTING_AUTOSAVE_MAPLIST)) {
if ($this->maniaControl->settingManager->getSettingValue($this, self::SETTING_WRITE_OWN_MAPLIST_FILE)) {
$matchSettingsFileName = "MatchSettings/{$this->maniaControl->server->login}.txt";
} else {
$matchSettingsFileName = $this->maniaControl->settingManager->getSettingValue($this, self::SETTING_MAPLIST_FILE); $matchSettingsFileName = $this->maniaControl->settingManager->getSettingValue($this, self::SETTING_MAPLIST_FILE);
}
try { try {
$this->maniaControl->client->saveMatchSettings($matchSettingsFileName); $this->maniaControl->client->saveMatchSettings($matchSettingsFileName);
} catch (FileException $e) { } catch (FileException $e) {