Use Chat::formatMessage in Updates/*
This commit is contained in:
@ -402,7 +402,10 @@ class UpdateManager implements CallbackListener, CommandListener, TimerListener,
|
||||
// Set the build date
|
||||
$this->setBuildDate($updateData->releaseDate);
|
||||
|
||||
$message = 'Update finished! See what we updated with $<$fff//chatlog$>!';
|
||||
$message = $this->maniaControl->getChat()->formatMessage(
|
||||
'Update finished! See what we updated with %s!',
|
||||
'//changelog'
|
||||
);
|
||||
if ($player) {
|
||||
$this->maniaControl->getChat()->sendSuccess($message, $player);
|
||||
}
|
||||
@ -442,11 +445,20 @@ class UpdateManager implements CallbackListener, CommandListener, TimerListener,
|
||||
return;
|
||||
}
|
||||
|
||||
$message = '';
|
||||
if ($this->isNightlyUpdateChannel()) {
|
||||
$this->maniaControl->getChat()->sendSuccess('New Nightly Build (' . $this->coreUpdateData->releaseDate . ') available!', $player->login);
|
||||
$message = $this->maniaControl->getChat()->formatMessage(
|
||||
'New Nightly Build (%s) available!',
|
||||
$this->coreUpdateData->releaseDate
|
||||
);
|
||||
} else {
|
||||
$this->maniaControl->getChat()->sendInformation('New ManiaControl Version ' . $this->coreUpdateData->version . ' available!', $player->login);
|
||||
$message = $this->maniaControl->getChat()->formatMessage(
|
||||
'New ManiaControl Version (%s) available!',
|
||||
$this->coreUpdateData->version
|
||||
);
|
||||
}
|
||||
|
||||
$this->maniaControl->getChat()->sendInformation($message, $player);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -480,12 +492,16 @@ class UpdateManager implements CallbackListener, CommandListener, TimerListener,
|
||||
|
||||
$this->checkCoreUpdateAsync(function (UpdateData $updateData = null) use (&$player) {
|
||||
if (!$this->checkUpdateData($updateData)) {
|
||||
$this->maniaControl->getChat()->sendInformation('No Update available!', $player->login);
|
||||
$this->maniaControl->getChat()->sendInformation('No Update available!', $player);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!$this->checkUpdateDataBuildVersion($updateData)) {
|
||||
$this->maniaControl->getChat()->sendError("Please update Your Server to '{$updateData->minDedicatedBuild}' in order to receive further Updates!", $player->login);
|
||||
$message = $this->maniaControl->getChat()->formatMessage(
|
||||
'Please update your server to %s in order to receive further ManiaControl updates!',
|
||||
$updateData->minDedicatedBuild
|
||||
);
|
||||
$this->maniaControl->getChat()->sendError($message, $player);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -494,16 +510,32 @@ class UpdateManager implements CallbackListener, CommandListener, TimerListener,
|
||||
$buildDate = $this->getBuildDate();
|
||||
if ($buildDate) {
|
||||
if ($updateData->isNewerThan($buildDate)) {
|
||||
$this->maniaControl->getChat()->sendInformation("No new Build available! (Current Build: '{$buildDate}')", $player->login);
|
||||
return;
|
||||
$message = $this->maniaControl->getChat()->formatMessage(
|
||||
'No new Build available! (Current Build: %s)',
|
||||
$buildDate
|
||||
);
|
||||
$this->maniaControl->getChat()->sendInformation($message, $player);
|
||||
} else {
|
||||
$this->maniaControl->getChat()->sendSuccess("New Nightly Build ({$updateData->releaseDate}) available! (Current Build: '{$buildDate}')", $player->login);
|
||||
$message = $this->maniaControl->getChat()->formatMesssage(
|
||||
'New Nightly Build (%s) available! (Current Build: %s)',
|
||||
$updateData->releaseDate,
|
||||
$buildDate
|
||||
);
|
||||
$this->maniaControl->getChat()->sendSuccess($message, $player);
|
||||
}
|
||||
} else {
|
||||
$this->maniaControl->getChat()->sendSuccess("New Nightly Build ('{$updateData->releaseDate}') available!", $player->login);
|
||||
$message = $this->maniaControl->getChat()->formatMesssage(
|
||||
'New Nightly Build (%s) available!',
|
||||
$updateData->releaseDate
|
||||
);
|
||||
$this->maniaControl->getChat()->sendSuccess($message, $player);
|
||||
}
|
||||
} else {
|
||||
$this->maniaControl->getChat()->sendSuccess('Update for Version ' . $updateData->version . ' available!', $player->login);
|
||||
$message = $this->maniaControl->getChat()->formatMesssage(
|
||||
'Update for Version %s available!',
|
||||
$updateData->version
|
||||
);
|
||||
$this->maniaControl->getChat()->sendSuccess($message, $player);
|
||||
}
|
||||
|
||||
$this->coreUpdateData = $updateData;
|
||||
@ -540,7 +572,7 @@ class UpdateManager implements CallbackListener, CommandListener, TimerListener,
|
||||
}
|
||||
if (!$this->checkUpdateDataBuildVersion($updateData)) {
|
||||
if ($player) {
|
||||
$this->maniaControl->getChat()->sendError("The Next ManiaControl Update requires a newer Dedicated Server Version!", $player);
|
||||
$this->maniaControl->getChat()->sendError('The Next ManiaControl Update requires a newer Dedicated Server Version!', $player);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
Reference in New Issue
Block a user