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);
});
}
}

View File

@ -263,36 +263,35 @@ class DedimaniaPlugin implements CallbackListener, CommandListener, TimerListene
$data = array($this->dedimaniaData->sessionId, $mapInfo, $gameMode, $serverInfo, $playerInfo);
$content = $this->encode_request(self::DEDIMANIA_GETRECORDS, $data);
$self = $this;
$this->maniaControl->fileReader->postData(self::DEDIMANIA_URL, function ($data, $error) use (&$self) {
$this->maniaControl->fileReader->postData(self::DEDIMANIA_URL, function ($data, $error) {
if ($error) {
$self->maniaControl->log('Dedimania Error: ' . $error);
$this->maniaControl->log('Dedimania Error: ' . $error);
}
$data = $self->decode($data);
$data = $this->decode($data);
if (!is_array($data) || empty($data)) {
return;
}
$methodResponse = $data[0];
if (xmlrpc_is_fault($methodResponse)) {
$self->handleXmlRpcFault($methodResponse, self::DEDIMANIA_GETRECORDS);
$this->handleXmlRpcFault($methodResponse, self::DEDIMANIA_GETRECORDS);
return;
}
$responseData = $methodResponse[0];
$self->dedimaniaData->serverMaxRank = $responseData['ServerMaxRank'];
$this->dedimaniaData->serverMaxRank = $responseData['ServerMaxRank'];
foreach ($responseData['Players'] as $player) {
$dediPlayer = new DedimaniaPlayer($player);
$self->dedimaniaData->addPlayer($dediPlayer);
$this->dedimaniaData->addPlayer($dediPlayer);
}
foreach ($responseData['Records'] as $key => $record) {
$self->dedimaniaData->records[$key] = new RecordData($record);
$this->dedimaniaData->records[$key] = new RecordData($record);
}
$self->updateManialink = true;
$self->maniaControl->callbackManager->triggerCallback(self::CB_DEDIMANIA_UPDATED, $self->dedimaniaData->records);
$this->updateManialink = true;
$this->maniaControl->callbackManager->triggerCallback(self::CB_DEDIMANIA_UPDATED, $this->dedimaniaData->records);
}, $content, true);
return true;
@ -528,27 +527,26 @@ class DedimaniaPlugin implements CallbackListener, CommandListener, TimerListene
$content = $this->encode_request(self::DEDIMANIA_CHECKSESSION, array($this->dedimaniaData->sessionId));
$self = $this;
$this->maniaControl->fileReader->postData(self::DEDIMANIA_URL, function ($data, $error) use (&$self) {
$this->maniaControl->fileReader->postData(self::DEDIMANIA_URL, function ($data, $error) {
if ($error) {
$self->maniaControl->log("Dedimania Error: " . $error);
$this->maniaControl->log("Dedimania Error: " . $error);
}
$data = $self->decode($data);
$data = $this->decode($data);
if (!is_array($data) || empty($data)) {
return;
}
$methodResponse = $data[0];
if (xmlrpc_is_fault($methodResponse)) {
$self->handleXmlRpcFault($methodResponse, self::DEDIMANIA_CHECKSESSION);
$this->handleXmlRpcFault($methodResponse, self::DEDIMANIA_CHECKSESSION);
return;
}
$responseData = $methodResponse[0];
if (is_bool($responseData)) {
if (!$responseData) {
$self->openDedimaniaSession();
$this->openDedimaniaSession();
}
}
}, $content, true);
@ -565,35 +563,34 @@ class DedimaniaPlugin implements CallbackListener, CommandListener, TimerListene
$data = array($this->dedimaniaData->sessionId, $player->login, $player->rawNickname, $player->path, $player->isSpectator);
$content = $this->encode_request(self::DEDIMANIA_PLAYERCONNECT, $data);
$self = $this;
$this->maniaControl->fileReader->postData(self::DEDIMANIA_URL, function ($data, $error) use (&$self, &$player) {
$this->maniaControl->fileReader->postData(self::DEDIMANIA_URL, function ($data, $error) use (&$player) {
if ($error) {
$self->maniaControl->log("Dedimania Error: " . $error);
$this->maniaControl->log("Dedimania Error: " . $error);
}
$data = $self->decode($data);
$data = $this->decode($data);
if (!is_array($data) || empty($data)) {
return;
}
$methodResponse = $data[0];
if (xmlrpc_is_fault($methodResponse)) {
$self->handleXmlRpcFault($methodResponse, self::DEDIMANIA_PLAYERCONNECT);
$this->handleXmlRpcFault($methodResponse, self::DEDIMANIA_PLAYERCONNECT);
return;
}
$responseData = $methodResponse[0];
$dediPlayer = new DedimaniaPlayer($responseData);
$self->dedimaniaData->addPlayer($dediPlayer);
$this->dedimaniaData->addPlayer($dediPlayer);
// Fetch records if he is the first who joined the server
if ($self->maniaControl->playerManager->getPlayerCount(false) === 1) {
$self->fetchDedimaniaRecords(true);
if ($this->maniaControl->playerManager->getPlayerCount(false) === 1) {
$this->fetchDedimaniaRecords(true);
}
if ($self->maniaControl->settingManager->getSettingValue($self, self::SETTING_WIDGET_ENABLE)) {
$manialink = $self->buildManialink();
$self->maniaControl->manialinkManager->sendManialink($manialink, $player->login);
if ($this->maniaControl->settingManager->getSettingValue($this, self::SETTING_WIDGET_ENABLE)) {
$manialink = $this->buildManialink();
$this->maniaControl->manialinkManager->sendManialink($manialink, $player->login);
}
}, $content, true);
}
@ -613,20 +610,19 @@ class DedimaniaPlugin implements CallbackListener, CommandListener, TimerListene
$data = array($this->dedimaniaData->sessionId, $player->login, '');
$content = $this->encode_request(self::DEDIMANIA_PLAYERDISCONNECT, $data);
$self = $this;
$this->maniaControl->fileReader->postData(self::DEDIMANIA_URL, function ($data, $error) use (&$self) {
$this->maniaControl->fileReader->postData(self::DEDIMANIA_URL, function ($data, $error) {
if ($error) {
$self->maniaControl->log("Dedimania Error: " . $error);
$this->maniaControl->log("Dedimania Error: " . $error);
}
$data = $self->decode($data);
$data = $this->decode($data);
if (!is_array($data) || empty($data)) {
return;
}
$methodResponse = $data[0];
if (xmlrpc_is_fault($methodResponse)) {
$self->handleXmlRpcFault($methodResponse, self::DEDIMANIA_PLAYERDISCONNECT);
$this->handleXmlRpcFault($methodResponse, self::DEDIMANIA_PLAYERDISCONNECT);
}
}, $content, true);
}
@ -681,21 +677,19 @@ class DedimaniaPlugin implements CallbackListener, CommandListener, TimerListene
//var_dump($data);
$content = $this->encode_request(self::DEDIMANIA_SETCHALLENGETIMES, $data);
$self = $this;
$maniaControl = $this->maniaControl;
$this->maniaControl->fileReader->postData(self::DEDIMANIA_URL, function ($data, $error) use (&$self, &$maniaControl) {
$this->maniaControl->fileReader->postData(self::DEDIMANIA_URL, function ($data, $error) {
if ($error) {
$maniaControl->log("Dedimania Error: " . $error);
$this->maniaControl->log("Dedimania Error: " . $error);
}
$data = $self->decode($data);
$data = $this->decode($data);
if (!is_array($data) || empty($data)) {
return;
}
$methodResponse = $data[0];
if (xmlrpc_is_fault($methodResponse)) {
$self->handleXmlRpcFault($methodResponse, self::DEDIMANIA_SETCHALLENGETIMES);
$this->handleXmlRpcFault($methodResponse, self::DEDIMANIA_SETCHALLENGETIMES);
return;
}
@ -721,20 +715,19 @@ class DedimaniaPlugin implements CallbackListener, CommandListener, TimerListene
$data = array($this->dedimaniaData->sessionId, $serverInfo, $votesInfo, $playerList);
$content = $this->encode_request(self::DEDIMANIA_UPDATESERVERPLAYERS, $data);
$self = $this;
$this->maniaControl->fileReader->postData(self::DEDIMANIA_URL, function ($data, $error) use (&$self) {
$this->maniaControl->fileReader->postData(self::DEDIMANIA_URL, function ($data, $error) {
if ($error) {
$self->maniaControl->log("Dedimania Error: " . $error);
$this->maniaControl->log("Dedimania Error: " . $error);
}
$data = $self->decode($data);
$data = $this->decode($data);
if (!is_array($data) || empty($data)) {
return;
}
$methodResponse = $data[0];
if (xmlrpc_is_fault($methodResponse)) {
$self->handleXmlRpcFault($methodResponse, self::DEDIMANIA_UPDATESERVERPLAYERS);
$this->handleXmlRpcFault($methodResponse, self::DEDIMANIA_UPDATESERVERPLAYERS);
}
}, $content, true);
}

View File

@ -282,31 +282,30 @@ class DonationPlugin implements CallbackListener, CommandListener, Plugin {
}
//Send and Handle the Bill
$self = $this;
$this->maniaControl->billManager->sendBill(function ($data, $status) use (&$self, &$player, $amount, $receiver) {
$this->maniaControl->billManager->sendBill(function ($data, $status) use (&$player, $amount, $receiver) {
switch ($status) {
case BillManager::DONATED_TO_SERVER:
if ($self->maniaControl->settingManager->getSettingValue($self, DonationPlugin::SETTING_ANNOUNCE_SERVERDONATION, true) && $amount >= $self->maniaControl->settingManager->getSettingValue($self, DonationPlugin::SETTING_MIN_AMOUNT_SHOWN, true)) {
if ($this->maniaControl->settingManager->getSettingValue($this, DonationPlugin::SETTING_ANNOUNCE_SERVERDONATION, true) && $amount >= $this->maniaControl->settingManager->getSettingValue($this, DonationPlugin::SETTING_MIN_AMOUNT_SHOWN, true)) {
$login = null;
$message = '$<' . $player->nickname . '$> donated ' . $amount . ' Planets! Thanks.';
} else {
$login = $player->login;
$message = 'Donation successful! Thanks.';
}
$self->maniaControl->chat->sendSuccess($message, $login);
$self->maniaControl->statisticManager->insertStat(DonationPlugin::STAT_PLAYER_DONATIONS, $player, $self->maniaControl->server->index, $amount);
$this->maniaControl->chat->sendSuccess($message, $login);
$this->maniaControl->statisticManager->insertStat(DonationPlugin::STAT_PLAYER_DONATIONS, $player, $this->maniaControl->server->index, $amount);
break;
case BillManager::DONATED_TO_RECEIVER:
$message = "Successfully donated {$amount} to '{$receiver}'!";
$self->maniaControl->chat->sendSuccess($message, $player->login);
$this->maniaControl->chat->sendSuccess($message, $player->login);
break;
case BillManager::PLAYER_REFUSED_DONATION:
$message = 'Transaction cancelled.';
$self->maniaControl->chat->sendError($message, $player->login);
$this->maniaControl->chat->sendError($message, $player->login);
break;
case BillManager::ERROR_WHILE_TRANSACTION:
$message = $data;
$self->maniaControl->chat->sendError($message, $player->login);
$this->maniaControl->chat->sendError($message, $player->login);
break;
}
}, $player, $amount, $message);
@ -393,20 +392,19 @@ class DonationPlugin implements CallbackListener, CommandListener, Plugin {
}
$message = 'Payout from $<' . $this->maniaControl->client->getServerName() . '$>.';
$self = $this;
$this->maniaControl->billManager->sendPlanets(function ($data, $status) use (&$self, &$player, $amount, $receiver) {
$this->maniaControl->billManager->sendPlanets(function ($data, $status) use (&$player, $amount, $receiver) {
switch ($status) {
case BillManager::PAYED_FROM_SERVER:
$message = "Successfully payed out {$amount} to '{$receiver}'!";
$self->maniaControl->chat->sendSuccess($message, $player->login);
$this->maniaControl->chat->sendSuccess($message, $player->login);
break;
case BillManager::PLAYER_REFUSED_DONATION:
$message = 'Transaction cancelled.';
$self->maniaControl->chat->sendError($message, $player->login);
$this->maniaControl->chat->sendError($message, $player->login);
break;
case BillManager::ERROR_WHILE_TRANSACTION:
$message = $data;
$self->maniaControl->chat->sendError($message, $player->login);
$this->maniaControl->chat->sendError($message, $player->login);
break;
}
}, $receiver, $amount, $message);

View File

@ -253,24 +253,23 @@ class KarmaPlugin implements CallbackListener, TimerListener, Plugin {
$this->mxKarma['connectionInProgress'] = true;
$self = $this;
$this->maniaControl->fileReader->loadFile($query, function ($data, $error) use (&$self, $mxKarmaCode) {
$this->maniaControl->fileReader->loadFile($query, function ($data, $error) use ($mxKarmaCode) {
if (!$error) {
$data = json_decode($data);
if ($data->success) {
$self->mxKarma['session'] = $data->data;
$self->activateSession($mxKarmaCode);
$this->mxKarma['session'] = $data->data;
$this->activateSession($mxKarmaCode);
} else {
$self->maniaControl->log("Error while authenticating on Mania-Exchange Karma");
$this->maniaControl->log("Error while authenticating on Mania-Exchange Karma");
// TODO remove temp trigger
$self->maniaControl->errorHandler->triggerDebugNotice("Error while authenticating on Mania-Exchange Karma " . $data->data->message);
$self->mxKarma['connectionInProgress'] = false;
$this->maniaControl->errorHandler->triggerDebugNotice("Error while authenticating on Mania-Exchange Karma " . $data->data->message);
$this->mxKarma['connectionInProgress'] = false;
}
} else {
$self->maniaControl->log($error);
$this->maniaControl->log($error);
// TODO remove temp trigger
$self->maniaControl->errorHandler->triggerDebugNotice("Error while authenticating on Mania-Exchange Karma " . $error);
$self->mxKarma['connectionInProgress'] = false;
$this->maniaControl->errorHandler->triggerDebugNotice("Error while authenticating on Mania-Exchange Karma " . $error);
$this->mxKarma['connectionInProgress'] = false;
}
}, AsynchronousFileReader::CONTENT_TYPE_JSON, 1000);
}
@ -288,33 +287,32 @@ class KarmaPlugin implements CallbackListener, TimerListener, Plugin {
$query .= '?sessionKey=' . urlencode($this->mxKarma['session']->sessionKey);
$query .= '&activationHash=' . urlencode($hash);
$self = $this;
$this->maniaControl->fileReader->loadFile($query, function ($data, $error) use (&$self, $query) {
$this->maniaControl->fileReader->loadFile($query, function ($data, $error) use ($query) {
if (!$error) {
$data = json_decode($data);
if ($data->success && $data->data->activated) {
$self->maniaControl->log("Successfully authenticated on Mania-Exchange Karma");
$self->mxKarma['connectionInProgress'] = false;
$this->maniaControl->log("Successfully authenticated on Mania-Exchange Karma");
$this->mxKarma['connectionInProgress'] = false;
// Fetch the Mx Karma Votes
$self->getMxKarmaVotes();
$this->getMxKarmaVotes();
} else {
if ($data->data->message === "invalid hash") {
$permission = $self->maniaControl->settingManager->getSettingValue($this->maniaControl->authenticationManager, PluginMenu::SETTING_PERMISSION_CHANGE_PLUGIN_SETTINGS);
$self->maniaControl->chat->sendErrorToAdmins("Invalid Mania-Exchange Karma code in Karma Plugin specified!", $permission);
$permission = $this->maniaControl->settingManager->getSettingValue($this->maniaControl->authenticationManager, PluginMenu::SETTING_PERMISSION_CHANGE_PLUGIN_SETTINGS);
$this->maniaControl->chat->sendErrorToAdmins("Invalid Mania-Exchange Karma code in Karma Plugin specified!", $permission);
} else {
// TODO remove temp trigger
$self->maniaControl->errorHandler->triggerDebugNotice("Error while authenticating on Mania-Exchange Karma " . $data->data->message . " url Query " . $query);
$this->maniaControl->errorHandler->triggerDebugNotice("Error while authenticating on Mania-Exchange Karma " . $data->data->message . " url Query " . $query);
}
$self->maniaControl->log("Error while activating Mania-Exchange Karma Session: " . $data->data->message);
$self->mxKarma['connectionInProgress'] = false;
unset($self->mxKarma['session']);
$this->maniaControl->log("Error while activating Mania-Exchange Karma Session: " . $data->data->message);
$this->mxKarma['connectionInProgress'] = false;
unset($this->mxKarma['session']);
}
} else {
// TODO remove temp trigger
$self->maniaControl->errorHandler->triggerDebugNotice("Error while activating Mania-Exchange Karma Session: " . $error);
$self->maniaControl->log($error);
$self->mxKarma['connectionInProgress'] = false;
$this->maniaControl->errorHandler->triggerDebugNotice("Error while activating Mania-Exchange Karma Session: " . $error);
$this->maniaControl->log($error);
$this->mxKarma['connectionInProgress'] = false;
}
}, AsynchronousFileReader::CONTENT_TYPE_JSON, 1000);
}
@ -372,38 +370,37 @@ class KarmaPlugin implements CallbackListener, TimerListener, Plugin {
}
$content = json_encode($properties);
$self = $this;
$this->maniaControl->fileReader->postData(self::MX_KARMA_URL . self::MX_KARMA_GETMAPRATING . "?sessionKey=" . urlencode($this->mxKarma['session']->sessionKey), function ($data, $error) use (&$self, &$player) {
$this->maniaControl->fileReader->postData(self::MX_KARMA_URL . self::MX_KARMA_GETMAPRATING . "?sessionKey=" . urlencode($this->mxKarma['session']->sessionKey), function ($data, $error) use (&$player) {
if (!$error) {
$data = json_decode($data);
if ($data->success) {
// Fetch averages if its for the whole server
if (!$player) {
$self->mxKarma["voteCount"] = $data->data->votecount;
$self->mxKarma["voteAverage"] = $data->data->voteaverage;
$self->mxKarma["modeVoteCount"] = $data->data->modevotecount;
$self->mxKarma["modeVoteAverage"] = $data->data->modevoteaverage;
$this->mxKarma["voteCount"] = $data->data->votecount;
$this->mxKarma["voteAverage"] = $data->data->voteaverage;
$this->mxKarma["modeVoteCount"] = $data->data->modevotecount;
$this->mxKarma["modeVoteAverage"] = $data->data->modevoteaverage;
}
foreach ($data->data->votes as $votes) {
$self->mxKarma["votes"][$votes->login] = $votes->vote;
$this->mxKarma["votes"][$votes->login] = $votes->vote;
}
$self->updateManialink = true;
$self->maniaControl->callbackManager->triggerCallback($self::CB_KARMA_MXUPDATED, $self->mxKarma);
$self->maniaControl->log("MX-Karma Votes successfully fetched");
$this->updateManialink = true;
$this->maniaControl->callbackManager->triggerCallback(self::CB_KARMA_MXUPDATED, $this->mxKarma);
$this->maniaControl->log("MX-Karma Votes successfully fetched");
} else {
$self->maniaControl->log("Error while fetching votes: " . $data->data->message);
$this->maniaControl->log("Error while fetching votes: " . $data->data->message);
if ($data->data->message === 'invalid session') {
unset($this->mxKarma['session']);
return;
}
// TODO remove temp trigger
$self->maniaControl->errorHandler->triggerDebugNotice("Error while fetching votes: '{$data->data->message}' " . KarmaPlugin::MX_KARMA_URL . KarmaPlugin::MX_KARMA_SAVEVOTES . "?sessionKey=" . urlencode($self->mxKarma['session']->sessionKey));
$this->maniaControl->errorHandler->triggerDebugNotice("Error while fetching votes: '{$data->data->message}' " . KarmaPlugin::MX_KARMA_URL . KarmaPlugin::MX_KARMA_SAVEVOTES . "?sessionKey=" . urlencode($this->mxKarma['session']->sessionKey));
}
} else {
$self->maniaControl->log($error);
$this->maniaControl->log($error);
}
}, $content, false, AsynchronousFileReader::CONTENT_TYPE_JSON);
}
@ -482,23 +479,22 @@ class KarmaPlugin implements CallbackListener, TimerListener, Plugin {
$content = json_encode($properties);
$self = $this;
$this->maniaControl->fileReader->postData(self::MX_KARMA_URL . self::MX_KARMA_SAVEVOTES . "?sessionKey=" . urlencode($this->mxKarma['session']->sessionKey), function ($data, $error) use (&$self) {
$this->maniaControl->fileReader->postData(self::MX_KARMA_URL . self::MX_KARMA_SAVEVOTES . "?sessionKey=" . urlencode($this->mxKarma['session']->sessionKey), function ($data, $error) {
if (!$error) {
$data = json_decode($data);
if ($data->success) {
$self->maniaControl->log("Votes successfully submitted");
$this->maniaControl->log("Votes successfully submitted");
} else {
$self->maniaControl->log("Error while updating votes: " . $data->data->message);
$this->maniaControl->log("Error while updating votes: " . $data->data->message);
if ($data->data->message === "invalid session") {
unset($this->mxKarma['session']);
return;
}
// TODO remove temp trigger
$self->maniaControl->errorHandler->triggerDebugNotice("Error while updating votes: " . $data->data->message . " " . KarmaPlugin::MX_KARMA_URL . $self::MX_KARMA_SAVEVOTES . "?sessionKey=" . urlencode($self->mxKarma['session']->sessionKey));
$this->maniaControl->errorHandler->triggerDebugNotice("Error while updating votes: " . $data->data->message . " " . KarmaPlugin::MX_KARMA_URL . self::MX_KARMA_SAVEVOTES . "?sessionKey=" . urlencode($this->mxKarma['session']->sessionKey));
}
} else {
$self->maniaControl->log($error);
$this->maniaControl->log($error);
}
}, $content, false, AsynchronousFileReader::CONTENT_TYPE_JSON);
}

View File

@ -100,21 +100,21 @@ class ServerRankingPlugin implements Plugin, CallbackListener, CommandListener {
$this->initTables();
$maniaControl->settingManager->initSetting($this, self::SETTING_MIN_HITS_RATIO_RANKING, 100);
$maniaControl->settingManager->initSetting($this, self::SETTING_MIN_HITS_POINTS_RANKING, 15);
$this->maniaControl->settingManager->initSetting($this, self::SETTING_MIN_HITS_RATIO_RANKING, 100);
$this->maniaControl->settingManager->initSetting($this, self::SETTING_MIN_HITS_POINTS_RANKING, 15);
$maniaControl->settingManager->initSetting($this, self::SETTING_MIN_REQUIRED_RECORDS, 3);
$maniaControl->settingManager->initSetting($this, self::SETTING_MAX_STORED_RECORDS, 50);
$this->maniaControl->settingManager->initSetting($this, self::SETTING_MIN_REQUIRED_RECORDS, 3);
$this->maniaControl->settingManager->initSetting($this, self::SETTING_MAX_STORED_RECORDS, 50);
$script = $this->maniaControl->client->getScriptName();
if ($this->maniaControl->mapManager->getCurrentMap()->getGame() === 'tm') {
//TODO also add obstacle here as default
$maniaControl->settingManager->initSetting($this, self::SETTING_MIN_RANKING_TYPE, self::RANKING_TYPE_RECORDS);
$this->maniaControl->settingManager->initSetting($this, self::SETTING_MIN_RANKING_TYPE, self::RANKING_TYPE_RECORDS);
} else if ($script["CurrentValue"] === 'InstaDM.Script.txt') {
$maniaControl->settingManager->initSetting($this, self::SETTING_MIN_RANKING_TYPE, self::RANKING_TYPE_RATIOS);
$this->maniaControl->settingManager->initSetting($this, self::SETTING_MIN_RANKING_TYPE, self::RANKING_TYPE_RATIOS);
} else {
$maniaControl->settingManager->initSetting($this, self::SETTING_MIN_RANKING_TYPE, self::RANKING_TYPE_POINTS);
$this->maniaControl->settingManager->initSetting($this, self::SETTING_MIN_RANKING_TYPE, self::RANKING_TYPE_POINTS);
}
//Check if the type is Correct