From 5717589588493cf60b6b964c3914300c8af23153 Mon Sep 17 00:00:00 2001 From: Alexander Nell Date: Sat, 30 May 2020 23:33:52 +0200 Subject: [PATCH] Use Chat::formatMessage in Main-Files --- core/ErrorHandler.php | 16 ++++++++++++---- core/ManiaControl.php | 7 ++++++- 2 files changed, 18 insertions(+), 5 deletions(-) diff --git a/core/ErrorHandler.php b/core/ErrorHandler.php index d139e481..e64b160e 100644 --- a/core/ErrorHandler.php +++ b/core/ErrorHandler.php @@ -131,8 +131,12 @@ class ErrorHandler { if ($isFatalError) { $this->maniaControl->getPluginManager()->deactivatePlugin($sourceClass); - $this->maniaControl->getChat()->sendError("Plugin " . $sourceClass . " has an Error -> The Plugin will be deactivated and ManiaControl restarted"); - Logger::logError("Plugin " . $sourceClass . " has an Error -> The Plugin will be deactivated and ManiaControl restarted"); + $message = $this->maniaControl->getChat()->formatMessage( + 'Plugin %s has an Error -> The Plugin will be deactivated and ManiaControl restarted!', + $sourceClass + ); + $this->maniaControl->getChat()->sendError($message); + Logger::logError("Plugin {$sourceClass} has an Error -> The Plugin will be deactivated and ManiaControl restarted!"); $isPluginError = true; } } @@ -482,8 +486,12 @@ class ErrorHandler { $report['PluginVersion'] = PluginManager::getPluginVersion($sourceClass); $this->maniaControl->getPluginManager()->deactivatePlugin($sourceClass); - $this->maniaControl->getChat()->sendError("Plugin " . $sourceClass . " has an Error -> The Plugin will be deactivated and ManiaControl restarted"); - Logger::logError("Plugin " . $sourceClass . " has an Error -> The Plugin will be deactivated and ManiaControl restarted"); + $message = $this->maniaControl->getChat()->formatMessage( + 'Plugin %s has an Error -> The Plugin will be deactivated and ManiaControl restarted!', + $sourceClass + ); + $this->maniaControl->getChat()->sendError($message); + Logger::logError("Plugin {$sourceClass} has an Error -> The Plugin will be deactivated and ManiaControl restarted!"); } } diff --git a/core/ManiaControl.php b/core/ManiaControl.php index 20a3c819..6caf2345 100644 --- a/core/ManiaControl.php +++ b/core/ManiaControl.php @@ -561,7 +561,12 @@ class ManiaControl implements CallbackListener, CommandListener, TimerListener, $this->getAuthenticationManager()->sendNotAllowed($player); return; } - $this->getChat()->sendError('The command //restart got disabled, reboot ManiaControl with //reboot instead', $player); + $message = $this->getChat()->formatMessage( + 'The command %s got disabled, reboot ManiaControl with %s instead!', + '//restart', + '//reboot' + ); + $this->getChat()->sendError($message, $player); } /**