Add logging when an admin change a setting

This commit is contained in:
Beu
2025-06-22 10:41:45 +02:00
parent 7a8d9f2b0b
commit f15fc201d2
5 changed files with 8 additions and 1 deletions

View File

@ -618,6 +618,7 @@ class GameModeSettings implements ConfiguratorMenu, CallbackListener, Communicat
// Trigger own callback
$this->maniaControl->getCallbackManager()->triggerCallback(self::CB_GAMEMODESETTING_CHANGED, $settingName, $settingValue);
Logger::log(AuthenticationManager::getAuthLevelName($player->authLevel) .' "'. $player->nickname . '" ('. $player->login .') changed the gamemode setting "'. $settingName .'" to "'. $settingValue .'"');
$settingIndex++;
}
@ -627,7 +628,6 @@ class GameModeSettings implements ConfiguratorMenu, CallbackListener, Communicat
$chatMessage .= '!';
$this->maniaControl->getChat()->sendInformation($chatMessage);
Logger::logInfo($chatMessage, true);
return true;
}

View File

@ -15,6 +15,7 @@ use FML\Script\Script;
use ManiaControl\Admin\AuthenticationManager;
use ManiaControl\Callbacks\CallbackListener;
use ManiaControl\Callbacks\CallbackManager;
use ManiaControl\Logger;
use ManiaControl\ManiaControl;
use ManiaControl\Players\Player;
use ManiaControl\Settings\Setting;
@ -528,6 +529,7 @@ class ManiaControlSettings implements ConfiguratorMenu, CallbackListener {
$setting->value = $settingData['Value'];
}
$this->maniaControl->getSettingManager()->saveSetting($setting);
Logger::log(AuthenticationManager::getAuthLevelName($player->authLevel) .' "'. $player->nickname . '" ('. $player->login .') changed the setting "'. $setting->class . '\\\\' . $setting->setting .'" to "'. $setting->value .'"');
}
$this->maniaControl->getChat()->sendSuccess('Settings saved!', $player);

View File

@ -636,6 +636,8 @@ class PluginMenu implements CallbackListener, ConfiguratorMenu, ManialinkPageAns
$setting->value = $settingData['Value'];
}
$this->maniaControl->getSettingManager()->saveSetting($setting);
Logger::log(AuthenticationManager::getAuthLevelName($player->authLevel) .' "'. $player->nickname . '" ('. $player->login .') changed the setting "'. $setting->class . '\\\\' . $setting->setting .'" to "'. $setting->value .'"');
}
$this->maniaControl->getChat()->sendSuccess('Plugin Settings saved!', $player);

View File

@ -418,6 +418,7 @@ class ServerOptionsMenu implements CallbackListener, ConfiguratorMenu, TimerList
$success = $this->applyNewServerOptions($newServerOptions, $player);
if ($success) {
$this->maniaControl->getChat()->sendSuccess('Server Options saved!', $player);
Logger::log(AuthenticationManager::getAuthLevelName($player->authLevel) .' "'. $player->nickname . '" ('. $player->login .') changed Server Options');
} else {
$this->maniaControl->getChat()->sendError('Server Options saving failed!', $player);
}

View File

@ -10,6 +10,7 @@ use ManiaControl\Admin\AuthenticationManager;
use ManiaControl\Callbacks\CallbackListener;
use ManiaControl\Callbacks\TimerListener;
use ManiaControl\Configurator\ConfiguratorMenu;
use ManiaControl\Logger;
use ManiaControl\ManiaControl;
use ManiaControl\Players\Player;
use Maniaplanet\DedicatedServer\Structures\VoteRatio;
@ -166,6 +167,7 @@ class VoteRatiosMenu implements CallbackListener, ConfiguratorMenu, TimerListene
$success = $this->maniaControl->getClient()->setCallVoteRatios($newVoteRatios);
if ($success) {
$this->maniaControl->getChat()->sendSuccess('Vote Ratios saved!', $player);
Logger::log(AuthenticationManager::getAuthLevelName($player->authLevel) .' "'. $player->nickname . '" ('. $player->login .') changed the Vote Ratios');
} else {
$this->maniaControl->getChat()->sendError('Vote Ratios saving failed!', $player);
}