code refactoring

This commit is contained in:
Steffen Schröder
2014-05-02 18:21:38 +02:00
parent fa5752d9ce
commit ac5bbbeafa
11 changed files with 77 additions and 70 deletions

View File

@ -242,6 +242,14 @@ class PluginUpdateManager implements CallbackListener, CommandListener, TimerLis
private function installPlugin(PluginUpdateData $pluginUpdateData, Player $player = null, $update = false) {
$self = $this;
$this->maniaControl->fileReader->loadFile($pluginUpdateData->url, function ($updateFileContent, $error) use (&$self, &$pluginUpdateData, &$player, &$update) {
if (!$updateFileContent || $error) {
$message = "Error loading Update Data for '{$pluginUpdateData->pluginName}': {$error}!";
if ($player) {
$self->maniaControl->chat->sendInformation($message, $player);
}
$self->maniaControl->log($message);
return;
}
$actionNoun = ($update ? 'Update' : 'Install');
$actionVerb = ($update ? 'Updating' : 'Installing');
$actionVerbDone = ($update ? 'updated' : 'installed');