Add the possibility to don't load settings from database

This commit is contained in:
Beu 2022-04-13 10:56:53 +02:00
parent 024037c48b
commit 076c066e43

View File

@ -50,6 +50,7 @@ class GameModeSettings implements ConfiguratorMenu, CallbackListener, Communicat
const DESCRIPTION_HIDDEN = '<hidden>';
const SETTING_HIDE_SETTINGS_WITH_DESCRIPTION_HIDDEN = 'Hide Settings with Description "' . self::DESCRIPTION_HIDDEN . '"';
const SETTING_LOAD_DEFAULT_SETTINGS_STARTUP = 'Load Stored GameMode-Settings on Startup';
const SETTING_LOAD_DEFAULT_SETTINGS_MAP_BEGIN = 'Load Stored GameMode-Settings on Map-Begin';
const SETTING_PERMISSION_CHANGE_MODE_SETTINGS = 'Change GameMode-Settings';
/** @deprecated */
@ -77,6 +78,7 @@ class GameModeSettings implements ConfiguratorMenu, CallbackListener, Communicat
// Settings
$this->maniaControl->getSettingManager()->initSetting($this, self::SETTING_HIDE_SETTINGS_WITH_DESCRIPTION_HIDDEN, true);
$this->maniaControl->getSettingManager()->initSetting($this, self::SETTING_LOAD_DEFAULT_SETTINGS_STARTUP, true);
$this->maniaControl->getSettingManager()->initSetting($this, self::SETTING_LOAD_DEFAULT_SETTINGS_MAP_BEGIN, false);
$this->maniaControl->getSettingManager()->initSetting($this, self::SETTING_SORT_SETTINGS, true);
@ -214,7 +216,9 @@ class GameModeSettings implements ConfiguratorMenu, CallbackListener, Communicat
* Handle OnInit callback
*/
public function onInit() {
$this->loadSettingsFromDatabase();
if ($this->maniaControl->getSettingManager()->getSettingValue($this, self::SETTING_LOAD_DEFAULT_SETTINGS_MAP_BEGIN)) {
$this->loadSettingsFromDatabase();
}
}
/**