removed old php 5.3 compatibility code

This commit is contained in:
Steffen Schröder
2014-06-17 23:27:28 +02:00
parent ea223a6d26
commit 2e0a0359dd
11 changed files with 205 additions and 235 deletions

View File

@ -131,13 +131,12 @@ class ManiaExchangeList implements CallbackListener, ManialinkPageAnswerListener
}
// search for matching maps
$self = $this;
$this->maniaControl->mapManager->mxManager->getMapsAsync(function (array $maps) use (&$self, &$player) {
$this->maniaControl->mapManager->mxManager->getMapsAsync(function (array $maps) use (&$player) {
if (!$maps) {
$self->maniaControl->chat->sendError('No maps found, or MX is down!', $player->login);
$this->maniaControl->chat->sendError('No maps found, or MX is down!', $player->login);
return;
}
$self->showManiaExchangeList($maps, $player);
$this->showManiaExchangeList($maps, $player);
}, $searchString, $author, $environment);
}

View File

@ -85,9 +85,8 @@ class CustomUIManager implements CallbackListener, TimerListener {
//TODO: validate necessity
//send it again after 500ms
$self = $this;
$this->maniaControl->timerManager->registerOneTimeListening($this, function ($time) use (&$self, &$player) {
$self->updateManialink($player);
$this->maniaControl->timerManager->registerOneTimeListening($this, function () use (&$player) {
$this->updateManialink($player);
}, 500);
}

View File

@ -624,16 +624,15 @@ class MapList implements ManialinkPageAnswerListener, CallbackListener {
$votesPlugin->defineVote('switchmap', "Goto " . $map->name, true, $message);
$self = $this;
$votesPlugin->startVote($player, 'switchmap', function ($result) use (&$self, &$votesPlugin, &$map) {
$self->maniaControl->chat->sendInformation('$sVote Successful -> Map switched!');
$votesPlugin->startVote($player, 'switchmap', function ($result) use (&$votesPlugin, &$map) {
$this->maniaControl->chat->sendInformation('$sVote Successful -> Map switched!');
$votesPlugin->undefineVote('switchmap');
//Don't queue on Map-Change
$this->maniaControl->mapManager->mapQueue->dontQueueNextMapChange();
try {
$self->maniaControl->client->JumpToMapIdent($map->uid);
$this->maniaControl->client->JumpToMapIdent($map->uid);
} catch (NotInListException $e) {
}
});

View File

@ -263,9 +263,9 @@ class PlayerList implements ManialinkPageAnswerListener, CallbackListener, Timer
$rightLabel->setZ(3.1);
$rightLabel->setText($this->maniaControl->authenticationManager->getAuthLevelAbbreviation($listPlayer->authLevel));
$rightLabel->setTextSize(0.8);
$rightLabel->setTextColor("fff");
$rightLabel->setTextColor('fff');
$description = $this->maniaControl->authenticationManager->getAuthLevelName($listPlayer) . " " . $listPlayer->nickname;
$description = $this->maniaControl->authenticationManager->getAuthLevelName($listPlayer) . ' ' . $listPlayer->nickname;
$rightLabel->addTooltipLabelFeature($descriptionLabel, $description);
// Player Statistics
@ -275,7 +275,7 @@ class PlayerList implements ManialinkPageAnswerListener, CallbackListener, Timer
$playerQuad->setZ(3);
$playerQuad->setSize(2.7, 2.7);
$playerQuad->setSubStyle($playerQuad::SUBSTYLE_TrackInfo);
$playerQuad->setAction(self::ACTION_OPEN_PLAYER_DETAILED . "." . $listPlayer->login);
$playerQuad->setAction(self::ACTION_OPEN_PLAYER_DETAILED . '.' . $listPlayer->login);
$description = 'View Statistics of $<' . $listPlayer->nickname . '$>';
$playerQuad->addTooltipLabelFeature($descriptionLabel, $description);
@ -288,7 +288,7 @@ class PlayerList implements ManialinkPageAnswerListener, CallbackListener, Timer
$playerQuad->setSubStyle($playerQuad::SUBSTYLE_Camera);
$description = 'Spectate $<' . $listPlayer->nickname . '$>';
$playerQuad->addTooltipLabelFeature($descriptionLabel, $description);
$playerQuad->setAction(self::ACTION_SPECTATE_PLAYER . "." . $listPlayer->login);
$playerQuad->setAction(self::ACTION_SPECTATE_PLAYER . '.' . $listPlayer->login);
// Player Profile Quad
$playerQuad = new Quad_UIConstruction_Buttons();
@ -311,7 +311,7 @@ class PlayerList implements ManialinkPageAnswerListener, CallbackListener, Timer
$playerQuad->setZ(0.1);
$playerQuad->setSize(3.8, 3.8);
$playerQuad->setSubStyle($playerQuad::SUBSTYLE_Buddy);
$playerQuad->setAction(self::ACTION_PLAYER_ADV . "." . $listPlayer->login);
$playerQuad->setAction(self::ACTION_PLAYER_ADV . '.' . $listPlayer->login);
// Description Label
$description = 'Advanced Player Actions for $<' . $listPlayer->nickname . '$>';
@ -478,7 +478,7 @@ class PlayerList implements ManialinkPageAnswerListener, CallbackListener, Timer
$label->setY($height / 2 - 5);
$label->setStyle($style);
$label->setTextSize($textSize);
$label->setText("Advanced Actions");
$label->setText('Advanced Actions');
$label->setTextColor($textColor);
// Show Nickname
@ -510,11 +510,11 @@ class PlayerList implements ManialinkPageAnswerListener, CallbackListener, Timer
$label->setTextColor($textColor);
if (!$this->maniaControl->playerManager->playerActions->isPlayerMuted($login)) {
$label->setText("Mute");
$quad->setAction(self::ACTION_MUTE_PLAYER . "." . $login);
$label->setText('Mute');
$quad->setAction(self::ACTION_MUTE_PLAYER . '.' . $login);
} else {
$label->setText("UnMute");
$quad->setAction(self::ACTION_UNMUTE_PLAYER . "." . $login);
$label->setText('UnMute');
$quad->setAction(self::ACTION_UNMUTE_PLAYER . '.' . $login);
}
// Warn Player
@ -522,12 +522,12 @@ class PlayerList implements ManialinkPageAnswerListener, CallbackListener, Timer
$quad = clone $quad;
$frame->add($quad);
$quad->setY($posY);
$quad->setAction(self::ACTION_WARN_PLAYER . "." . $login);
$quad->setAction(self::ACTION_WARN_PLAYER . '.' . $login);
$label = clone $label;
$frame->add($label);
$label->setY($posY);
$label->setText("Warn");
$label->setText('Warn');
$label->setTextColor($textColor);
$posY -= 5;
@ -536,40 +536,38 @@ class PlayerList implements ManialinkPageAnswerListener, CallbackListener, Timer
$quad = clone $quad;
$frame->add($quad);
$quad->setY($posY);
$quad->setAction(self::ACTION_KICK_PLAYER . "." . $login);
$quad->setAction(self::ACTION_KICK_PLAYER . '.' . $login);
$label = clone $label;
$frame->add($label);
$label->setY($posY);
$label->setText("Kick");
$label->setTextColor("F90");
$label->setText('Kick');
$label->setTextColor('f90');
$posY -= 5;
// Show Ban
$quad = clone $quad;
$frame->add($quad);
$quad->setY($posY);
$quad->setAction(self::ACTION_BAN_PLAYER . "." . $login);
$quad->setAction(self::ACTION_BAN_PLAYER . '.' . $login);
$label = clone $label;
$frame->add($label);
$label->setY($posY);
$label->setText("Ban");
$label->setTextColor("700");
$label->setText('Ban');
$label->setTextColor('700');
$posY -= 10;
// Show Add as Master-Admin
$quad = clone $quad;
$frame->add($quad);
$quad->setY($posY);
$quad->setAction(self::ACTION_ADD_AS_MASTER . "." . $login);
$quad->setAction(self::ACTION_ADD_AS_MASTER . '.' . $login);
$label = clone $label;
$frame->add($label);
$label->setY($posY);
$label->setText("Set SuperAdmin");
$label->setText('Set SuperAdmin');
$label->setTextColor($textColor);
$posY -= 5;
@ -577,12 +575,12 @@ class PlayerList implements ManialinkPageAnswerListener, CallbackListener, Timer
$quad = clone $quad;
$frame->add($quad);
$quad->setY($posY);
$quad->setAction(self::ACTION_ADD_AS_ADMIN . "." . $login);
$quad->setAction(self::ACTION_ADD_AS_ADMIN . '.' . $login);
$label = clone $label;
$frame->add($label);
$label->setY($posY);
$label->setText("Set Admin");
$label->setText('Set Admin');
$label->setTextColor($textColor);
$posY -= 5;
@ -590,12 +588,12 @@ class PlayerList implements ManialinkPageAnswerListener, CallbackListener, Timer
$quad = clone $quad;
$frame->add($quad);
$quad->setY($posY);
$quad->setAction(self::ACTION_ADD_AS_MOD . "." . $login);
$quad->setAction(self::ACTION_ADD_AS_MOD . '.' . $login);
$label = clone $label;
$frame->add($label);
$label->setY($posY);
$label->setText("Set Moderator");
$label->setText('Set Moderator');
$label->setTextColor($textColor);
if ($player->authLevel > 0 && $this->maniaControl->authenticationManager->checkRight($admin, $player->authLevel + 1)) {
@ -604,13 +602,13 @@ class PlayerList implements ManialinkPageAnswerListener, CallbackListener, Timer
$quad = clone $quad;
$frame->add($quad);
$quad->setY($posY);
$quad->setAction(self::ACTION_REVOKE_RIGHTS . "." . $login);
$quad->setAction(self::ACTION_REVOKE_RIGHTS . '.' . $login);
$label = clone $label;
$frame->add($label);
$label->setY($posY);
$label->setText("Revoke Rights");
$label->setTextColor("700");
$label->setText('Revoke Rights');
$label->setTextColor('700');
}
return $frame;
@ -628,7 +626,7 @@ class PlayerList implements ManialinkPageAnswerListener, CallbackListener, Timer
return;
}
$action = $actionArray[0] . "." . $actionArray[1];
$action = $actionArray[0] . '.' . $actionArray[1];
$adminLogin = $callback[1][1];
$targetLogin = $actionArray[2];
@ -699,16 +697,15 @@ class PlayerList implements ManialinkPageAnswerListener, CallbackListener, Timer
$startMessage = '$<' . $admin->nickname . '$>$s started a vote to force $<' . $target->nickname . '$> into spectator!';
$votesPlugin->defineVote('forcespec', "Force $<" . $target->nickname . "$> Spec", true, $startMessage);
$votesPlugin->defineVote('forcespec', 'Force $<' . $target->nickname . '$> Spec', true, $startMessage);
$self = $this;
$votesPlugin->startVote($admin, 'forcespec', function ($result) use (&$self, &$votesPlugin, &$target) {
$self->maniaControl->chat->sendInformation('$sVote Successfully -> Player $<' . $target->nickname . '$> forced to Spectator!');
$votesPlugin->startVote($admin, 'forcespec', function ($result) use (&$votesPlugin, &$target) {
$this->maniaControl->chat->sendInformation('$sVote Successful -> Player $<' . $target->nickname . '$> forced to Spectator!');
$votesPlugin->undefineVote('forcespec');
try {
$self->maniaControl->client->forceSpectator($target->login, PlayerActions::SPECTATOR_BUT_KEEP_SELECTABLE);
$self->maniaControl->client->spectatorReleasePlayerSlot($target->login);
$this->maniaControl->client->forceSpectator($target->login, PlayerActions::SPECTATOR_BUT_KEEP_SELECTABLE);
$this->maniaControl->client->spectatorReleasePlayerSlot($target->login);
} catch (PlayerStateException $e) {
}
});
@ -723,16 +720,15 @@ class PlayerList implements ManialinkPageAnswerListener, CallbackListener, Timer
$startMessage = '$<' . $admin->nickname . '$>$s started a vote to kick $<' . $target->nickname . '$>!';
$votesPlugin->defineVote('kick', "Kick $<" . $target->nickname . "$>", true, $startMessage);
$votesPlugin->defineVote('kick', 'Kick $<' . $target->nickname . '$>', true, $startMessage);
$self = $this;
$votesPlugin->startVote($admin, 'kick', function ($result) use (&$self, &$votesPlugin, &$target) {
$self->maniaControl->chat->sendInformation('$sVote Successfully -> $<' . $target->nickname . '$> got Kicked!');
$votesPlugin->startVote($admin, 'kick', function ($result) use (&$votesPlugin, &$target) {
$this->maniaControl->chat->sendInformation('$sVote Successful -> $<' . $target->nickname . '$> got Kicked!');
$votesPlugin->undefineVote('kick');
$message = '$39F You got kicked due a Public vote!$z ';
$message = '$39F You got kicked due to a Public Vote!$z ';
try {
$self->maniaControl->client->kick($target->login, $message);
$this->maniaControl->client->kick($target->login, $message);
} catch (UnknownPlayerException $e) {
}
});

View File

@ -75,12 +75,11 @@ class UsageReporter implements TimerListener {
$json = json_encode($properties);
$info = base64_encode($json);
$url = ManiaControl::URL_WEBSERVICE . '/usagereport?info=' . urlencode($info);
$self = $this;
$this->maniaControl->fileReader->loadFile($url, function ($response, $error) use (&$self) {
$url = ManiaControl::URL_WEBSERVICE . '/usagereport?info=' . urlencode($info);
$this->maniaControl->fileReader->loadFile($url, function ($response, $error) {
$response = json_decode($response);
if ($error || !$response) {
$self->maniaControl->log('Error while Sending data: ' . print_r($error, true));
$this->maniaControl->log('Error while Sending data: ' . print_r($error, true));
}
});
}

View File

@ -71,20 +71,18 @@ class PluginUpdateManager implements CallbackListener, CommandListener, TimerLis
}
$this->maniaControl->log($message);
$self = $this;
$maniaControl = $this->maniaControl;
$this->maniaControl->pluginManager->fetchPluginList(function ($data, $error) use (&$self, &$maniaControl, &$player) {
$this->maniaControl->pluginManager->fetchPluginList(function ($data, $error) use (&$player) {
if (!$data || $error) {
$message = 'Error while checking Plugins for newer Versions!';
if ($player) {
$maniaControl->chat->sendError($message, $player);
$this->maniaControl->chat->sendError($message, $player);
}
$maniaControl->log($message);
$this->maniaControl->log($message);
return;
}
$pluginsData = $self->parsePluginsData($data);
$pluginClasses = $maniaControl->pluginManager->getPluginClasses();
$pluginsData = $this->parsePluginsData($data);
$pluginClasses = $this->maniaControl->pluginManager->getPluginClasses();
$pluginUpdates = array();
foreach ($pluginClasses as $pluginClass) {
@ -100,25 +98,25 @@ class PluginUpdateManager implements CallbackListener, CommandListener, TimerLis
$pluginUpdates[$pluginId] = $pluginData;
$message = "There is an Update of '{$pluginData->pluginName}' available! ('{$pluginClass}' - Version {$pluginData->version})";
if ($player) {
$maniaControl->chat->sendSuccess($message, $player);
$this->maniaControl->chat->sendSuccess($message, $player);
}
$maniaControl->log($message);
$this->maniaControl->log($message);
}
}
if (empty($pluginUpdates)) {
$message = 'Plugins Update Check completed: All Plugins are up-to-date!';
if ($player) {
$maniaControl->chat->sendSuccess($message, $player);
$this->maniaControl->chat->sendSuccess($message, $player);
}
$maniaControl->log($message);
$this->maniaControl->log($message);
} else {
$updatesCount = count($pluginUpdates);
$message = "Plugins Update Check completed: There are {$updatesCount} Updates available!";
if ($player) {
$maniaControl->chat->sendSuccess($message, $player);
$this->maniaControl->chat->sendSuccess($message, $player);
}
$maniaControl->log($message);
$this->maniaControl->log($message);
}
});
}
@ -236,25 +234,25 @@ class PluginUpdateManager implements CallbackListener, CommandListener, TimerLis
* @param bool $update
*/
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) {
$this->maniaControl->fileReader->loadFile($pluginUpdateData->url, function ($updateFileContent, $error) use (&$pluginUpdateData, &$player, &$update) {
if (!$updateFileContent || $error) {
$message = "Error loading Update Data for '{$pluginUpdateData->pluginName}': {$error}!";
if ($player) {
$self->maniaControl->chat->sendInformation($message, $player);
$this->maniaControl->chat->sendInformation($message, $player);
}
$self->maniaControl->log($message);
$this->maniaControl->log($message);
return;
}
$actionNoun = ($update ? 'Update' : 'Install');
$actionVerb = ($update ? 'Updating' : 'Installing');
$actionVerbDone = ($update ? 'updated' : 'installed');
$message = "Now {$actionVerb} '{$pluginUpdateData->pluginName}'...";
if ($player) {
$self->maniaControl->chat->sendInformation($message, $player);
$this->maniaControl->chat->sendInformation($message, $player);
}
$self->maniaControl->log($message);
$this->maniaControl->log($message);
$tempDir = FileUtil::getTempFolder();
$updateFileName = $tempDir . $pluginUpdateData->zipfile;
@ -263,7 +261,7 @@ class PluginUpdateManager implements CallbackListener, CommandListener, TimerLis
if (!$bytes || $bytes <= 0) {
$message = "Plugin {$actionNoun} failed: Couldn't save {$actionNoun} Zip!";
if ($player) {
$self->maniaControl->chat->sendError($message, $player);
$this->maniaControl->chat->sendError($message, $player);
}
trigger_error($message);
return;
@ -274,7 +272,7 @@ class PluginUpdateManager implements CallbackListener, CommandListener, TimerLis
if ($result !== true) {
$message = "Plugin {$actionNoun} failed: Couldn't open {$actionNoun} Zip! ({$result})";
if ($player) {
$self->maniaControl->chat->sendError($message, $player);
$this->maniaControl->chat->sendError($message, $player);
}
trigger_error($message);
return;
@ -291,27 +289,27 @@ class PluginUpdateManager implements CallbackListener, CommandListener, TimerLis
}
$message = "Successfully {$actionVerbDone} '{$pluginUpdateData->pluginName}'!{$messageExtra}";
if ($player) {
$self->maniaControl->chat->sendSuccess($message, $player);
$this->maniaControl->chat->sendSuccess($message, $player);
}
$self->maniaControl->log($message);
$this->maniaControl->log($message);
if (!$update) {
$newPluginClasses = $self->maniaControl->pluginManager->loadPlugins();
$newPluginClasses = $this->maniaControl->pluginManager->loadPlugins();
if (empty($newPluginClasses)) {
$message = "Loading fresh installed Plugin '{$pluginUpdateData->pluginName}' failed!";
if ($player) {
$self->maniaControl->chat->sendError($message, $player);
$this->maniaControl->chat->sendError($message, $player);
}
$self->maniaControl->log($message);
$this->maniaControl->log($message);
} else {
$message = "Successfully loaded fresh installed Plugin '{$pluginUpdateData->pluginName}'!";
if ($player) {
$self->maniaControl->chat->sendSuccess($message, $player);
$this->maniaControl->chat->sendSuccess($message, $player);
}
$self->maniaControl->log($message);
$this->maniaControl->log($message);
$menuId = $self->maniaControl->configurator->getMenuId('Install Plugins');
$self->maniaControl->configurator->reopenMenu($player, $menuId);
$menuId = $this->maniaControl->configurator->getMenuId('Install Plugins');
$this->maniaControl->configurator->reopenMenu($player, $menuId);
}
}
});
@ -349,24 +347,23 @@ class PluginUpdateManager implements CallbackListener, CommandListener, TimerLis
} else {
$pluginId = substr($actionId, strlen(PluginInstallMenu::ACTION_PREFIX_INSTALL_PLUGIN));
$url = ManiaControl::URL_WEBSERVICE . 'plugins/' . $pluginId;
$self = $this;
$this->maniaControl->fileReader->loadFile($url, function ($data, $error) use (&$self, &$player) {
$url = ManiaControl::URL_WEBSERVICE . 'plugins/' . $pluginId;
$this->maniaControl->fileReader->loadFile($url, function ($data, $error) use (&$player) {
if ($error || !$data) {
$message = "Error loading Plugin Install Data! {$error}";
$self->maniaControl->chat->sendError($message, $player);
$this->maniaControl->chat->sendError($message, $player);
return;
}
$data = json_decode($data);
if (!$data) {
$message = "Error loading Plugin Install Data! {$error}";
$self->maniaControl->chat->sendError($message, $player);
$this->maniaControl->chat->sendError($message, $player);
return;
}
$pluginUpdateData = new PluginUpdateData($data);
$self->installPlugin($pluginUpdateData, $player);
$this->installPlugin($pluginUpdateData, $player);
});
}
}

View File

@ -315,16 +315,14 @@ class UpdateManager implements CallbackListener, CommandListener, TimerListener
$this->maniaControl->log($message);
}
$self = $this;
$updateData = $this->coreUpdateData;
$maniaControl = $this->maniaControl;
$this->maniaControl->fileReader->loadFile($updateData->url, function ($updateFileContent, $error) use (&$self, &$maniaControl, &$updateData, &$player) {
$updateData = $this->coreUpdateData;
$this->maniaControl->fileReader->loadFile($updateData->url, function ($updateFileContent, $error) use ($updateData, &$player) {
if (!$updateFileContent || $error) {
$message = "Update failed: Couldn't load Update zip! {$error}";
if ($player) {
$maniaControl->chat->sendError($message, $player);
$this->maniaControl->chat->sendError($message, $player);
}
$maniaControl->log($message);
$this->maniaControl->log($message);
return;
}
@ -335,9 +333,9 @@ class UpdateManager implements CallbackListener, CommandListener, TimerListener
if (!$bytes || $bytes <= 0) {
$message = "Update failed: Couldn't save Update zip!";
if ($player) {
$maniaControl->chat->sendError($message, $player);
$this->maniaControl->chat->sendError($message, $player);
}
$maniaControl->log($message);
$this->maniaControl->log($message);
return;
}
@ -346,9 +344,9 @@ class UpdateManager implements CallbackListener, CommandListener, TimerListener
if ($result !== true) {
$message = "Update failed: Couldn't open Update Zip. ({$result})";
if ($player) {
$maniaControl->chat->sendError($message, $player);
$this->maniaControl->chat->sendError($message, $player);
}
$maniaControl->log($message);
$this->maniaControl->log($message);
return;
}
@ -358,15 +356,15 @@ class UpdateManager implements CallbackListener, CommandListener, TimerListener
FileUtil::removeTempFolder();
// Set the Nightly Build Date
$self->setNightlyBuildDate($updateData->releaseDate);
$this->setNightlyBuildDate($updateData->releaseDate);
$message = 'Update finished!';
if ($player) {
$maniaControl->chat->sendSuccess($message, $player);
$this->maniaControl->chat->sendSuccess($message, $player);
}
$maniaControl->log($message);
$this->maniaControl->log($message);
$maniaControl->restart();
$this->maniaControl->restart();
});
return true;
@ -427,37 +425,35 @@ class UpdateManager implements CallbackListener, CommandListener, TimerListener
return;
}
$self = $this;
$maniaControl = $this->maniaControl;
$this->checkCoreUpdateAsync(function (UpdateData $updateData = null) use (&$self, &$maniaControl, &$player) {
if (!$self->checkUpdateData($updateData)) {
$maniaControl->chat->sendInformation('No Update available!', $player->login);
$this->checkCoreUpdateAsync(function (UpdateData $updateData = null) use (&$player) {
if (!$this->checkUpdateData($updateData)) {
$this->maniaControl->chat->sendInformation('No Update available!', $player->login);
return;
}
if (!$self->checkUpdateDataBuildVersion($updateData)) {
$maniaControl->chat->sendError("Please update Your Server to '{$updateData->minDedicatedBuild}' in order to receive further Updates!", $player->login);
if (!$this->checkUpdateDataBuildVersion($updateData)) {
$this->maniaControl->chat->sendError("Please update Your Server to '{$updateData->minDedicatedBuild}' in order to receive further Updates!", $player->login);
return;
}
$isNightly = $self->isNightlyUpdateChannel();
$isNightly = $this->isNightlyUpdateChannel();
if ($isNightly) {
$buildDate = $self->getNightlyBuildDate();
$buildDate = $this->getNightlyBuildDate();
if ($buildDate) {
if ($updateData->isNewerThan($buildDate)) {
$maniaControl->chat->sendInformation("No new Build available! (Current Build: '{$buildDate}')", $player->login);
$this->maniaControl->chat->sendInformation("No new Build available! (Current Build: '{$buildDate}')", $player->login);
return;
} else {
$maniaControl->chat->sendSuccess("New Nightly Build ({$updateData->releaseDate}) available! (Current Build: '{$buildDate}')", $player->login);
$this->maniaControl->chat->sendSuccess("New Nightly Build ({$updateData->releaseDate}) available! (Current Build: '{$buildDate}')", $player->login);
}
} else {
$maniaControl->chat->sendSuccess("New Nightly Build ('{$updateData->releaseDate}') available!", $player->login);
$this->maniaControl->chat->sendSuccess("New Nightly Build ('{$updateData->releaseDate}') available!", $player->login);
}
} else {
$maniaControl->chat->sendSuccess('Update for Version ' . $updateData->version . ' available!', $player->login);
$this->maniaControl->chat->sendSuccess('Update for Version ' . $updateData->version . ' available!', $player->login);
}
$self->coreUpdateData = $updateData;
$this->coreUpdateData = $updateData;
});
}
@ -473,21 +469,19 @@ class UpdateManager implements CallbackListener, CommandListener, TimerListener
return;
}
$self = $this;
$maniaControl = $this->maniaControl;
$this->checkCoreUpdateAsync(function (UpdateData $updateData = null) use (&$self, &$maniaControl, &$player) {
$this->checkCoreUpdateAsync(function (UpdateData $updateData = null) use (&$player) {
if (!$updateData) {
$maniaControl->chat->sendError('Update is currently not possible!', $player);
$this->maniaControl->chat->sendError('Update is currently not possible!', $player);
return;
}
if (!$self->checkUpdateDataBuildVersion($updateData)) {
$maniaControl->chat->sendError("The Next ManiaControl Update requires a newer Dedicated Server Version!", $player);
if (!$this->checkUpdateDataBuildVersion($updateData)) {
$this->maniaControl->chat->sendError("The Next ManiaControl Update requires a newer Dedicated Server Version!", $player);
return;
}
$self->coreUpdateData = $updateData;
$this->coreUpdateData = $updateData;
$self->performCoreUpdate($player);
$this->performCoreUpdate($player);
});
}
}