/**
* @param Server $server
*/
public function onCompletion(Server $server)
{
/** @var Loader $esspe */
$esspe = $server->getPluginManager()->getPlugin("EssentialsPE");
if ($esspe->getDescription()->getVersion() < ($v = $this->getResult()["version"])) {
$continue = true;
$message = TextFormat::AQUA . "[EssentialsPE]" . TextFormat::GREEN . " A new " . TextFormat::YELLOW . $this->build . TextFormat::GREEN . " version of EssentialsPE found! Version: " . TextFormat::YELLOW . $v . TextFormat::GREEN . ($this->install !== true ? "" : ", " . TextFormat::LIGHT_PURPLE . "Installing...");
} else {
$continue = false;
$message = TextFormat::AQUA . "[EssentialsPE]" . TextFormat::YELLOW . " No new version found, you're using the latest version of EssentialsPE";
}
$esspe->broadcastUpdateAvailability($message);
if ($continue && $this->install) {
$server->getScheduler()->scheduleAsyncTask($task = new UpdateInstallTask($esspe, $this->getResult()["downloadURL"], $server->getPluginPath(), $v));
$esspe->updaterDownloadTask = $task;
}
}