From e560919096e341f52b9499ace19d1901a7ee93da Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Steffen=20Schro=CC=88der?= Date: Sat, 2 Aug 2014 22:31:46 +0200 Subject: [PATCH] changed direct public property access to using getter methods phpdoc improvements --- application/core/Admin/ActionsMenu.php | 11 ++- application/core/Admin/AdminLists.php | 10 +- application/core/Admin/AuthCommands.php | 1 + .../core/Admin/AuthenticationManager.php | 8 +- application/core/Bills/BillData.php | 1 - application/core/Bills/BillManager.php | 1 + .../core/Callbacks/LibXmlRpcCallbacks.php | 3 +- .../core/Callbacks/ShootManiaCallbacks.php | 5 +- application/core/Callbacks/TimerManager.php | 4 +- .../core/Callbacks/TrackManiaCallbacks.php | 3 +- application/core/Chat.php | 3 +- application/core/Commands/CommandManager.php | 1 + application/core/Commands/HelpManager.php | 11 ++- .../core/Configurator/Configurator.php | 1 + .../core/Configurator/ConfiguratorMenu.php | 6 +- .../Configurator/ManiaControlSettings.php | 1 + .../core/Configurator/ScriptSettings.php | 1 + application/core/Database/Config.php | 2 +- application/core/Database/Database.php | 5 +- application/core/Database/MigrationHelper.php | 1 + application/core/ErrorHandler.php | 5 +- .../core/Files/AsynchronousFileReader.php | 3 +- application/core/ManiaControl.php | 8 +- application/core/ManiaExchange/MXMapInfo.php | 3 + .../core/ManiaExchange/ManiaExchangeList.php | 17 ++-- .../ManiaExchange/ManiaExchangeManager.php | 3 +- .../core/Manialinks/CustomUIManager.php | 1 + application/core/Manialinks/IconManager.php | 5 +- .../core/Manialinks/ManialinkManager.php | 6 +- application/core/Manialinks/StyleManager.php | 3 +- application/core/Maps/DirectoryBrowser.php | 21 +++-- application/core/Maps/MapActions.php | 5 +- application/core/Maps/MapCommands.php | 27 +++--- application/core/Maps/MapList.php | 64 ++++++++----- application/core/Maps/MapManager.php | 24 +++-- application/core/Maps/MapQueue.php | 3 +- application/core/Players/Player.php | 3 +- application/core/Players/PlayerActions.php | 7 +- application/core/Players/PlayerCommands.php | 27 +++--- .../core/Players/PlayerDataManager.php | 7 +- application/core/Players/PlayerDetailed.php | 13 +-- application/core/Players/PlayerList.php | 49 +++++----- application/core/Players/PlayerManager.php | 94 +++++++++++++++---- application/core/Plugins/InstallMenu.php | 1 + application/core/Plugins/PluginManager.php | 1 + application/core/Plugins/PluginMenu.php | 1 + application/core/Server/Commands.php | 1 + application/core/Server/Directory.php | 3 +- application/core/Server/ScriptManager.php | 3 +- application/core/Server/Server.php | 19 +++- application/core/Server/ServerOptionsMenu.php | 1 + application/core/Server/UsageReporter.php | 3 +- application/core/Server/VoteRatiosMenu.php | 1 + .../core/Statistics/SimpleStatsList.php | 9 +- .../core/Statistics/StatisticCollector.php | 5 +- .../core/Statistics/StatisticManager.php | 31 +++++- .../core/Update/PluginUpdateManager.php | 1 + .../plugins/MCTeam/ChatMessagePlugin.php | 2 +- .../plugins/MCTeam/CustomVotesPlugin.php | 22 ++--- .../MCTeam/Dedimania/DedimaniaPlayer.php | 2 +- .../MCTeam/Dedimania/DedimaniaPlugin.php | 18 ++-- .../plugins/MCTeam/Dedimania/RecordData.php | 2 +- application/plugins/MCTeam/DonationPlugin.php | 18 ++-- .../MCTeam/DynamicPointLimitPlugin.php | 2 +- application/plugins/MCTeam/KarmaPlugin.php | 10 +- .../plugins/MCTeam/LocalRecordsPlugin.php | 16 ++-- .../plugins/MCTeam/ServerRankingPlugin.php | 12 +-- application/plugins/MCTeam/WidgetPlugin.php | 28 +++--- application/plugins/TheM/QueuePlugin.php | 12 +-- application/plugins/TheM/TeamSpeakPlugin.php | 20 ++-- 70 files changed, 450 insertions(+), 271 deletions(-) diff --git a/application/core/Admin/ActionsMenu.php b/application/core/Admin/ActionsMenu.php index 99b8169e..cfa44670 100644 --- a/application/core/Admin/ActionsMenu.php +++ b/application/core/Admin/ActionsMenu.php @@ -34,15 +34,16 @@ class ActionsMenu implements CallbackListener, ManialinkPageAnswerListener { const ACTION_OPEN_PLAYER_MENU = 'ActionsMenu.OpenPlayerMenu'; /* - * Private Properties + * Private properties */ + /** @var ManiaControl $maniaControl */ private $maniaControl = null; private $adminMenuItems = array(); private $playerMenuItems = array(); private $initCompleted = false; /** - * Create a new Actions Menu + * Construct a new Actions Menu instance * * @param ManiaControl $maniaControl */ @@ -116,9 +117,9 @@ class ActionsMenu implements CallbackListener, ManialinkPageAnswerListener { $posX = $this->maniaControl->settingManager->getSettingValue($this, self::SETTING_MENU_POSX); $posY = $this->maniaControl->settingManager->getSettingValue($this, self::SETTING_MENU_POSY); $itemSize = $this->maniaControl->settingManager->getSettingValue($this, self::SETTING_MENU_ITEMSIZE); - $shootManiaOffset = $this->maniaControl->manialinkManager->styleManager->getDefaultIconOffsetSM(); - $quadStyle = $this->maniaControl->manialinkManager->styleManager->getDefaultQuadStyle(); - $quadSubstyle = $this->maniaControl->manialinkManager->styleManager->getDefaultQuadSubstyle(); + $shootManiaOffset = $this->maniaControl->manialinkManager->getStyleManager()->getDefaultIconOffsetSM(); + $quadStyle = $this->maniaControl->manialinkManager->getStyleManager()->getDefaultQuadStyle(); + $quadSubstyle = $this->maniaControl->manialinkManager->getStyleManager()->getDefaultQuadSubstyle(); $itemMarginFactorX = 1.3; $itemMarginFactorY = 1.2; diff --git a/application/core/Admin/AdminLists.php b/application/core/Admin/AdminLists.php index d398fc0b..3ea0e40e 100644 --- a/application/core/Admin/AdminLists.php +++ b/application/core/Admin/AdminLists.php @@ -76,8 +76,8 @@ class AdminLists implements ManialinkPageAnswerListener, CallbackListener { public function showAdminLists(Player $player) { $this->adminListShown[$player->login] = true; - $width = $this->maniaControl->manialinkManager->styleManager->getListWidgetsWidth(); - $height = $this->maniaControl->manialinkManager->styleManager->getListWidgetsHeight(); + $width = $this->maniaControl->manialinkManager->getStyleManager()->getListWidgetsWidth(); + $height = $this->maniaControl->manialinkManager->getStyleManager()->getListWidgetsHeight(); // get Admins $admins = $this->maniaControl->authenticationManager->getAdmins(); @@ -89,7 +89,7 @@ class AdminLists implements ManialinkPageAnswerListener, CallbackListener { $script->addFeature($paging); // Main frame - $frame = $this->maniaControl->manialinkManager->styleManager->getDefaultListFrame($script, $paging); + $frame = $this->maniaControl->manialinkManager->getStyleManager()->getDefaultListFrame($script, $paging); $maniaLink->add($frame); // Start offsets @@ -97,7 +97,7 @@ class AdminLists implements ManialinkPageAnswerListener, CallbackListener { $posY = $height / 2; //Predefine description Label - $descriptionLabel = $this->maniaControl->manialinkManager->styleManager->getDefaultDescriptionLabel(); + $descriptionLabel = $this->maniaControl->manialinkManager->getStyleManager()->getDefaultDescriptionLabel(); $frame->add($descriptionLabel); // Headline @@ -207,7 +207,7 @@ class AdminLists implements ManialinkPageAnswerListener, CallbackListener { switch ($action) { case self::ACTION_REVOKE_RIGHTS: - $this->maniaControl->playerManager->playerActions->revokeAuthLevel($adminLogin, $targetLogin); + $this->maniaControl->playerManager->getPlayerActions()->revokeAuthLevel($adminLogin, $targetLogin); break; } } diff --git a/application/core/Admin/AuthCommands.php b/application/core/Admin/AuthCommands.php index 84b06f5f..594090f5 100644 --- a/application/core/Admin/AuthCommands.php +++ b/application/core/Admin/AuthCommands.php @@ -17,6 +17,7 @@ class AuthCommands implements CommandListener { /* * Private properties */ + /** @var ManiaControl $maniaControl */ private $maniaControl = null; /** diff --git a/application/core/Admin/AuthenticationManager.php b/application/core/Admin/AuthenticationManager.php index 537b021d..1b782b5e 100644 --- a/application/core/Admin/AuthenticationManager.php +++ b/application/core/Admin/AuthenticationManager.php @@ -33,15 +33,17 @@ class AuthenticationManager implements CallbackListener { const CB_AUTH_LEVEL_CHANGED = 'AuthenticationManager.AuthLevelChanged'; /* - * Private Properties + * Private properties */ + /** @var ManiaControl $maniaControl */ private $maniaControl = null; + /** @var AuthCommands $authCommands */ private $authCommands = null; /** - * Construct a new Authentication Manager + * Construct a new Authentication Manager instance * - * @param \ManiaControl\ManiaControl $maniaControl + * @param ManiaControl $maniaControl */ public function __construct(ManiaControl $maniaControl) { $this->maniaControl = $maniaControl; diff --git a/application/core/Bills/BillData.php b/application/core/Bills/BillData.php index 87dc56bf..3129bcb5 100644 --- a/application/core/Bills/BillData.php +++ b/application/core/Bills/BillData.php @@ -12,7 +12,6 @@ use ManiaControl\Players\Player; * @license http://www.gnu.org/licenses/ GNU General Public License, Version 3 */ class BillData { - /* * Public properties */ diff --git a/application/core/Bills/BillManager.php b/application/core/Bills/BillManager.php index e30d3095..2b9cd08b 100644 --- a/application/core/Bills/BillManager.php +++ b/application/core/Bills/BillManager.php @@ -28,6 +28,7 @@ class BillManager implements CallbackListener { /* * Private properties */ + /** @var ManiaControl $maniaControl */ private $maniaControl = null; private $openBills = array(); diff --git a/application/core/Callbacks/LibXmlRpcCallbacks.php b/application/core/Callbacks/LibXmlRpcCallbacks.php index 24984921..09ba08b8 100644 --- a/application/core/Callbacks/LibXmlRpcCallbacks.php +++ b/application/core/Callbacks/LibXmlRpcCallbacks.php @@ -13,8 +13,9 @@ use ManiaControl\ManiaControl; */ class LibXmlRpcCallbacks implements CallbackListener { /* - * Private Properties + * Private properties */ + /** @var ManiaControl $maniaControl */ private $maniaControl = null; /** diff --git a/application/core/Callbacks/ShootManiaCallbacks.php b/application/core/Callbacks/ShootManiaCallbacks.php index 32461e4c..8f36c4e3 100644 --- a/application/core/Callbacks/ShootManiaCallbacks.php +++ b/application/core/Callbacks/ShootManiaCallbacks.php @@ -22,8 +22,9 @@ class ShootManiaCallbacks implements CallbackListener { const CB_TIMEATTACK_ONFINISH = 'TimeAttack_OnFinish'; /* - * Private Properties + * Private properties */ + /** @var ManiaControl $maniaControl */ private $maniaControl = null; /** @@ -48,7 +49,7 @@ class ShootManiaCallbacks implements CallbackListener { public function handleScriptCallbacks($name, $data) { switch ($name) { case 'LibXmlRpc_Rankings': - $this->maniaControl->server->rankingManager->updateRankings($data[0]); + $this->maniaControl->server->getRankingManager()->updateRankings($data[0]); break; case 'LibXmlRpc_Scores': $this->maniaControl->callbackManager->triggerCallback(Callbacks::SCORES, $data[0]); diff --git a/application/core/Callbacks/TimerManager.php b/application/core/Callbacks/TimerManager.php index dfd241c1..6475e224 100644 --- a/application/core/Callbacks/TimerManager.php +++ b/application/core/Callbacks/TimerManager.php @@ -13,9 +13,11 @@ use ManiaControl\ManiaControl; */ class TimerManager { /* - * Private Properties + * Private properties */ + /** @var ManiaControl $maniaControl */ private $maniaControl = null; + /** @var TimerListening[] $timerListenings */ private $timerListenings = array(); /** diff --git a/application/core/Callbacks/TrackManiaCallbacks.php b/application/core/Callbacks/TrackManiaCallbacks.php index 7fb80616..0ab87b40 100644 --- a/application/core/Callbacks/TrackManiaCallbacks.php +++ b/application/core/Callbacks/TrackManiaCallbacks.php @@ -15,8 +15,9 @@ use ManiaControl\Utils\Formatter; */ class TrackManiaCallbacks implements CallbackListener { /* - * Private Properties + * Private properties */ + /** @var ManiaControl $maniaControl */ private $maniaControl = null; /** diff --git a/application/core/Chat.php b/application/core/Chat.php index f6a7ada5..c90ab5a3 100644 --- a/application/core/Chat.php +++ b/application/core/Chat.php @@ -24,8 +24,9 @@ class Chat { const SETTING_FORMAT_USAGEINFO = 'UsageInfo Format'; /* - * Private Properties + * Private properties */ + /** @var ManiaControl $maniaControl */ private $maniaControl = null; /** diff --git a/application/core/Commands/CommandManager.php b/application/core/Commands/CommandManager.php index 97497209..6b35621f 100644 --- a/application/core/Commands/CommandManager.php +++ b/application/core/Commands/CommandManager.php @@ -18,6 +18,7 @@ class CommandManager implements CallbackListener { /* * Private properties */ + /** @var ManiaControl $maniaControl */ private $maniaControl = null; /** @var HelpManager $helpManager */ private $helpManager = array(); diff --git a/application/core/Commands/HelpManager.php b/application/core/Commands/HelpManager.php index 339dfece..2ffaefdd 100644 --- a/application/core/Commands/HelpManager.php +++ b/application/core/Commands/HelpManager.php @@ -22,8 +22,9 @@ use ManiaControl\Players\Player; // TODO: refactor code - i see duplicated code all over the place.. class HelpManager implements CommandListener, CallbackListener { /* - * Private Properties + * Private properties */ + /** @var ManiaControl $maniaControl */ private $maniaControl = null; private $playerCommands = array(); private $adminCommands = array(); @@ -160,8 +161,8 @@ class HelpManager implements CommandListener, CallbackListener { * @param mixed $player */ private function showHelpAllList(array $commands, $player) { - $width = $this->maniaControl->manialinkManager->styleManager->getListWidgetsWidth(); - $height = $this->maniaControl->manialinkManager->styleManager->getListWidgetsHeight(); + $width = $this->maniaControl->manialinkManager->getStyleManager()->getListWidgetsWidth(); + $height = $this->maniaControl->manialinkManager->getStyleManager()->getListWidgetsHeight(); // create manialink $maniaLink = new ManiaLink(ManialinkManager::MAIN_MLID); @@ -170,7 +171,7 @@ class HelpManager implements CommandListener, CallbackListener { $script->addFeature($paging); // Main frame - $frame = $this->maniaControl->manialinkManager->styleManager->getDefaultListFrame($script, $paging); + $frame = $this->maniaControl->manialinkManager->getStyleManager()->getDefaultListFrame($script, $paging); $maniaLink->add($frame); // Start offsets @@ -178,7 +179,7 @@ class HelpManager implements CommandListener, CallbackListener { $posY = $height / 2; //Predefine description Label - $descriptionLabel = $this->maniaControl->manialinkManager->styleManager->getDefaultDescriptionLabel(); + $descriptionLabel = $this->maniaControl->manialinkManager->getStyleManager()->getDefaultDescriptionLabel(); $frame->add($descriptionLabel); // Headline diff --git a/application/core/Configurator/Configurator.php b/application/core/Configurator/Configurator.php index 6a956d7f..c77285b0 100644 --- a/application/core/Configurator/Configurator.php +++ b/application/core/Configurator/Configurator.php @@ -47,6 +47,7 @@ class Configurator implements CallbackListener, CommandListener, ManialinkPageAn /* * Private properties */ + /** @var ManiaControl $maniaControl */ private $maniaControl = null; /** @var ServerOptionsMenu $serverOptionsMenu */ private $serverOptionsMenu = null; diff --git a/application/core/Configurator/ConfiguratorMenu.php b/application/core/Configurator/ConfiguratorMenu.php index ff2fc0be..73a92c0a 100644 --- a/application/core/Configurator/ConfiguratorMenu.php +++ b/application/core/Configurator/ConfiguratorMenu.php @@ -15,14 +15,14 @@ use ManiaControl\Players\Player; interface ConfiguratorMenu { /** - * Get the Menu Title + * Get the menu title * * @return string */ public static function getTitle(); /** - * Get the Configurator Menu Frame + * Get the configurator menu frame * * @param float $width * @param float $height @@ -33,7 +33,7 @@ interface ConfiguratorMenu { public function getMenu($width, $height, Script $script, Player $player); /** - * Save the Config Data + * Save the config data * * @param array $configData * @param Player $player diff --git a/application/core/Configurator/ManiaControlSettings.php b/application/core/Configurator/ManiaControlSettings.php index 3c91cfd1..0d3055c6 100644 --- a/application/core/Configurator/ManiaControlSettings.php +++ b/application/core/Configurator/ManiaControlSettings.php @@ -40,6 +40,7 @@ class ManiaControlSettings implements ConfiguratorMenu, CallbackListener { /* * Private properties */ + /** @var ManiaControl $maniaControl */ private $maniaControl = null; /** diff --git a/application/core/Configurator/ScriptSettings.php b/application/core/Configurator/ScriptSettings.php index 36cea079..23be6ad8 100644 --- a/application/core/Configurator/ScriptSettings.php +++ b/application/core/Configurator/ScriptSettings.php @@ -39,6 +39,7 @@ class ScriptSettings implements ConfiguratorMenu, CallbackListener { /* * Private properties */ + /** @var ManiaControl $maniaControl */ private $maniaControl = null; /** diff --git a/application/core/Database/Config.php b/application/core/Database/Config.php index 36c0f9d9..4b49277c 100644 --- a/application/core/Database/Config.php +++ b/application/core/Database/Config.php @@ -11,7 +11,7 @@ namespace ManiaControl\Database; */ class Config { /* - * Public Properties + * Public properties */ public $host = null; public $port = null; diff --git a/application/core/Database/Database.php b/application/core/Database/Database.php index c4a7151e..37bde2b0 100644 --- a/application/core/Database/Database.php +++ b/application/core/Database/Database.php @@ -18,15 +18,16 @@ class Database implements TimerListener { */ /** @var \mysqli $mysqli */ public $mysqli = null; - /** @var MigrationHelper $migrationHelper */ - public $migrationHelper = null; /* * Private properties */ + /** @var ManiaControl $maniaControl */ private $maniaControl = null; /** @var Config $config */ private $config = null; + /** @var MigrationHelper $migrationHelper */ + private $migrationHelper = null; /** * Construct a new Database Connection diff --git a/application/core/Database/MigrationHelper.php b/application/core/Database/MigrationHelper.php index 073f9f51..afdd6edb 100644 --- a/application/core/Database/MigrationHelper.php +++ b/application/core/Database/MigrationHelper.php @@ -17,6 +17,7 @@ class MigrationHelper { /* * Private properties */ + /** @var ManiaControl $maniaControl */ private $maniaControl = null; /** diff --git a/application/core/ErrorHandler.php b/application/core/ErrorHandler.php index abbb2176..18d202e2 100644 --- a/application/core/ErrorHandler.php +++ b/application/core/ErrorHandler.php @@ -25,15 +25,16 @@ class ErrorHandler { const LOG_SUPPRESSED_ERRORS = false; /* - * Private Properties + * Private properties */ + /** @var ManiaControl $maniaControl */ private $maniaControl = null; private $handlingError = null; /** * Construct a new error handler instance * - * @param ManiaControl @maniaControl + * @param ManiaControl $maniaControl */ public function __construct(ManiaControl $maniaControl) { $this->maniaControl = $maniaControl; diff --git a/application/core/Files/AsynchronousFileReader.php b/application/core/Files/AsynchronousFileReader.php index 27b23479..0a582a5e 100644 --- a/application/core/Files/AsynchronousFileReader.php +++ b/application/core/Files/AsynchronousFileReader.php @@ -20,8 +20,9 @@ class AsynchronousFileReader { const CONTENT_TYPE_JSON = 'application/json'; /* - * Private Properties + * Private properties */ + /** @var ManiaControl $maniaControl */ private $maniaControl = null; /** @var Request[] $requests */ private $requests = array(); diff --git a/application/core/ManiaControl.php b/application/core/ManiaControl.php index 84bf4ae1..72f5e5a8 100644 --- a/application/core/ManiaControl.php +++ b/application/core/ManiaControl.php @@ -57,7 +57,7 @@ class ManiaControl implements CallbackListener, CommandListener, TimerListener { const SETTING_PERMISSION_RESTART = 'Restart ManiaControl'; /* - * Public Properties + * Public properties */ public $actionsMenu = null; public $authenticationManager = null; @@ -85,12 +85,12 @@ class ManiaControl implements CallbackListener, CommandListener, TimerListener { public $billManager = null; /* - * Private Properties + * Private properties */ private $requestQuitMessage = null; /** - * Construct ManiaControl + * Construct a new ManiaControl instance */ public function __construct() { $this->log('Loading ManiaControl v' . self::VERSION . ' ...'); @@ -339,7 +339,7 @@ class ManiaControl implements CallbackListener, CommandListener, TimerListener { $this->client->sendHideManialinkPage(); // Enable script callbacks - $this->server->scriptManager->enableScriptCallbacks(); + $this->server->getScriptManager()->enableScriptCallbacks(); } /** diff --git a/application/core/ManiaExchange/MXMapInfo.php b/application/core/ManiaExchange/MXMapInfo.php index 767dc068..8ecaa723 100644 --- a/application/core/ManiaExchange/MXMapInfo.php +++ b/application/core/ManiaExchange/MXMapInfo.php @@ -13,6 +13,9 @@ use ManiaControl\Utils\Formatter; * @license http://www.gnu.org/licenses/ GNU General Public License, Version 3 */ class MXMapInfo { + /* + * Public properties + */ public $prefix, $id, $uid, $name, $userid, $author, $uploaded, $updated, $type, $maptype; public $titlepack, $style, $envir, $mood, $dispcost, $lightmap, $modname, $exever; public $exebld, $routes, $length, $unlimiter, $laps, $difficulty, $lbrating, $trkvalue; diff --git a/application/core/ManiaExchange/ManiaExchangeList.php b/application/core/ManiaExchange/ManiaExchangeList.php index 39aced52..9fd06e39 100644 --- a/application/core/ManiaExchange/ManiaExchangeList.php +++ b/application/core/ManiaExchange/ManiaExchangeList.php @@ -43,8 +43,9 @@ class ManiaExchangeList implements CallbackListener, ManialinkPageAnswerListener const MAX_MX_MAPS_PER_PAGE = 14; /* - * Private Properties + * Private properties */ + /** @var ManiaControl $maniaControl */ private $maniaControl = null; private $mapListShown = array(); @@ -130,7 +131,7 @@ class ManiaExchangeList implements CallbackListener, ManialinkPageAnswerListener } // search for matching maps - $this->maniaControl->mapManager->mxManager->fetchMapsAsync(function (array $maps) use (&$player) { + $this->maniaControl->mapManager->getMXManager()->fetchMapsAsync(function (array $maps) use (&$player) { if (!$maps) { $this->maniaControl->chat->sendError('No maps found, or MX is down!', $player->login); return; @@ -148,8 +149,8 @@ class ManiaExchangeList implements CallbackListener, ManialinkPageAnswerListener */ private function showManiaExchangeList(array $maps, Player $player) { // Start offsets - $width = $this->maniaControl->manialinkManager->styleManager->getListWidgetsWidth(); - $height = $this->maniaControl->manialinkManager->styleManager->getListWidgetsHeight(); + $width = $this->maniaControl->manialinkManager->getStyleManager()->getListWidgetsWidth(); + $height = $this->maniaControl->manialinkManager->getStyleManager()->getListWidgetsHeight(); $posX = -$width / 2; $posY = $height / 2; @@ -160,11 +161,11 @@ class ManiaExchangeList implements CallbackListener, ManialinkPageAnswerListener $script->addFeature($paging); // Main frame - $frame = $this->maniaControl->manialinkManager->styleManager->getDefaultListFrame($script, $paging); + $frame = $this->maniaControl->manialinkManager->getStyleManager()->getDefaultListFrame($script, $paging); $maniaLink->add($frame); //Predefine description Label - $descriptionLabel = $this->maniaControl->manialinkManager->styleManager->getDefaultDescriptionLabel(); + $descriptionLabel = $this->maniaControl->manialinkManager->getStyleManager()->getDefaultDescriptionLabel(); $frame->add($descriptionLabel); // Headline @@ -210,8 +211,8 @@ class ManiaExchangeList implements CallbackListener, ManialinkPageAnswerListener $mxQuad = new Quad(); $mapFrame->add($mxQuad); $mxQuad->setSize(3, 3); - $mxQuad->setImage($this->maniaControl->manialinkManager->iconManager->getIcon(IconManager::MX_ICON)); - $mxQuad->setImageFocus($this->maniaControl->manialinkManager->iconManager->getIcon(IconManager::MX_ICON_MOVER)); + $mxQuad->setImage($this->maniaControl->manialinkManager->getIconManager()->getIcon(IconManager::MX_ICON)); + $mxQuad->setImageFocus($this->maniaControl->manialinkManager->getIconManager()->getIcon(IconManager::MX_ICON_MOVER)); $mxQuad->setX($posX + 56); $mxQuad->setUrl($map->pageurl); $mxQuad->setZ(0.01); diff --git a/application/core/ManiaExchange/ManiaExchangeManager.php b/application/core/ManiaExchange/ManiaExchangeManager.php index 28f63e00..38b7a400 100644 --- a/application/core/ManiaExchange/ManiaExchangeManager.php +++ b/application/core/ManiaExchange/ManiaExchangeManager.php @@ -44,8 +44,9 @@ class ManiaExchangeManager { const MIN_EXE_BUILD = "2014-04-01_00_00"; /* - * Private Properties + * Private properties */ + /** @var ManiaControl $maniaControl */ private $maniaControl = null; private $mxIdUidVector = array(); diff --git a/application/core/Manialinks/CustomUIManager.php b/application/core/Manialinks/CustomUIManager.php index a39719bc..8f1b0f8e 100644 --- a/application/core/Manialinks/CustomUIManager.php +++ b/application/core/Manialinks/CustomUIManager.php @@ -25,6 +25,7 @@ class CustomUIManager implements CallbackListener, TimerListener { /* * Private properties */ + /** @var ManiaControl $maniaControl */ private $maniaControl = null; /** @var customUI $customUI */ private $customUI = null; diff --git a/application/core/Manialinks/IconManager.php b/application/core/Manialinks/IconManager.php index 2686a266..4313ee3e 100644 --- a/application/core/Manialinks/IconManager.php +++ b/application/core/Manialinks/IconManager.php @@ -25,7 +25,7 @@ class IconManager implements CallbackListener { const DEFAULT_IMG_URL = 'http://images.maniacontrol.com/icons/'; const PRELOAD_MLID = 'IconManager.Preload.MLID'; - /** + /* * Default icons */ const MX_ICON = 'ManiaExchange.png'; @@ -34,9 +34,10 @@ class IconManager implements CallbackListener { const MX_ICON_GREEN = 'ManiaExchangeGreen.png'; const MX_ICON_GREEN_MOVER = 'ManiaExchange_logo_pressGreen.png'; - /** + /* * Private properties */ + /** @var ManiaControl $maniaControl */ private $maniaControl = null; private $icons = array(); diff --git a/application/core/Manialinks/ManialinkManager.php b/application/core/Manialinks/ManialinkManager.php index 1b18f0c9..53b0eac3 100644 --- a/application/core/Manialinks/ManialinkManager.php +++ b/application/core/Manialinks/ManialinkManager.php @@ -33,15 +33,19 @@ class ManialinkManager implements ManialinkPageAnswerListener, CallbackListener * Public properties */ /** @var StyleManager $styleManager */ + /** @deprecated see getStyleManager() */ public $styleManager = null; /** @var CustomUIManager $customUIManager */ + /** @deprecated see getCustomUIManager() */ public $customUIManager = null; /** @var IconManager $iconManager */ + /** @deprecated see getIconManager() */ public $iconManager = null; /* * Private properties */ + /** @var ManiaControl $maniaControl */ private $maniaControl = null; // TODO: use listening class private $pageAnswerListeners = array(); @@ -53,7 +57,7 @@ class ManialinkManager implements ManialinkPageAnswerListener, CallbackListener * @param ManiaControl $maniaControl */ public function __construct(ManiaControl $maniaControl) { - $this->maniaControl = $maniaControl; + $this->maniaControl = $maniaControl; // Children $this->styleManager = new StyleManager($maniaControl); diff --git a/application/core/Manialinks/StyleManager.php b/application/core/Manialinks/StyleManager.php index fee89181..e8261fc7 100644 --- a/application/core/Manialinks/StyleManager.php +++ b/application/core/Manialinks/StyleManager.php @@ -38,10 +38,11 @@ class StyleManager { /* * Private properties */ + /** @var ManiaControl $maniaControl */ private $maniaControl = null; /** - * Create a new style manager instance + * Construct a new style manager instance * * @param ManiaControl $maniaControl */ diff --git a/application/core/Maps/DirectoryBrowser.php b/application/core/Maps/DirectoryBrowser.php index 9caccde9..1dc3cdaf 100644 --- a/application/core/Maps/DirectoryBrowser.php +++ b/application/core/Maps/DirectoryBrowser.php @@ -43,10 +43,11 @@ class DirectoryBrowser implements ManialinkPageAnswerListener { /* * Private properties */ + /** @var ManiaControl $maniaControl */ private $maniaControl = null; /** - * Create a new directory browser instance + * Construct a new directory browser instance * * @param ManiaControl $maniaControl */ @@ -93,7 +94,7 @@ class DirectoryBrowser implements ManialinkPageAnswerListener { $oldFolderPath = $player->getCache($this, self::CACHE_FOLDER_PATH); $isInMapsFolder = false; if (!$oldFolderPath) { - $oldFolderPath = $this->maniaControl->server->directory->getMapsFolder(); + $oldFolderPath = $this->maniaControl->server->getDirectory()->getMapsFolder(); $isInMapsFolder = true; } $folderPath = $oldFolderPath; @@ -104,12 +105,12 @@ class DirectoryBrowser implements ManialinkPageAnswerListener { $folderName = basename($newFolderPath); switch ($folderName) { case 'Maps': - $mapsDir = dirname($this->maniaControl->server->directory->getMapsFolder()); + $mapsDir = dirname($this->maniaControl->server->getDirectory()->getMapsFolder()); $folderDir = dirname($folderPath); $isInMapsFolder = ($mapsDir === $folderDir); break; case 'UserData': - $dataDir = dirname($this->maniaControl->server->directory->getGameDataFolder()); + $dataDir = dirname($this->maniaControl->server->getDirectory()->getGameDataFolder()); $folderDir = dirname($folderPath); if ($dataDir === $folderDir) { // Prevent navigation out of maps directory @@ -125,11 +126,11 @@ class DirectoryBrowser implements ManialinkPageAnswerListener { $script = $maniaLink->getScript(); $paging = new Paging(); $script->addFeature($paging); - $frame = $this->maniaControl->manialinkManager->styleManager->getDefaultListFrame($script, $paging); + $frame = $this->maniaControl->manialinkManager->getStyleManager()->getDefaultListFrame($script, $paging); $maniaLink->add($frame); - $width = $this->maniaControl->manialinkManager->styleManager->getListWidgetsWidth(); - $height = $this->maniaControl->manialinkManager->styleManager->getListWidgetsHeight(); + $width = $this->maniaControl->manialinkManager->getStyleManager()->getListWidgetsWidth(); + $height = $this->maniaControl->manialinkManager->getStyleManager()->getListWidgetsHeight(); $index = 0; $posY = $height / 2 - 10; $pageFrame = null; @@ -153,7 +154,7 @@ class DirectoryBrowser implements ManialinkPageAnswerListener { $directoryLabel = new Label_Text(); $frame->add($directoryLabel); - $dataFolder = $this->maniaControl->server->directory->getGameDataFolder(); + $dataFolder = $this->maniaControl->server->getDirectory()->getGameDataFolder(); $directoryText = substr($folderPath, strlen($dataFolder)); $directoryLabel->setPosition($width * -0.41, $height * 0.45) ->setSize($width * 0.85, 4) @@ -368,7 +369,7 @@ class DirectoryBrowser implements ManialinkPageAnswerListener { $folderPath = $player->getCache($this, self::CACHE_FOLDER_PATH); $filePath = $folderPath . $fileName; - $mapsFolder = $this->maniaControl->server->directory->getMapsFolder(); + $mapsFolder = $this->maniaControl->server->getDirectory()->getMapsFolder(); $relativeFilePath = substr($filePath, strlen($mapsFolder)); // Check for valid map @@ -401,7 +402,7 @@ class DirectoryBrowser implements ManialinkPageAnswerListener { $this->maniaControl->log($message, true); // Queue requested Map - $this->maniaControl->mapManager->mapQueue->addMapToMapQueue($player, $map); + $this->maniaControl->mapManager->getMapQueue()->addMapToMapQueue($player, $map); } /** diff --git a/application/core/Maps/MapActions.php b/application/core/Maps/MapActions.php index 45a3bef8..7c42774b 100644 --- a/application/core/Maps/MapActions.php +++ b/application/core/Maps/MapActions.php @@ -16,6 +16,7 @@ class MapActions { /* * Private properties */ + /** @var ManiaControl $maniaControl */ private $maniaControl = null; /** @@ -32,10 +33,10 @@ class MapActions { */ public function skipMap() { //Force a EndMap on the MapQueue to set the next Map - $this->maniaControl->mapManager->mapQueue->endMap(null); + $this->maniaControl->mapManager->getMapQueue()->endMap(null); //ignore EndMap on MapQueue - $this->maniaControl->mapManager->mapQueue->dontQueueNextMapChange(); + $this->maniaControl->mapManager->getMapQueue()->dontQueueNextMapChange(); //Switch The Map try { diff --git a/application/core/Maps/MapCommands.php b/application/core/Maps/MapCommands.php index 1243ce2e..9df03b5b 100644 --- a/application/core/Maps/MapCommands.php +++ b/application/core/Maps/MapCommands.php @@ -36,6 +36,7 @@ class MapCommands implements CommandListener, ManialinkPageAnswerListener, Callb /* * Private properties */ + /** @var ManiaControl $maniaControl */ private $maniaControl = null; /** @@ -77,8 +78,8 @@ class MapCommands implements CommandListener, ManialinkPageAnswerListener, Callb private function initActionsMenuButtons() { // Menu Open xList $itemQuad = new Quad(); - $itemQuad->setImage($this->maniaControl->manialinkManager->iconManager->getIcon(IconManager::MX_ICON)); - $itemQuad->setImageFocus($this->maniaControl->manialinkManager->iconManager->getIcon(IconManager::MX_ICON_MOVER)); + $itemQuad->setImage($this->maniaControl->manialinkManager->getIconManager()->getIcon(IconManager::MX_ICON)); + $itemQuad->setImageFocus($this->maniaControl->manialinkManager->getIconManager()->getIcon(IconManager::MX_ICON_MOVER)); $itemQuad->setAction(self::ACTION_OPEN_XLIST); $this->maniaControl->actionsMenu->addPlayerMenuItem($itemQuad, 5, 'Open MX List'); @@ -108,7 +109,7 @@ class MapCommands implements CommandListener, ManialinkPageAnswerListener, Callb * @param Player $player */ public function command_ShowNextMap(array $chatCallback, Player $player) { - $nextQueued = $this->maniaControl->mapManager->mapQueue->getNextQueuedMap(); + $nextQueued = $this->maniaControl->mapManager->getMapQueue()->getNextQueuedMap(); if ($nextQueued) { /** @var Player $requester */ $requester = $nextQueued[0]; @@ -216,7 +217,7 @@ class MapCommands implements CommandListener, ManialinkPageAnswerListener, Callb return; } - $this->maniaControl->mapManager->mapActions->skipMap(); + $this->maniaControl->mapManager->getMapActions()->skipMap(); $message = '$<' . $player->nickname . '$> skipped the current Map!'; $this->maniaControl->chat->sendSuccess($message); @@ -260,7 +261,7 @@ class MapCommands implements CommandListener, ManialinkPageAnswerListener, Callb $this->maniaControl->chat->sendSuccess($message); $this->maniaControl->log($message, true); - $this->maniaControl->mapManager->mapQueue->addFirstMapToMapQueue($player, $this->maniaControl->mapManager->getCurrentMap()); + $this->maniaControl->mapManager->getMapQueue()->addFirstMapToMapQueue($player, $this->maniaControl->mapManager->getCurrentMap()); } /** @@ -347,7 +348,7 @@ class MapCommands implements CommandListener, ManialinkPageAnswerListener, Callb if (strstr($actionId, self::ACTION_SHOW_AUTHOR)) { $login = str_replace(self::ACTION_SHOW_AUTHOR, '', $actionId); - $this->maniaControl->mapManager->mapList->playerCloseWidget($player); + $this->maniaControl->mapManager->getMapList()->playerCloseWidget($player); $this->showMapListAuthor($login, $player); } } @@ -373,7 +374,7 @@ class MapCommands implements CommandListener, ManialinkPageAnswerListener, Callb return; } - $this->maniaControl->mapManager->mapList->showMapList($player, $mapList); + $this->maniaControl->mapManager->getMapList()->showMapList($player, $mapList); } /** @@ -384,7 +385,7 @@ class MapCommands implements CommandListener, ManialinkPageAnswerListener, Callb */ public function command_List(array $chatCallback, Player $player) { $chatCommands = explode(' ', $chatCallback[1][2]); - $this->maniaControl->mapManager->mapList->playerCloseWidget($player); + $this->maniaControl->mapManager->getMapList()->playerCloseWidget($player); if (isset($chatCommands[1])) { $listParam = strtolower($chatCommands[1]); @@ -409,11 +410,11 @@ class MapCommands implements CommandListener, ManialinkPageAnswerListener, Callb } break; default: - $this->maniaControl->mapManager->mapList->showMapList($player); + $this->maniaControl->mapManager->getMapList()->showMapList($player); break; } } else { - $this->maniaControl->mapManager->mapList->showMapList($player); + $this->maniaControl->mapManager->getMapList()->showMapList($player); } } @@ -462,7 +463,7 @@ class MapCommands implements CommandListener, ManialinkPageAnswerListener, Callb $mapList = array_reverse($mapList); } - $this->maniaControl->mapManager->mapList->showMapList($player, $mapList); + $this->maniaControl->mapManager->getMapList()->showMapList($player, $mapList); } else { $this->maniaControl->chat->sendError('KarmaPlugin is not enabled!', $player->login); } @@ -484,7 +485,7 @@ class MapCommands implements CommandListener, ManialinkPageAnswerListener, Callb $maps = array_reverse($maps); } - $this->maniaControl->mapManager->mapList->showMapList($player, $maps); + $this->maniaControl->mapManager->getMapList()->showMapList($player, $maps); } /** @@ -494,6 +495,6 @@ class MapCommands implements CommandListener, ManialinkPageAnswerListener, Callb * @param Player $player */ public function command_xList(array $chatCallback, Player $player) { - $this->maniaControl->mapManager->mxList->showList($chatCallback, $player); + $this->maniaControl->mapManager->getMXList()->showList($chatCallback, $player); } } diff --git a/application/core/Maps/MapList.php b/application/core/Maps/MapList.php index 7c1f91b8..a49235af 100644 --- a/application/core/Maps/MapList.php +++ b/application/core/Maps/MapList.php @@ -59,6 +59,7 @@ class MapList implements ManialinkPageAnswerListener, CallbackListener { /* * Private properties */ + /** @var ManiaControl $maniaControl */ private $maniaControl = null; /** @@ -90,7 +91,8 @@ class MapList implements ManialinkPageAnswerListener, CallbackListener { */ public function clearMapQueue(array $chatCallback, Player $player) { // Clears the Map Queue - $this->maniaControl->mapManager->mapQueue->clearMapQueue($player); + $this->maniaControl->mapManager->getMapQueue() + ->clearMapQueue($player); } /** @@ -101,7 +103,7 @@ class MapList implements ManialinkPageAnswerListener, CallbackListener { */ public function checkUpdates(array $chatCallback, Player $player) { // Update Mx Infos - $this->maniaControl->mapManager->mxManager->fetchManiaExchangeMapInformation(); + $this->maniaControl->mapManager->getMXManager()->fetchManiaExchangeMapInformation(); // Reshow the Maplist $this->showMapList($player); @@ -115,14 +117,17 @@ class MapList implements ManialinkPageAnswerListener, CallbackListener { * @param int $pageIndex */ public function showMapList(Player $player, $mapList = null, $pageIndex = -1) { - $width = $this->maniaControl->manialinkManager->styleManager->getListWidgetsWidth(); - $height = $this->maniaControl->manialinkManager->styleManager->getListWidgetsHeight(); + $width = $this->maniaControl->manialinkManager->getStyleManager() + ->getListWidgetsWidth(); + $height = $this->maniaControl->manialinkManager->getStyleManager() + ->getListWidgetsHeight(); if ($pageIndex < 0) { $pageIndex = (int)$player->getCache($this, self::CACHE_CURRENT_PAGE); } $player->setCache($this, self::CACHE_CURRENT_PAGE, $pageIndex); - $queueBuffer = $this->maniaControl->mapManager->mapQueue->getQueueBuffer(); + $queueBuffer = $this->maniaControl->mapManager->getMapQueue() + ->getQueueBuffer(); $chunkIndex = $this->getChunkIndexFromPageNumber($pageIndex); $mapsBeginIndex = $this->getChunkMapsBeginIndex($chunkIndex); @@ -146,7 +151,8 @@ class MapList implements ManialinkPageAnswerListener, CallbackListener { $paging->setChunkActions(self::ACTION_PAGING_CHUNKS); // Main frame - $frame = $this->maniaControl->manialinkManager->styleManager->getDefaultListFrame($script, $paging); + $frame = $this->maniaControl->manialinkManager->getStyleManager() + ->getDefaultListFrame($script, $paging); $maniaLink->add($frame); // Admin Buttons @@ -188,8 +194,10 @@ class MapList implements ManialinkPageAnswerListener, CallbackListener { $mxQuad = new Quad(); $frame->add($mxQuad); $mxQuad->setSize(3, 3); - $mxQuad->setImage($this->maniaControl->manialinkManager->iconManager->getIcon(IconManager::MX_ICON_GREEN)); - $mxQuad->setImageFocus($this->maniaControl->manialinkManager->iconManager->getIcon(IconManager::MX_ICON_GREEN_MOVER)); + $mxQuad->setImage($this->maniaControl->manialinkManager->getIconManager() + ->getIcon(IconManager::MX_ICON_GREEN)); + $mxQuad->setImageFocus($this->maniaControl->manialinkManager->getIconManager() + ->getIcon(IconManager::MX_ICON_GREEN_MOVER)); $mxQuad->setPosition($width / 2 - 67, -$height / 2 + 9); $mxQuad->setZ(0.01); $mxQuad->setAction(self::ACTION_CHECK_UPDATE); @@ -220,10 +228,12 @@ class MapList implements ManialinkPageAnswerListener, CallbackListener { $this->maniaControl->manialinkManager->labelLine($headFrame, $array); // Predefine description Label - $descriptionLabel = $this->maniaControl->manialinkManager->styleManager->getDefaultDescriptionLabel(); + $descriptionLabel = $this->maniaControl->manialinkManager->getStyleManager() + ->getDefaultDescriptionLabel(); $frame->add($descriptionLabel); - $queuedMaps = $this->maniaControl->mapManager->mapQueue->getQueuedMapsRanking(); + $queuedMaps = $this->maniaControl->mapManager->getMapQueue() + ->getQueuedMapsRanking(); /** @var KarmaPlugin $karmaPlugin */ $karmaPlugin = $this->maniaControl->pluginManager->getPlugin(self::DEFAULT_KARMA_PLUGIN); @@ -236,10 +246,14 @@ class MapList implements ManialinkPageAnswerListener, CallbackListener { $pageFrame = null; $currentMap = $this->maniaControl->mapManager->getCurrentMap(); - $mxIcon = $this->maniaControl->manialinkManager->iconManager->getIcon(IconManager::MX_ICON); - $mxIconHover = $this->maniaControl->manialinkManager->iconManager->getIcon(IconManager::MX_ICON_MOVER); - $mxIconGreen = $this->maniaControl->manialinkManager->iconManager->getIcon(IconManager::MX_ICON_GREEN); - $mxIconGreenHover = $this->maniaControl->manialinkManager->iconManager->getIcon(IconManager::MX_ICON_GREEN_MOVER); + $mxIcon = $this->maniaControl->manialinkManager->getIconManager() + ->getIcon(IconManager::MX_ICON); + $mxIconHover = $this->maniaControl->manialinkManager->getIconManager() + ->getIcon(IconManager::MX_ICON_MOVER); + $mxIconGreen = $this->maniaControl->manialinkManager->getIconManager() + ->getIcon(IconManager::MX_ICON_GREEN); + $mxIconGreenHover = $this->maniaControl->manialinkManager->getIconManager() + ->getIcon(IconManager::MX_ICON_GREEN_MOVER); foreach ($mapList as $map) { /** @var Map $map */ @@ -332,7 +346,8 @@ class MapList implements ManialinkPageAnswerListener, CallbackListener { $label->setTextColor('fff'); // Checks if the Player who opened the Widget has queued the map - $queuer = $this->maniaControl->mapManager->mapQueue->getQueuer($map->uid); + $queuer = $this->maniaControl->mapManager->getMapQueue() + ->getQueuer($map->uid); if ($queuer->login == $player->login) { $description = 'Remove $<' . $map->name . '$> from the Map Queue'; $label->addTooltipLabelFeature($descriptionLabel, $description); @@ -520,9 +535,12 @@ class MapList implements ManialinkPageAnswerListener, CallbackListener { // TODO: get rid of the confirm frame to decrease xml size & network usage // SUGGESTION: just send them as own manialink again on clicking? - $width = $this->maniaControl->manialinkManager->styleManager->getListWidgetsWidth(); - $quadStyle = $this->maniaControl->manialinkManager->styleManager->getDefaultMainWindowStyle(); - $quadSubstyle = $this->maniaControl->manialinkManager->styleManager->getDefaultMainWindowSubStyle(); + $width = $this->maniaControl->manialinkManager->getStyleManager() + ->getListWidgetsWidth(); + $quadStyle = $this->maniaControl->manialinkManager->getStyleManager() + ->getDefaultMainWindowStyle(); + $quadSubstyle = $this->maniaControl->manialinkManager->getStyleManager() + ->getDefaultMainWindowSubStyle(); $confirmFrame = new Frame(); $maniaLink->add($confirmFrame); @@ -615,7 +633,7 @@ class MapList implements ManialinkPageAnswerListener, CallbackListener { break; case self::ACTION_SWITCH_MAP: // Don't queue on Map-Change - $this->maniaControl->mapManager->mapQueue->dontQueueNextMapChange(); + $this->maniaControl->mapManager->getMapQueue()->dontQueueNextMapChange(); try { $this->maniaControl->client->jumpToMapIdent($mapUid); } catch (NextMapException $exception) { @@ -649,7 +667,7 @@ class MapList implements ManialinkPageAnswerListener, CallbackListener { $votesPlugin->undefineVote('switchmap'); //Don't queue on Map-Change - $this->maniaControl->mapManager->mapQueue->dontQueueNextMapChange(); + $this->maniaControl->mapManager->getMapQueue()->dontQueueNextMapChange(); try { $this->maniaControl->client->JumpToMapIdent($map->uid); @@ -666,11 +684,13 @@ class MapList implements ManialinkPageAnswerListener, CallbackListener { }); break; case self::ACTION_QUEUED_MAP: - $this->maniaControl->mapManager->mapQueue->addMapToMapQueue($callback[1][1], $mapUid); + $this->maniaControl->mapManager->getMapQueue() + ->addMapToMapQueue($callback[1][1], $mapUid); $this->showMapList($player); break; case self::ACTION_UNQUEUE_MAP: - $this->maniaControl->mapManager->mapQueue->removeFromMapQueue($player, $mapUid); + $this->maniaControl->mapManager->getMapQueue() + ->removeFromMapQueue($player, $mapUid); $this->showMapList($player); break; default: diff --git a/application/core/Maps/MapManager.php b/application/core/Maps/MapManager.php index 7d406038..544f2b48 100644 --- a/application/core/Maps/MapManager.php +++ b/application/core/Maps/MapManager.php @@ -51,18 +51,25 @@ class MapManager implements CallbackListener { * Public properties */ /** @var MapQueue $mapQueue */ + /** @deprecated see getMapQueue() */ public $mapQueue = null; /** @var MapCommands $mapCommands */ + /** @deprecated see getMapCommands() */ public $mapCommands = null; /** @var MapActions $mapActions */ + /** @deprecated see getMapActions() */ public $mapActions = null; /** @var MapList $mapList */ + /** @deprecated see getMapList() */ public $mapList = null; /** @var DirectoryBrowser $directoryBrowser */ + /** @deprecated see getDirectoryBrowser() */ public $directoryBrowser = null; /** @var ManiaExchangeList $mxList */ + /** @deprecated see getMXList() */ public $mxList = null; /** @var ManiaExchangeManager $mxManager */ + /** @deprecated see getMXManager() */ public $mxManager = null; /* @@ -275,10 +282,10 @@ class MapManager implements CallbackListener { $map = $this->maps[$uid]; // Unset the Map everywhere - $this->mapQueue->removeFromMapQueue($admin, $map->uid); + $this->getMapQueue()->removeFromMapQueue($admin, $map->uid); if ($map->mx) { - $this->mxManager->unsetMap($map->mx->id); + $this->getMXManager()->unsetMap($map->mx->id); } // Remove map @@ -323,7 +330,7 @@ class MapManager implements CallbackListener { public function addMapFromMx($mapId, $login, $update = false) { if (is_numeric($mapId)) { // Check if map exists - $this->maniaControl->mapManager->mxManager->fetchMapInfo($mapId, function (MXMapInfo $mapInfo = null) use ( + $this->maniaControl->mapManager->getMXManager()->fetchMapInfo($mapId, function (MXMapInfo $mapInfo = null) use ( &$login, &$update ) { if (!$mapInfo || !isset($mapInfo->uploaded)) { @@ -369,7 +376,8 @@ class MapManager implements CallbackListener { $downloadFolderName = $this->maniaControl->settingManager->getSettingValue($this, 'MapDownloadDirectory', 'MX'); $relativeMapFileName = $downloadFolderName . DIRECTORY_SEPARATOR . $fileName; - $mapDir = $this->maniaControl->server->directory->getMapsFolder(); + $mapDir = $this->maniaControl->server->getDirectory() + ->getMapsFolder(); $downloadDirectory = $mapDir . $downloadFolderName . DIRECTORY_SEPARATOR; $fullMapFileName = $downloadDirectory . $fileName; @@ -421,7 +429,7 @@ class MapManager implements CallbackListener { $this->updateFullMapList(); // Update Mx MapInfo - $this->maniaControl->mapManager->mxManager->updateMapObjectsWithManiaExchangeIds(array($mapInfo)); + $this->maniaControl->mapManager->getMXManager()->updateMapObjectsWithManiaExchangeIds(array($mapInfo)); // Update last updated time $map = $this->getMapByUid($mapInfo->uid); @@ -441,7 +449,7 @@ class MapManager implements CallbackListener { $this->maniaControl->chat->sendSuccess($message); $this->maniaControl->log($message, true); // Queue requested Map - $this->maniaControl->mapManager->mapQueue->addMapToMapQueue($login, $mapInfo->uid); + $this->maniaControl->mapManager->getMapQueue()->addMapToMapQueue($login, $mapInfo->uid); } else { $message = '$<' . $player->nickname . '$> updated $<' . $mapInfo->name . '$>!'; $this->maniaControl->chat->sendSuccess($message); @@ -721,7 +729,7 @@ class MapManager implements CallbackListener { */ public function handleAfterInit() { // Fetch MX infos - $this->mxManager->fetchManiaExchangeMapInformation(); + $this->getMXManager()->fetchManiaExchangeMapInformation(); } /** @@ -766,7 +774,7 @@ class MapManager implements CallbackListener { $this->restructureMapList(); // Update the mx of the map (for update checks, etc.) - $this->mxManager->fetchManiaExchangeMapInformation($this->currentMap); + $this->getMXManager()->fetchManiaExchangeMapInformation($this->currentMap); // Trigger own BeginMap callback $this->maniaControl->callbackManager->triggerCallback(Callbacks::BEGINMAP, $this->currentMap); diff --git a/application/core/Maps/MapQueue.php b/application/core/Maps/MapQueue.php index 88d04e19..3a00cbbf 100644 --- a/application/core/Maps/MapQueue.php +++ b/application/core/Maps/MapQueue.php @@ -38,6 +38,7 @@ class MapQueue implements CallbackListener, CommandListener { /* * Private properties */ + /** @var ManiaControl $maniaControl */ private $maniaControl = null; private $queuedMaps = array(); private $nextMap = null; @@ -192,7 +193,7 @@ class MapQueue implements CallbackListener, CommandListener { array_push($maps, $queuedMap[1]); } - $this->maniaControl->mapManager->mapList->showMapList($player, $maps); + $this->maniaControl->mapManager->getMapList()->showMapList($player, $maps); } /** diff --git a/application/core/Players/Player.php b/application/core/Players/Player.php index d3baed06..d2eb5a08 100644 --- a/application/core/Players/Player.php +++ b/application/core/Players/Player.php @@ -61,8 +61,9 @@ class Player { public $currentTargetId = 0; /* - * Private Properties + * Private properties */ + /** @var ManiaControl $maniaControl */ private $maniaControl = null; private $cache = array(); diff --git a/application/core/Players/PlayerActions.php b/application/core/Players/PlayerActions.php index 8272fe40..b8921657 100644 --- a/application/core/Players/PlayerActions.php +++ b/application/core/Players/PlayerActions.php @@ -48,8 +48,9 @@ class PlayerActions { const SETTING_PERMISSION_BAN_PLAYER = 'Ban Player'; /* - * Private Properties + * Private properties */ + /** @var ManiaControl $maniaControl */ private $maniaControl = null; /** @@ -302,8 +303,8 @@ class PlayerActions { // Build Manialink $width = 80; $height = 50; - $quadStyle = $this->maniaControl->manialinkManager->styleManager->getDefaultMainWindowStyle(); - $quadSubstyle = $this->maniaControl->manialinkManager->styleManager->getDefaultMainWindowSubStyle(); + $quadStyle = $this->maniaControl->manialinkManager->getStyleManager()->getDefaultMainWindowStyle(); + $quadSubstyle = $this->maniaControl->manialinkManager->getStyleManager()->getDefaultMainWindowSubStyle(); $maniaLink = new ManiaLink(ManialinkManager::MAIN_MLID); $frame = new Frame(); diff --git a/application/core/Players/PlayerCommands.php b/application/core/Players/PlayerCommands.php index 32981272..8541ff71 100644 --- a/application/core/Players/PlayerCommands.php +++ b/application/core/Players/PlayerCommands.php @@ -30,8 +30,9 @@ class PlayerCommands implements CommandListener, ManialinkPageAnswerListener, Ca const SETTING_PERMISSION_TEAM_BALANCE = 'Balance Teams'; /* - * Private Properties + * Private properties */ + /** @var ManiaControl $maniaControl */ private $maniaControl = null; /** @@ -133,7 +134,7 @@ class PlayerCommands implements CommandListener, ManialinkPageAnswerListener, Ca if (isset($params[2])) { $message = $params[2]; } - $this->maniaControl->playerManager->playerActions->kickPlayer($player->login, $targetLogin, $message); + $this->maniaControl->playerManager->getPlayerActions()->kickPlayer($player->login, $targetLogin, $message); } /** @@ -157,7 +158,7 @@ class PlayerCommands implements CommandListener, ManialinkPageAnswerListener, Ca if (isset($params[2])) { $message = $params[2]; } - $this->maniaControl->playerManager->playerActions->banPlayer($player->login, $targetLogin, $message); + $this->maniaControl->playerManager->getPlayerActions()->banPlayer($player->login, $targetLogin, $message); } /** @@ -173,7 +174,7 @@ class PlayerCommands implements CommandListener, ManialinkPageAnswerListener, Ca return; } $targetLogin = $params[1]; - $this->maniaControl->playerManager->playerActions->warnPlayer($player->login, $targetLogin); + $this->maniaControl->playerManager->getPlayerActions()->warnPlayer($player->login, $targetLogin); } /** @@ -196,9 +197,9 @@ class PlayerCommands implements CommandListener, ManialinkPageAnswerListener, Ca if (isset($params[2]) && is_numeric($params[2])) { $type = (int)$params[2]; - $this->maniaControl->playerManager->playerActions->forcePlayerToSpectator($player->login, $targetLogin, $type); + $this->maniaControl->playerManager->getPlayerActions()->forcePlayerToSpectator($player->login, $targetLogin, $type); } else { - $this->maniaControl->playerManager->playerActions->forcePlayerToSpectator($player->login, $targetLogin); + $this->maniaControl->playerManager->getPlayerActions()->forcePlayerToSpectator($player->login, $targetLogin); } } @@ -226,7 +227,7 @@ class PlayerCommands implements CommandListener, ManialinkPageAnswerListener, Ca } $selectable = ($type === 2); - $this->maniaControl->playerManager->playerActions->forcePlayerToPlay($player->login, $targetLogin, $selectable); + $this->maniaControl->playerManager->getPlayerActions()->forcePlayerToPlay($player->login, $targetLogin, $selectable); } /** @@ -247,7 +248,7 @@ class PlayerCommands implements CommandListener, ManialinkPageAnswerListener, Ca } $targetLogin = $params[1]; - $this->maniaControl->playerManager->playerActions->forcePlayerToTeam($player->login, $targetLogin, PlayerActions::TEAM_BLUE); + $this->maniaControl->playerManager->getPlayerActions()->forcePlayerToTeam($player->login, $targetLogin, PlayerActions::TEAM_BLUE); } /** @@ -268,7 +269,7 @@ class PlayerCommands implements CommandListener, ManialinkPageAnswerListener, Ca } $targetLogin = $params[1]; - $this->maniaControl->playerManager->playerActions->forcePlayerToTeam($player->login, $targetLogin, PlayerActions::TEAM_RED); + $this->maniaControl->playerManager->getPlayerActions()->forcePlayerToTeam($player->login, $targetLogin, PlayerActions::TEAM_RED); } /** @@ -326,7 +327,7 @@ class PlayerCommands implements CommandListener, ManialinkPageAnswerListener, Ca return; } $targetLogin = $commandParts[1]; - $this->maniaControl->playerManager->playerActions->mutePlayer($admin->login, $targetLogin); + $this->maniaControl->playerManager->getPlayerActions()->mutePlayer($admin->login, $targetLogin); } /** @@ -342,7 +343,7 @@ class PlayerCommands implements CommandListener, ManialinkPageAnswerListener, Ca return; } $targetLogin = $commandParts[1]; - $this->maniaControl->playerManager->playerActions->unMutePlayer($admin->login, $targetLogin); + $this->maniaControl->playerManager->getPlayerActions()->unMutePlayer($admin->login, $targetLogin); } /** @@ -352,7 +353,7 @@ class PlayerCommands implements CommandListener, ManialinkPageAnswerListener, Ca * @param Player $player */ public function command_playerList(array $chatCallback, Player $player) { - $this->maniaControl->playerManager->playerList->addPlayerToShownList($player, PlayerList::SHOWN_MAIN_WINDOW); - $this->maniaControl->playerManager->playerList->showPlayerList($player); + $this->maniaControl->playerManager->getPlayerList()->addPlayerToShownList($player, PlayerList::SHOWN_MAIN_WINDOW); + $this->maniaControl->playerManager->getPlayerList()->showPlayerList($player); } } diff --git a/application/core/Players/PlayerDataManager.php b/application/core/Players/PlayerDataManager.php index d7bd7d75..d949ebce 100644 --- a/application/core/Players/PlayerDataManager.php +++ b/application/core/Players/PlayerDataManager.php @@ -21,12 +21,13 @@ class PlayerDataManager { const TYPE_REAL = 'real'; const TYPE_BOOL = 'bool'; const TYPE_ARRAY = 'array'; + const ARRAY_DELIMITER = ';;'; /* - * Private Properties + * Private properties */ + /** @var ManiaControl $maniaControl */ private $maniaControl = null; - private $arrayDelimiter = ';;'; private $metaData = array(); private $storedData = array(); @@ -339,7 +340,7 @@ class PlayerDataManager { return (string)$value; } if ($type === self::TYPE_ARRAY) { - return explode($this->arrayDelimiter, $value); + return explode(self::ARRAY_DELIMITER, $value); } trigger_error('Unsupported data type. ' . print_r($type, true)); return $value; diff --git a/application/core/Players/PlayerDetailed.php b/application/core/Players/PlayerDetailed.php index 71fe91f5..5c19774e 100644 --- a/application/core/Players/PlayerDetailed.php +++ b/application/core/Players/PlayerDetailed.php @@ -28,8 +28,9 @@ class PlayerDetailed { const STATS_PER_COLUMN = 13; /* - * Private Properties + * Private properties */ + /** @var ManiaControl $maniaControl */ private $maniaControl = null; /** @@ -41,10 +42,10 @@ class PlayerDetailed { $this->maniaControl = $maniaControl; // settings - $this->width = $this->maniaControl->manialinkManager->styleManager->getListWidgetsWidth(); - $this->height = $this->maniaControl->manialinkManager->styleManager->getListWidgetsHeight(); - $this->quadStyle = $this->maniaControl->manialinkManager->styleManager->getDefaultMainWindowStyle(); - $this->quadSubstyle = $this->maniaControl->manialinkManager->styleManager->getDefaultMainWindowSubStyle(); + $this->width = $this->maniaControl->manialinkManager->getStyleManager()->getListWidgetsWidth(); + $this->height = $this->maniaControl->manialinkManager->getStyleManager()->getListWidgetsHeight(); + $this->quadStyle = $this->maniaControl->manialinkManager->getStyleManager()->getDefaultMainWindowStyle(); + $this->quadSubstyle = $this->maniaControl->manialinkManager->getStyleManager()->getDefaultMainWindowSubStyle(); } /** @@ -62,7 +63,7 @@ class PlayerDetailed { $script = $maniaLink->getScript(); // Main frame - $frame = $this->maniaControl->manialinkManager->styleManager->getDefaultListFrame($script); + $frame = $this->maniaControl->manialinkManager->getStyleManager()->getDefaultListFrame($script); $maniaLink->add($frame); // Create script and features diff --git a/application/core/Players/PlayerList.php b/application/core/Players/PlayerList.php index 2eb3d866..ab547b10 100644 --- a/application/core/Players/PlayerList.php +++ b/application/core/Players/PlayerList.php @@ -59,8 +59,9 @@ class PlayerList implements ManialinkPageAnswerListener, CallbackListener, Timer const MAX_PLAYERS_PER_PAGE = 15; /* - * Private Properties + * Private properties */ + /** @var ManiaControl $maniaControl */ private $maniaControl = null; private $playersListShown = array(); @@ -133,8 +134,8 @@ class PlayerList implements ManialinkPageAnswerListener, CallbackListener, Timer * @param Player $player */ public function showPlayerList(Player $player) { - $width = $this->maniaControl->manialinkManager->styleManager->getListWidgetsWidth(); - $height = $this->maniaControl->manialinkManager->styleManager->getListWidgetsHeight(); + $width = $this->maniaControl->manialinkManager->getStyleManager()->getListWidgetsWidth(); + $height = $this->maniaControl->manialinkManager->getStyleManager()->getListWidgetsHeight(); // get PlayerList $players = $this->maniaControl->playerManager->getPlayers(); @@ -146,7 +147,7 @@ class PlayerList implements ManialinkPageAnswerListener, CallbackListener, Timer $script->addFeature($paging); // Main frame - $frame = $this->maniaControl->manialinkManager->styleManager->getDefaultListFrame($script, $paging); + $frame = $this->maniaControl->manialinkManager->getStyleManager()->getDefaultListFrame($script, $paging); $maniaLink->add($frame); // Start offsets @@ -154,7 +155,7 @@ class PlayerList implements ManialinkPageAnswerListener, CallbackListener, Timer $posY = $height / 2; // Predefine Description Label - $descriptionLabel = $this->maniaControl->manialinkManager->styleManager->getDefaultDescriptionLabel(); + $descriptionLabel = $this->maniaControl->manialinkManager->getStyleManager()->getDefaultDescriptionLabel(); $frame->add($descriptionLabel); // Headline @@ -425,10 +426,10 @@ class PlayerList implements ManialinkPageAnswerListener, CallbackListener, Timer */ public function showAdvancedPlayerWidget(Player $admin, $login) { $player = $this->maniaControl->playerManager->getPlayer($login); - $width = $this->maniaControl->manialinkManager->styleManager->getListWidgetsWidth(); - $height = $this->maniaControl->manialinkManager->styleManager->getListWidgetsHeight(); - $quadStyle = $this->maniaControl->manialinkManager->styleManager->getDefaultMainWindowStyle(); - $quadSubstyle = $this->maniaControl->manialinkManager->styleManager->getDefaultMainWindowSubStyle(); + $width = $this->maniaControl->manialinkManager->getStyleManager()->getListWidgetsWidth(); + $height = $this->maniaControl->manialinkManager->getStyleManager()->getListWidgetsHeight(); + $quadStyle = $this->maniaControl->manialinkManager->getStyleManager()->getDefaultMainWindowStyle(); + $quadSubstyle = $this->maniaControl->manialinkManager->getStyleManager()->getDefaultMainWindowSubStyle(); //Settings $posX = $width / 2 + 2.5; @@ -505,7 +506,7 @@ class PlayerList implements ManialinkPageAnswerListener, CallbackListener, Timer $label->setTextSize($textSize); $label->setTextColor($textColor); - if (!$this->maniaControl->playerManager->playerActions->isPlayerMuted($login)) { + if (!$this->maniaControl->playerManager->getPlayerActions()->isPlayerMuted($login)) { $label->setText('Mute'); $quad->setAction(self::ACTION_MUTE_PLAYER . '.' . $login); } else { @@ -636,53 +637,53 @@ class PlayerList implements ManialinkPageAnswerListener, CallbackListener, Timer break; case self::ACTION_OPEN_PLAYER_DETAILED: $player = $this->maniaControl->playerManager->getPlayer($adminLogin); - $this->maniaControl->playerManager->playerDetailed->showPlayerDetailed($player, $targetLogin); + $this->maniaControl->playerManager->getPlayerDetailed()->showPlayerDetailed($player, $targetLogin); unset($this->playersListShown[$player->login]); break; case self::ACTION_FORCE_BLUE: - $this->maniaControl->playerManager->playerActions->forcePlayerToTeam($adminLogin, $targetLogin, PlayerActions::TEAM_BLUE); + $this->maniaControl->playerManager->getPlayerActions()->forcePlayerToTeam($adminLogin, $targetLogin, PlayerActions::TEAM_BLUE); break; case self::ACTION_FORCE_RED: - $this->maniaControl->playerManager->playerActions->forcePlayerToTeam($adminLogin, $targetLogin, PlayerActions::TEAM_RED); + $this->maniaControl->playerManager->getPlayerActions()->forcePlayerToTeam($adminLogin, $targetLogin, PlayerActions::TEAM_RED); break; case self::ACTION_FORCE_SPEC: - $this->maniaControl->playerManager->playerActions->forcePlayerToSpectator($adminLogin, $targetLogin, PlayerActions::SPECTATOR_BUT_KEEP_SELECTABLE); + $this->maniaControl->playerManager->getPlayerActions()->forcePlayerToSpectator($adminLogin, $targetLogin, PlayerActions::SPECTATOR_BUT_KEEP_SELECTABLE); break; case self::ACTION_FORCE_PLAY: - $this->maniaControl->playerManager->playerActions->forcePlayerToPlay($adminLogin, $targetLogin); + $this->maniaControl->playerManager->getPlayerActions()->forcePlayerToPlay($adminLogin, $targetLogin); break; case self::ACTION_MUTE_PLAYER: - $this->maniaControl->playerManager->playerActions->mutePlayer($adminLogin, $targetLogin); + $this->maniaControl->playerManager->getPlayerActions()->mutePlayer($adminLogin, $targetLogin); $this->showPlayerList($this->maniaControl->playerManager->getPlayer($adminLogin)); break; case self::ACTION_UNMUTE_PLAYER: - $this->maniaControl->playerManager->playerActions->unMutePlayer($adminLogin, $targetLogin); + $this->maniaControl->playerManager->getPlayerActions()->unMutePlayer($adminLogin, $targetLogin); $this->showPlayerList($this->maniaControl->playerManager->getPlayer($adminLogin)); break; case self::ACTION_WARN_PLAYER: - $this->maniaControl->playerManager->playerActions->warnPlayer($adminLogin, $targetLogin); + $this->maniaControl->playerManager->getPlayerActions()->warnPlayer($adminLogin, $targetLogin); break; case self::ACTION_KICK_PLAYER: - $this->maniaControl->playerManager->playerActions->kickPlayer($adminLogin, $targetLogin); + $this->maniaControl->playerManager->getPlayerActions()->kickPlayer($adminLogin, $targetLogin); break; case self::ACTION_BAN_PLAYER: - $this->maniaControl->playerManager->playerActions->banPlayer($adminLogin, $targetLogin); + $this->maniaControl->playerManager->getPlayerActions()->banPlayer($adminLogin, $targetLogin); break; case self::ACTION_PLAYER_ADV: $admin = $this->maniaControl->playerManager->getPlayer($adminLogin); $this->advancedPlayerWidget($admin, $targetLogin); break; case self::ACTION_ADD_AS_MASTER: - $this->maniaControl->playerManager->playerActions->grandAuthLevel($adminLogin, $targetLogin, AuthenticationManager::AUTH_LEVEL_SUPERADMIN); + $this->maniaControl->playerManager->getPlayerActions()->grandAuthLevel($adminLogin, $targetLogin, AuthenticationManager::AUTH_LEVEL_SUPERADMIN); break; case self::ACTION_ADD_AS_ADMIN: - $this->maniaControl->playerManager->playerActions->grandAuthLevel($adminLogin, $targetLogin, AuthenticationManager::AUTH_LEVEL_ADMIN); + $this->maniaControl->playerManager->getPlayerActions()->grandAuthLevel($adminLogin, $targetLogin, AuthenticationManager::AUTH_LEVEL_ADMIN); break; case self::ACTION_ADD_AS_MOD: - $this->maniaControl->playerManager->playerActions->grandAuthLevel($adminLogin, $targetLogin, AuthenticationManager::AUTH_LEVEL_MODERATOR); + $this->maniaControl->playerManager->getPlayerActions()->grandAuthLevel($adminLogin, $targetLogin, AuthenticationManager::AUTH_LEVEL_MODERATOR); break; case self::ACTION_REVOKE_RIGHTS: - $this->maniaControl->playerManager->playerActions->revokeAuthLevel($adminLogin, $targetLogin); + $this->maniaControl->playerManager->getPlayerActions()->revokeAuthLevel($adminLogin, $targetLogin); break; case self::ACTION_FORCE_SPEC_VOTE: /** @var $votesPlugin CustomVotesPlugin */ diff --git a/application/core/Players/PlayerManager.php b/application/core/Players/PlayerManager.php index 2b166315..51e4840c 100644 --- a/application/core/Players/PlayerManager.php +++ b/application/core/Players/PlayerManager.php @@ -33,17 +33,31 @@ class PlayerManager implements CallbackListener, TimerListener { const STAT_SERVERTIME = 'Servertime'; /* - * Public Properties + * Public properties */ + /** @var PlayerActions $playerActions */ + /** @deprecated see getPlayerActions() */ public $playerActions = null; + /** @var PlayerCommands $playerCommands */ + /** @deprecated see getPlayerCommands() */ public $playerCommands = null; + /** @var PlayerDetailed $playerDetailed */ + /** @deprecated see getPlayerDetailed() */ public $playerDetailed = null; + /** @var PlayerDataManager $playerDataManager */ + /** @deprecated see getPlayerDataManager() */ + public $playerDataManager = null; + /** @var PlayerList $playerList */ + /** @deprecated see getPlayerList() */ public $playerList = null; + /** @var AdminLists $adminLists */ + /** @deprecated see getAdminLists() */ public $adminLists = null; /* - * Private Properties + * Private properties */ + /** @var ManiaControl $maniaControl */ private $maniaControl = null; /** @var Player[] $players */ private $players = array(); @@ -110,6 +124,51 @@ class PlayerManager implements CallbackListener, TimerListener { return true; } + /** + * Get player actions + * + * @return PlayerActions + */ + public function getPlayerActions() { + return $this->playerActions; + } + + /** + * Get player commands + * + * @return PlayerCommands + */ + public function getPlayerCommands() { + return $this->playerCommands; + } + + /** + * Get player detailed + * + * @return PlayerDetailed + */ + public function getPlayerDetailed() { + return $this->playerDetailed; + } + + /** + * Get player list + * + * @return PlayerList + */ + public function getPlayerList() { + return $this->playerList; + } + + /** + * Get admin lists + * + * @return AdminLists + */ + public function getAdminLists() { + return $this->adminLists; + } + /** * Handle OnInit callback */ @@ -152,7 +211,7 @@ class PlayerManager implements CallbackListener, TimerListener { } /** - * Save player in Database and fill up Object Properties + * Save player in database and fill up properties * * @param Player $player * @return bool @@ -295,7 +354,7 @@ class PlayerManager implements CallbackListener, TimerListener { } /** - * Get the Count of all Player + * Get the count of all Players * * @param bool $withoutSpectators * @return int @@ -363,7 +422,7 @@ class PlayerManager implements CallbackListener, TimerListener { } /** - * Get a Player by Login + * Get a Player by login * * @param mixed $login * @param bool $connectedPlayersOnly @@ -383,7 +442,7 @@ class PlayerManager implements CallbackListener, TimerListener { } /** - * Get a Player from the Database + * Get a Player from the database * * @param string $playerLogin * @return Player @@ -427,7 +486,7 @@ class PlayerManager implements CallbackListener, TimerListener { } /** - * Gets the Count of all Spectators + * Get the count of all spectators * * @return int */ @@ -442,7 +501,7 @@ class PlayerManager implements CallbackListener, TimerListener { } /** - * Gets a Player by his Index + * Get a Player by index * * @param int $index * @param bool $connectedPlayersOnly @@ -455,27 +514,28 @@ class PlayerManager implements CallbackListener, TimerListener { } } - if ($connectedPlayersOnly) { - return null; + // Player is not online - Get Player from Database + if (!$connectedPlayersOnly) { + return $this->getPlayerFromDatabaseByIndex($index); } - //Player is not online -> get Player from Database - return $this->getPlayerFromDatabaseByIndex($index); + + return null; } /** * Get a Player out of the database * * @param int $playerIndex - * @return Player $player + * @return Player */ private function getPlayerFromDatabaseByIndex($playerIndex) { - $mysqli = $this->maniaControl->database->mysqli; - if (!is_numeric($playerIndex)) { return null; } - $query = "SELECT * FROM `" . self::TABLE_PLAYERS . "` WHERE `index` = " . $playerIndex . ";"; + $mysqli = $this->maniaControl->database->mysqli; + $query = "SELECT * FROM `" . self::TABLE_PLAYERS . "` + WHERE `index` = {$playerIndex};"; $result = $mysqli->query($query); if (!$result) { trigger_error($mysqli->error); @@ -485,7 +545,7 @@ class PlayerManager implements CallbackListener, TimerListener { $row = $result->fetch_object(); $result->free(); - if (!isset($row)) { + if (!$row) { return null; } diff --git a/application/core/Plugins/InstallMenu.php b/application/core/Plugins/InstallMenu.php index 80a543c9..dc02be4a 100644 --- a/application/core/Plugins/InstallMenu.php +++ b/application/core/Plugins/InstallMenu.php @@ -34,6 +34,7 @@ class InstallMenu implements ConfiguratorMenu, ManialinkPageAnswerListener { /* * Private properties */ + /** @var ManiaControl $maniaControl */ private $maniaControl = null; /** diff --git a/application/core/Plugins/PluginManager.php b/application/core/Plugins/PluginManager.php index 8bccf108..59f969e0 100644 --- a/application/core/Plugins/PluginManager.php +++ b/application/core/Plugins/PluginManager.php @@ -26,6 +26,7 @@ class PluginManager { /* * Private properties */ + /** @var ManiaControl $maniaControl */ private $maniaControl = null; /** @var PluginMenu $pluginMenu */ private $pluginMenu = null; diff --git a/application/core/Plugins/PluginMenu.php b/application/core/Plugins/PluginMenu.php index bbfc6dbb..820af2ba 100644 --- a/application/core/Plugins/PluginMenu.php +++ b/application/core/Plugins/PluginMenu.php @@ -48,6 +48,7 @@ class PluginMenu implements CallbackListener, ConfiguratorMenu, ManialinkPageAns /* * Private properties */ + /** @var ManiaControl $maniaControl */ private $maniaControl = null; /** diff --git a/application/core/Server/Commands.php b/application/core/Server/Commands.php index 4747d73c..c952d2f4 100644 --- a/application/core/Server/Commands.php +++ b/application/core/Server/Commands.php @@ -43,6 +43,7 @@ class Commands implements CallbackListener, CommandListener, ManialinkPageAnswer /* * Private properties */ + /** @var ManiaControl $maniaControl */ private $maniaControl = null; private $serverShutdownTime = -1; private $serverShutdownEmpty = false; diff --git a/application/core/Server/Directory.php b/application/core/Server/Directory.php index f43d4cab..d5f84891 100644 --- a/application/core/Server/Directory.php +++ b/application/core/Server/Directory.php @@ -15,9 +15,10 @@ use ManiaControl\ManiaControl; * @license http://www.gnu.org/licenses/ GNU General Public License, Version 3 */ class Directory implements CallbackListener { - /** + /* * Private properties */ + /** @var ManiaControl $maniaControl */ private $maniaControl = null; /** diff --git a/application/core/Server/ScriptManager.php b/application/core/Server/ScriptManager.php index ca091306..2ec52e54 100644 --- a/application/core/Server/ScriptManager.php +++ b/application/core/Server/ScriptManager.php @@ -13,8 +13,9 @@ use ManiaControl\ManiaControl; */ class ScriptManager { /* - * Private Properties + * Private properties */ + /** @var ManiaControl $maniaControl */ private $maniaControl = null; private $isScriptMode = null; diff --git a/application/core/Server/Server.php b/application/core/Server/Server.php index 6c7abb13..c0d8425c 100644 --- a/application/core/Server/Server.php +++ b/application/core/Server/Server.php @@ -35,19 +35,25 @@ class Server implements CallbackListener { public $login = null; public $titleId = null; /** @var Directory $directory */ + /** @deprecated see getDirectory() */ public $directory = null; /** @var Commands $commands */ + /** @deprecated see getCommands() */ public $commands = null; /** @var UsageReporter $usageReporter */ + /** @deprecated see getUsageReporter() */ public $usageReporter = null; /** @var RankingManager $rankingManager */ + /** @deprecated see getRankingManager() */ public $rankingManager = null; /** @var ScriptManager $scriptManager */ + /** @deprecated see getScriptManager() */ public $scriptManager = null; /* - * Private Properties + * Private properties */ + /** @var ManiaControl $maniaControl */ private $maniaControl = null; private $teamMode = null; @@ -133,6 +139,15 @@ class Server implements CallbackListener { return $this->usageReporter; } + /** + * Return the ranking manager + * + * @return RankingManager + */ + public function getRankingManager() { + return $this->rankingManager; + } + /** * Return the script manager * @@ -284,7 +299,7 @@ class Server implements CallbackListener { * @return string */ public function getGhostReplay($login) { - $dataDir = $this->directory->getGameDataFolder(); + $dataDir = $this->getDirectory()->getGameDataFolder(); if (!$this->checkAccess($dataDir)) { return null; } diff --git a/application/core/Server/ServerOptionsMenu.php b/application/core/Server/ServerOptionsMenu.php index 9ae4590f..eccc66ee 100644 --- a/application/core/Server/ServerOptionsMenu.php +++ b/application/core/Server/ServerOptionsMenu.php @@ -46,6 +46,7 @@ class ServerOptionsMenu implements CallbackListener, ConfiguratorMenu, TimerList /* * Private properties */ + /** @var ManiaControl $maniaControl */ private $maniaControl = null; /** diff --git a/application/core/Server/UsageReporter.php b/application/core/Server/UsageReporter.php index 897d8eb5..4db07dc0 100644 --- a/application/core/Server/UsageReporter.php +++ b/application/core/Server/UsageReporter.php @@ -22,8 +22,9 @@ class UsageReporter implements TimerListener { const SETTING_REPORT_USAGE = 'Report Usage to $lManiaControl.com$l'; /* - * Private Properties + * Private properties */ + /** @var ManiaControl $maniaControl */ private $maniaControl = null; /** diff --git a/application/core/Server/VoteRatiosMenu.php b/application/core/Server/VoteRatiosMenu.php index 0448ceeb..6e1901c3 100644 --- a/application/core/Server/VoteRatiosMenu.php +++ b/application/core/Server/VoteRatiosMenu.php @@ -31,6 +31,7 @@ class VoteRatiosMenu implements CallbackListener, ConfiguratorMenu, TimerListene /* * Private properties */ + /** @var ManiaControl $maniaControl */ private $maniaControl = null; /** diff --git a/application/core/Statistics/SimpleStatsList.php b/application/core/Statistics/SimpleStatsList.php index 02a16d73..a7220297 100644 --- a/application/core/Statistics/SimpleStatsList.php +++ b/application/core/Statistics/SimpleStatsList.php @@ -36,8 +36,9 @@ class SimpleStatsList implements ManialinkPageAnswerListener, CallbackListener, const ACTION_SORT_STATS = 'SimpleStatsList.SortStats'; /* - * Private Properties + * Private properties */ + /** @var ManiaControl $maniaControl */ private $maniaControl = null; private $statArray = array(); private $statsWidth = 0; @@ -118,9 +119,9 @@ class SimpleStatsList implements ManialinkPageAnswerListener, CallbackListener, * @param string $order */ public function showStatsList(Player $player, $order = PlayerManager::STAT_SERVERTIME) { - $height = $this->maniaControl->manialinkManager->styleManager->getListWidgetsHeight(); - $quadStyle = $this->maniaControl->manialinkManager->styleManager->getDefaultMainWindowStyle(); - $quadSubstyle = $this->maniaControl->manialinkManager->styleManager->getDefaultMainWindowSubStyle(); + $height = $this->maniaControl->manialinkManager->getStyleManager()->getListWidgetsHeight(); + $quadStyle = $this->maniaControl->manialinkManager->getStyleManager()->getDefaultMainWindowStyle(); + $quadSubstyle = $this->maniaControl->manialinkManager->getStyleManager()->getDefaultMainWindowSubStyle(); $maniaLink = new ManiaLink(ManialinkManager::MAIN_MLID); diff --git a/application/core/Statistics/StatisticCollector.php b/application/core/Statistics/StatisticCollector.php index 8b41eac8..c6e81a2e 100644 --- a/application/core/Statistics/StatisticCollector.php +++ b/application/core/Statistics/StatisticCollector.php @@ -53,8 +53,9 @@ class StatisticCollector implements CallbackListener { const WEAPON_ARROW = 5; /* - * Private Properties + * Private properties */ + /** @var ManiaControl $maniaControl */ private $maniaControl = null; private $onShootArray = array(); @@ -114,7 +115,7 @@ class StatisticCollector implements CallbackListener { return; } - $leaders = $this->maniaControl->server->rankingManager->getLeaders(); + $leaders = $this->maniaControl->server->getRankingManager()->getLeaders(); foreach ($leaders as $leaderLogin) { $leader = $this->maniaControl->playerManager->getPlayer($leaderLogin); diff --git a/application/core/Statistics/StatisticManager.php b/application/core/Statistics/StatisticManager.php index 1448ae02..d3231ba2 100644 --- a/application/core/Statistics/StatisticManager.php +++ b/application/core/Statistics/StatisticManager.php @@ -30,22 +30,27 @@ class StatisticManager { const SPECIAL_STAT_ARROW_ACC = 'Arrow Accuracy'; /* - * Public Properties + * Public properties */ + /** @var StatisticCollector $statisticCollector */ + /** @deprecated see getStatisticCollector() */ public $statisticCollector = null; + /** @var SimpleStatsList $simpleStatsList */ + /** @deprecated see getSimpleStatsList() */ public $simpleStatsList = null; /* - * Private Properties + * Private properties */ + /** @var ManiaControl $maniaControl */ private $maniaControl = null; private $stats = array(); private $specialStats = array(); /** - * Construct player manager + * Construct a new statistic manager instance * - * @param \ManiaControl\ManiaControl $maniaControl + * @param ManiaControl $maniaControl */ public function __construct(ManiaControl $maniaControl) { $this->maniaControl = $maniaControl; @@ -165,6 +170,24 @@ class StatisticManager { $this->specialStats[self::SPECIAL_STAT_ROCKET_ACC] = $stat; } + /** + * Return the statistic collector + * + * @return StatisticCollector + */ + public function getStatisticCollector() { + return $this->statisticCollector; + } + + /** + * Return the simple stats list + * + * @return SimpleStatsList + */ + public function getSimpleStatsList() { + return $this->simpleStatsList; + } + /** * Get All statistics ordered by an given name * diff --git a/application/core/Update/PluginUpdateManager.php b/application/core/Update/PluginUpdateManager.php index 235afedb..e77c550b 100644 --- a/application/core/Update/PluginUpdateManager.php +++ b/application/core/Update/PluginUpdateManager.php @@ -27,6 +27,7 @@ class PluginUpdateManager implements CallbackListener, CommandListener, TimerLis /* * Private properties */ + /** @var ManiaControl $maniaControl */ private $maniaControl = null; /** diff --git a/application/plugins/MCTeam/ChatMessagePlugin.php b/application/plugins/MCTeam/ChatMessagePlugin.php index f753b892..bb88be6e 100644 --- a/application/plugins/MCTeam/ChatMessagePlugin.php +++ b/application/plugins/MCTeam/ChatMessagePlugin.php @@ -27,7 +27,7 @@ class ChatMessagePlugin implements CommandListener, Plugin { const SETTING_AFK_FORCE_SPEC = 'AFK command forces spec'; /* - * Private Properties + * Private properties */ /** @var ManiaControl $maniaControl */ private $maniaControl = null; diff --git a/application/plugins/MCTeam/CustomVotesPlugin.php b/application/plugins/MCTeam/CustomVotesPlugin.php index 75af47a2..c8f5151a 100644 --- a/application/plugins/MCTeam/CustomVotesPlugin.php +++ b/application/plugins/MCTeam/CustomVotesPlugin.php @@ -76,9 +76,9 @@ class CustomVotesPlugin implements CommandListener, CallbackListener, ManialinkP const CB_CUSTOM_VOTE_FINISHED = 'CustomVotesPlugin.CustomVoteFinished'; /* - * Private Properties + * Private properties */ - /** @var maniaControl $maniaControl */ + /** @var ManiaControl $maniaControl */ private $maniaControl = null; private $voteCommands = array(); private $voteMenuItems = array(); @@ -289,9 +289,9 @@ class CustomVotesPlugin implements CommandListener, CallbackListener, ManialinkP $posY = $this->maniaControl->settingManager->getSettingValue($this, self::SETTING_VOTE_ICON_POSY); $width = $this->maniaControl->settingManager->getSettingValue($this, self::SETTING_VOTE_ICON_WIDTH); $height = $this->maniaControl->settingManager->getSettingValue($this, self::SETTING_VOTE_ICON_HEIGHT); - $shootManiaOffset = $this->maniaControl->manialinkManager->styleManager->getDefaultIconOffsetSM(); - $quadStyle = $this->maniaControl->manialinkManager->styleManager->getDefaultQuadStyle(); - $quadSubstyle = $this->maniaControl->manialinkManager->styleManager->getDefaultQuadSubstyle(); + $shootManiaOffset = $this->maniaControl->manialinkManager->getStyleManager()->getDefaultIconOffsetSM(); + $quadStyle = $this->maniaControl->manialinkManager->getStyleManager()->getDefaultQuadStyle(); + $quadSubstyle = $this->maniaControl->manialinkManager->getStyleManager()->getDefaultQuadSubstyle(); $itemMarginFactorX = 1.3; $itemMarginFactorY = 1.2; @@ -446,7 +446,7 @@ class CustomVotesPlugin implements CommandListener, CallbackListener, ManialinkP */ public function startVote(Player $player, $voteIndex, $function = null) { //Player is muted - if ($this->maniaControl->playerManager->playerActions->isPlayerMuted($player)) { + if ($this->maniaControl->playerManager->getPlayerActions()->isPlayerMuted($player)) { $this->maniaControl->chat->sendError('Muted Players are not allowed to start a vote.', $player->login); return; } @@ -530,7 +530,7 @@ class CustomVotesPlugin implements CommandListener, CallbackListener, ManialinkP case 'skip': case 'nextmap': try { - $this->maniaControl->mapManager->mapActions->skipMap(); + $this->maniaControl->mapManager->getMapActions()->skipMap(); } catch (ChangeInProgressException $e) { } $this->maniaControl->chat->sendInformation('$f8fVote to $fffskip the Map$f8f has been successful!'); @@ -547,7 +547,7 @@ class CustomVotesPlugin implements CommandListener, CallbackListener, ManialinkP $this->maniaControl->chat->sendInformation('$f8fVote to $fffpause the current Game$f8f has been successful!'); break; case 'replay': - $this->maniaControl->mapManager->mapQueue->addFirstMapToMapQueue($this->currentVote->voter, $this->maniaControl->mapManager->getCurrentMap()); + $this->maniaControl->mapManager->getMapQueue()->addFirstMapToMapQueue($this->currentVote->voter, $this->maniaControl->mapManager->getCurrentMap()); $this->maniaControl->chat->sendInformation('$f8fVote to $fffreplay the Map$f8f has been successful!'); break; } @@ -676,9 +676,9 @@ class CustomVotesPlugin implements CommandListener, CallbackListener, ManialinkP $height = $this->maniaControl->settingManager->getSettingValue($this, self::SETTING_WIDGET_HEIGHT); $maxTime = $this->maniaControl->settingManager->getSettingValue($this, self::SETTING_VOTE_TIME); - $quadStyle = $this->maniaControl->manialinkManager->styleManager->getDefaultQuadStyle(); - $quadSubstyle = $this->maniaControl->manialinkManager->styleManager->getDefaultQuadSubstyle(); - $labelStyle = $this->maniaControl->manialinkManager->styleManager->getDefaultLabelStyle(); + $quadStyle = $this->maniaControl->manialinkManager->getStyleManager()->getDefaultQuadStyle(); + $quadSubstyle = $this->maniaControl->manialinkManager->getStyleManager()->getDefaultQuadSubstyle(); + $labelStyle = $this->maniaControl->manialinkManager->getStyleManager()->getDefaultLabelStyle(); $maniaLink = new ManiaLink(self::MLID_WIDGET); diff --git a/application/plugins/MCTeam/Dedimania/DedimaniaPlayer.php b/application/plugins/MCTeam/Dedimania/DedimaniaPlayer.php index 584afaa4..835c50ef 100644 --- a/application/plugins/MCTeam/Dedimania/DedimaniaPlayer.php +++ b/application/plugins/MCTeam/Dedimania/DedimaniaPlayer.php @@ -11,7 +11,7 @@ namespace MCTeam\Dedimania; */ class DedimaniaPlayer { /* - * Public Properties + * Public properties */ public $login = ''; public $maxRank = -1; diff --git a/application/plugins/MCTeam/Dedimania/DedimaniaPlugin.php b/application/plugins/MCTeam/Dedimania/DedimaniaPlugin.php index 3ea2671c..36589228 100644 --- a/application/plugins/MCTeam/Dedimania/DedimaniaPlugin.php +++ b/application/plugins/MCTeam/Dedimania/DedimaniaPlugin.php @@ -62,7 +62,7 @@ class DedimaniaPlugin implements CallbackListener, CommandListener, TimerListene const DEDIMANIA_DEBUG = false; /* - * Private Properties + * Private properties */ /** @var ManiaControl $maniaControl */ private $maniaControl = null; @@ -467,9 +467,9 @@ class DedimaniaPlugin implements CallbackListener, CommandListener, TimerListene $width = $this->maniaControl->settingManager->getSettingValue($this, self::SETTING_WIDGET_WIDTH); $lines = $this->maniaControl->settingManager->getSettingValue($this, self::SETTING_WIDGET_LINE_COUNT); $lineHeight = $this->maniaControl->settingManager->getSettingValue($this, self::SETTING_WIDGET_LINE_HEIGHT); - $labelStyle = $this->maniaControl->manialinkManager->styleManager->getDefaultLabelStyle(); - $quadStyle = $this->maniaControl->manialinkManager->styleManager->getDefaultQuadStyle(); - $quadSubstyle = $this->maniaControl->manialinkManager->styleManager->getDefaultQuadSubstyle(); + $labelStyle = $this->maniaControl->manialinkManager->getStyleManager()->getDefaultLabelStyle(); + $quadStyle = $this->maniaControl->manialinkManager->getStyleManager()->getDefaultQuadStyle(); + $quadSubstyle = $this->maniaControl->manialinkManager->getStyleManager()->getDefaultQuadSubstyle(); $manialink = new ManiaLink(self::MLID_DEDIMANIA); @@ -1052,7 +1052,7 @@ class DedimaniaPlugin implements CallbackListener, CommandListener, TimerListene // Set ghost replay if ($record->rank <= 1) { - $dataDirectory = $this->maniaControl->server->directory->getGameDataFolder(); + $dataDirectory = $this->maniaControl->server->getDirectory()->getGameDataFolder(); if (!isset($this->dedimaniaData->directoryAccessChecked)) { $access = $this->maniaControl->server->checkAccess($dataDirectory); if (!$access) { @@ -1092,8 +1092,8 @@ class DedimaniaPlugin implements CallbackListener, CommandListener, TimerListene * @param Player $player */ public function showDediRecordsList(array $chat, Player $player) { - $width = $this->maniaControl->manialinkManager->styleManager->getListWidgetsWidth(); - $height = $this->maniaControl->manialinkManager->styleManager->getListWidgetsHeight(); + $width = $this->maniaControl->manialinkManager->getStyleManager()->getListWidgetsWidth(); + $height = $this->maniaControl->manialinkManager->getStyleManager()->getListWidgetsHeight(); // get PlayerList $records = $this->dedimaniaData->records; @@ -1109,7 +1109,7 @@ class DedimaniaPlugin implements CallbackListener, CommandListener, TimerListene $script->addFeature($paging); // Main frame - $frame = $this->maniaControl->manialinkManager->styleManager->getDefaultListFrame($script, $paging); + $frame = $this->maniaControl->manialinkManager->getStyleManager()->getDefaultListFrame($script, $paging); $maniaLink->add($frame); // Start offsets @@ -1117,7 +1117,7 @@ class DedimaniaPlugin implements CallbackListener, CommandListener, TimerListene $posY = $height / 2; // Predefine Description Label - $descriptionLabel = $this->maniaControl->manialinkManager->styleManager->getDefaultDescriptionLabel(); + $descriptionLabel = $this->maniaControl->manialinkManager->getStyleManager()->getDefaultDescriptionLabel(); $frame->add($descriptionLabel); // Headline diff --git a/application/plugins/MCTeam/Dedimania/RecordData.php b/application/plugins/MCTeam/Dedimania/RecordData.php index a585c1be..e4698664 100644 --- a/application/plugins/MCTeam/Dedimania/RecordData.php +++ b/application/plugins/MCTeam/Dedimania/RecordData.php @@ -13,7 +13,7 @@ use ManiaControl\Utils\Formatter; */ class RecordData { /* - * Public Properties + * Public properties */ public $nullRecord = false; public $login = ''; diff --git a/application/plugins/MCTeam/DonationPlugin.php b/application/plugins/MCTeam/DonationPlugin.php index bba1264d..abe70aaf 100644 --- a/application/plugins/MCTeam/DonationPlugin.php +++ b/application/plugins/MCTeam/DonationPlugin.php @@ -51,7 +51,7 @@ class DonationPlugin implements CallbackListener, CommandListener, Plugin { const SETTING_MIN_AMOUNT_SHOWN = 'Minimum Donation amount to get shown'; /* - * Private Properties + * Private properties */ /** @var ManiaControl $maniaControl */ private $maniaControl = null; @@ -125,7 +125,7 @@ class DonationPlugin implements CallbackListener, CommandListener, Plugin { $this->maniaControl->settingManager->initSetting($this, self::SETTING_MIN_AMOUNT_SHOWN, 100); // Register Stat in Simple StatsList - $this->maniaControl->statisticManager->simpleStatsList->registerStat(self::STAT_PLAYER_DONATIONS, 90, "DP", 15); + $this->maniaControl->statisticManager->getSimpleStatsList()->registerStat(self::STAT_PLAYER_DONATIONS, 90, "DP", 15); $this->displayWidget(); return true; @@ -151,9 +151,9 @@ class DonationPlugin implements CallbackListener, CommandListener, Plugin { $width = $this->maniaControl->settingManager->getSettingValue($this, self::SETTING_DONATE_WIDGET_WIDTH); $height = $this->maniaControl->settingManager->getSettingValue($this, self::SETTING_DONATE_WIDGET_HEIGHT); $values = $this->maniaControl->settingManager->getSettingValue($this, self::SETTING_DONATION_VALUES); - $shootManiaOffset = $this->maniaControl->manialinkManager->styleManager->getDefaultIconOffsetSM(); - $quadStyle = $this->maniaControl->manialinkManager->styleManager->getDefaultQuadStyle(); - $quadSubstyle = $this->maniaControl->manialinkManager->styleManager->getDefaultQuadSubstyle(); + $shootManiaOffset = $this->maniaControl->manialinkManager->getStyleManager()->getDefaultIconOffsetSM(); + $quadStyle = $this->maniaControl->manialinkManager->getStyleManager()->getDefaultQuadStyle(); + $quadSubstyle = $this->maniaControl->manialinkManager->getStyleManager()->getDefaultQuadSubstyle(); $itemMarginFactorX = 1.3; $itemMarginFactorY = 1.2; @@ -461,8 +461,8 @@ class DonationPlugin implements CallbackListener, CommandListener, Plugin { private function showTopDonsList(Player $player) { $stats = $this->maniaControl->statisticManager->getStatsRanking(self::STAT_PLAYER_DONATIONS); - $width = $this->maniaControl->manialinkManager->styleManager->getListWidgetsWidth(); - $height = $this->maniaControl->manialinkManager->styleManager->getListWidgetsHeight(); + $width = $this->maniaControl->manialinkManager->getStyleManager()->getListWidgetsWidth(); + $height = $this->maniaControl->manialinkManager->getStyleManager()->getListWidgetsHeight(); // create manialink $maniaLink = new ManiaLink(ManialinkManager::MAIN_MLID); @@ -471,7 +471,7 @@ class DonationPlugin implements CallbackListener, CommandListener, Plugin { $script->addFeature($paging); // Main frame - $frame = $this->maniaControl->manialinkManager->styleManager->getDefaultListFrame($script, $paging); + $frame = $this->maniaControl->manialinkManager->getStyleManager()->getDefaultListFrame($script, $paging); $maniaLink->add($frame); // Start offsets @@ -479,7 +479,7 @@ class DonationPlugin implements CallbackListener, CommandListener, Plugin { $posY = $height / 2; //Predefine description Label - $descriptionLabel = $this->maniaControl->manialinkManager->styleManager->getDefaultDescriptionLabel(); + $descriptionLabel = $this->maniaControl->manialinkManager->getStyleManager()->getDefaultDescriptionLabel(); $frame->add($descriptionLabel); // Headline diff --git a/application/plugins/MCTeam/DynamicPointLimitPlugin.php b/application/plugins/MCTeam/DynamicPointLimitPlugin.php index be92da21..aa0c6bce 100644 --- a/application/plugins/MCTeam/DynamicPointLimitPlugin.php +++ b/application/plugins/MCTeam/DynamicPointLimitPlugin.php @@ -41,7 +41,7 @@ class DynamicPointLimitPlugin implements CallbackListener, CommandListener, Plug const SCRIPT_SETTING_MAP_POINTS_LIMIT = 'S_MapPointsLimit'; /* - * Private Properties + * Private properties */ /** @var ManiaControl $maniaControl */ private $maniaControl = null; diff --git a/application/plugins/MCTeam/KarmaPlugin.php b/application/plugins/MCTeam/KarmaPlugin.php index 11270a1d..91d92031 100644 --- a/application/plugins/MCTeam/KarmaPlugin.php +++ b/application/plugins/MCTeam/KarmaPlugin.php @@ -65,7 +65,7 @@ class KarmaPlugin implements CallbackListener, TimerListener, Plugin { const MX_KARMA_GET_MAP_RATING = 'getMapRating'; /* - * Private Properties + * Private properties */ /** @var ManiaControl $maniaControl */ private $maniaControl = null; @@ -167,7 +167,7 @@ class KarmaPlugin implements CallbackListener, TimerListener, Plugin { $this->maniaControl->statisticManager->defineStatMetaData(self::STAT_PLAYER_MAPVOTES); // Register Stat in Simple StatsList - $this->maniaControl->statisticManager->simpleStatsList->registerStat(self::STAT_PLAYER_MAPVOTES, 100, "VM"); + $this->maniaControl->statisticManager->getSimpleStatsList()->registerStat(self::STAT_PLAYER_MAPVOTES, 100, "VM"); $this->updateManialink = true; @@ -909,9 +909,9 @@ class KarmaPlugin implements CallbackListener, TimerListener, Plugin { $posY = $this->maniaControl->settingManager->getSettingValue($this, self::SETTING_WIDGET_POSY); $width = $this->maniaControl->settingManager->getSettingValue($this, self::SETTING_WIDGET_WIDTH); $height = $this->maniaControl->settingManager->getSettingValue($this, self::SETTING_WIDGET_HEIGHT); - $labelStyle = $this->maniaControl->manialinkManager->styleManager->getDefaultLabelStyle(); - $quadStyle = $this->maniaControl->manialinkManager->styleManager->getDefaultQuadStyle(); - $quadSubstyle = $this->maniaControl->manialinkManager->styleManager->getDefaultQuadSubstyle(); + $labelStyle = $this->maniaControl->manialinkManager->getStyleManager()->getDefaultLabelStyle(); + $quadStyle = $this->maniaControl->manialinkManager->getStyleManager()->getDefaultQuadStyle(); + $quadSubstyle = $this->maniaControl->manialinkManager->getStyleManager()->getDefaultQuadSubstyle(); $manialink = new ManiaLink(self::MLID_KARMA); diff --git a/application/plugins/MCTeam/LocalRecordsPlugin.php b/application/plugins/MCTeam/LocalRecordsPlugin.php index 59728638..22bef71d 100644 --- a/application/plugins/MCTeam/LocalRecordsPlugin.php +++ b/application/plugins/MCTeam/LocalRecordsPlugin.php @@ -56,7 +56,7 @@ class LocalRecordsPlugin implements CallbackListener, CommandListener, TimerList const ACTION_SHOW_RECORDSLIST = 'LocalRecords.ShowRecordsList'; /* - * Private Properties + * Private properties */ /** @var ManiaControl $maniaControl */ private $maniaControl = null; @@ -217,9 +217,9 @@ class LocalRecordsPlugin implements CallbackListener, CommandListener, TimerList $width = $this->maniaControl->settingManager->getSettingValue($this, self::SETTING_WIDGET_WIDTH); $lines = $this->maniaControl->settingManager->getSettingValue($this, self::SETTING_WIDGET_LINESCOUNT); $lineHeight = $this->maniaControl->settingManager->getSettingValue($this, self::SETTING_WIDGET_LINEHEIGHT); - $labelStyle = $this->maniaControl->manialinkManager->styleManager->getDefaultLabelStyle(); - $quadStyle = $this->maniaControl->manialinkManager->styleManager->getDefaultQuadStyle(); - $quadSubstyle = $this->maniaControl->manialinkManager->styleManager->getDefaultQuadSubstyle(); + $labelStyle = $this->maniaControl->manialinkManager->getStyleManager()->getDefaultLabelStyle(); + $quadStyle = $this->maniaControl->manialinkManager->getStyleManager()->getDefaultQuadStyle(); + $quadSubstyle = $this->maniaControl->manialinkManager->getStyleManager()->getDefaultQuadSubstyle(); $records = $this->getLocalRecords($map); if (!is_array($records)) { @@ -548,8 +548,8 @@ class LocalRecordsPlugin implements CallbackListener, CommandListener, TimerList * @param Player $player */ public function showRecordsList(array $chat, Player $player) { - $width = $this->maniaControl->manialinkManager->styleManager->getListWidgetsWidth(); - $height = $this->maniaControl->manialinkManager->styleManager->getListWidgetsHeight(); + $width = $this->maniaControl->manialinkManager->getStyleManager()->getListWidgetsWidth(); + $height = $this->maniaControl->manialinkManager->getStyleManager()->getListWidgetsHeight(); // get PlayerList $records = $this->getLocalRecords($this->maniaControl->mapManager->getCurrentMap()); @@ -561,7 +561,7 @@ class LocalRecordsPlugin implements CallbackListener, CommandListener, TimerList $script->addFeature($paging); // Main frame - $frame = $this->maniaControl->manialinkManager->styleManager->getDefaultListFrame($script, $paging); + $frame = $this->maniaControl->manialinkManager->getStyleManager()->getDefaultListFrame($script, $paging); $maniaLink->add($frame); // Start offsets @@ -569,7 +569,7 @@ class LocalRecordsPlugin implements CallbackListener, CommandListener, TimerList $posY = $height / 2; // Predefine Description Label - $descriptionLabel = $this->maniaControl->manialinkManager->styleManager->getDefaultDescriptionLabel(); + $descriptionLabel = $this->maniaControl->manialinkManager->getStyleManager()->getDefaultDescriptionLabel(); $frame->add($descriptionLabel); // Headline diff --git a/application/plugins/MCTeam/ServerRankingPlugin.php b/application/plugins/MCTeam/ServerRankingPlugin.php index 130569f0..329a8935 100644 --- a/application/plugins/MCTeam/ServerRankingPlugin.php +++ b/application/plugins/MCTeam/ServerRankingPlugin.php @@ -44,8 +44,8 @@ class ServerRankingPlugin implements Plugin, CallbackListener, CommandListener { const SETTING_MAX_STORED_RECORDS = 'Maximum number of records per map for calculations'; const CB_RANK_BUILT = 'ServerRankingPlugin.RankBuilt'; - /** - * Private Properties + /* + * Private properties */ /** @var ManiaControl $maniaControl * */ private $maniaControl = null; @@ -477,8 +477,8 @@ class ServerRankingPlugin implements Plugin, CallbackListener, CommandListener { return; } - $width = $this->maniaControl->manialinkManager->styleManager->getListWidgetsWidth(); - $height = $this->maniaControl->manialinkManager->styleManager->getListWidgetsHeight(); + $width = $this->maniaControl->manialinkManager->getStyleManager()->getListWidgetsWidth(); + $height = $this->maniaControl->manialinkManager->getStyleManager()->getListWidgetsHeight(); // create manialink $maniaLink = new ManiaLink(ManialinkManager::MAIN_MLID); @@ -487,7 +487,7 @@ class ServerRankingPlugin implements Plugin, CallbackListener, CommandListener { $script->addFeature($paging); // Main frame - $frame = $this->maniaControl->manialinkManager->styleManager->getDefaultListFrame($script, $paging); + $frame = $this->maniaControl->manialinkManager->getStyleManager()->getDefaultListFrame($script, $paging); $maniaLink->add($frame); // Start offsets @@ -495,7 +495,7 @@ class ServerRankingPlugin implements Plugin, CallbackListener, CommandListener { $posY = $height / 2; //Predefine description Label - $descriptionLabel = $this->maniaControl->manialinkManager->styleManager->getDefaultDescriptionLabel(); + $descriptionLabel = $this->maniaControl->manialinkManager->getStyleManager()->getDefaultDescriptionLabel(); $frame->add($descriptionLabel); // Headline diff --git a/application/plugins/MCTeam/WidgetPlugin.php b/application/plugins/MCTeam/WidgetPlugin.php index ae749537..e743b879 100644 --- a/application/plugins/MCTeam/WidgetPlugin.php +++ b/application/plugins/MCTeam/WidgetPlugin.php @@ -70,7 +70,7 @@ class WidgetPlugin implements CallbackListener, TimerListener, Plugin { const SETTING_SERVERINFO_WIDGET_HEIGHT = 'ServerInfo-Widget-Size: Height'; /* - * Private Properties + * Private properties */ /** @var ManiaControl $maniaControl */ private $maniaControl = null; @@ -123,7 +123,7 @@ class WidgetPlugin implements CallbackListener, TimerListener, Plugin { $this->maniaControl = $maniaControl; // Set CustomUI Setting - $this->maniaControl->manialinkManager->customUIManager->setChallengeInfoVisible(false); + $this->maniaControl->manialinkManager->getCustomUIManager()->setChallengeInfoVisible(false); // Register for callbacks $this->maniaControl->callbackManager->registerCallbackListener(Callbacks::BEGINMAP, $this, 'handleOnBeginMap'); @@ -189,8 +189,8 @@ class WidgetPlugin implements CallbackListener, TimerListener, Plugin { $posY = $this->maniaControl->settingManager->getSettingValue($this, self::SETTING_MAP_WIDGET_POSY); $width = $this->maniaControl->settingManager->getSettingValue($this, self::SETTING_MAP_WIDGET_WIDTH); $height = $this->maniaControl->settingManager->getSettingValue($this, self::SETTING_MAP_WIDGET_HEIGHT); - $quadStyle = $this->maniaControl->manialinkManager->styleManager->getDefaultQuadStyle(); - $quadSubstyle = $this->maniaControl->manialinkManager->styleManager->getDefaultQuadSubstyle(); + $quadStyle = $this->maniaControl->manialinkManager->getStyleManager()->getDefaultQuadStyle(); + $quadSubstyle = $this->maniaControl->manialinkManager->getStyleManager()->getDefaultQuadSubstyle(); $maniaLink = new ManiaLink(self::MLID_MAP_WIDGET); $script = new Script(); @@ -231,8 +231,8 @@ class WidgetPlugin implements CallbackListener, TimerListener, Plugin { if (isset($map->mx->pageurl)) { $quad = new Quad(); $frame->add($quad); - $quad->setImageFocus($this->maniaControl->manialinkManager->iconManager->getIcon(IconManager::MX_ICON_MOVER)); - $quad->setImage($this->maniaControl->manialinkManager->iconManager->getIcon(IconManager::MX_ICON)); + $quad->setImageFocus($this->maniaControl->manialinkManager->getIconManager()->getIcon(IconManager::MX_ICON_MOVER)); + $quad->setImage($this->maniaControl->manialinkManager->getIconManager()->getIcon(IconManager::MX_ICON)); $quad->setPosition(-$width / 2 + 4, -1.5, -0.5); $quad->setSize(4, 4); $quad->setUrl($map->mx->pageurl); @@ -252,8 +252,8 @@ class WidgetPlugin implements CallbackListener, TimerListener, Plugin { $posY = $this->maniaControl->settingManager->getSettingValue($this, self::SETTING_CLOCK_WIDGET_POSY); $width = $this->maniaControl->settingManager->getSettingValue($this, self::SETTING_CLOCK_WIDGET_WIDTH); $height = $this->maniaControl->settingManager->getSettingValue($this, self::SETTING_CLOCK_WIDGET_HEIGHT); - $quadStyle = $this->maniaControl->manialinkManager->styleManager->getDefaultQuadStyle(); - $quadSubstyle = $this->maniaControl->manialinkManager->styleManager->getDefaultQuadSubstyle(); + $quadStyle = $this->maniaControl->manialinkManager->getStyleManager()->getDefaultQuadStyle(); + $quadSubstyle = $this->maniaControl->manialinkManager->getStyleManager()->getDefaultQuadSubstyle(); $maniaLink = new ManiaLink(self::MLID_CLOCK_WIDGET); @@ -291,8 +291,8 @@ class WidgetPlugin implements CallbackListener, TimerListener, Plugin { $posY = $this->maniaControl->settingManager->getSettingValue($this, self::SETTING_SERVERINFO_WIDGET_POSY); $width = $this->maniaControl->settingManager->getSettingValue($this, self::SETTING_SERVERINFO_WIDGET_WIDTH); $height = $this->maniaControl->settingManager->getSettingValue($this, self::SETTING_SERVERINFO_WIDGET_HEIGHT); - $quadStyle = $this->maniaControl->manialinkManager->styleManager->getDefaultQuadStyle(); - $quadSubstyle = $this->maniaControl->manialinkManager->styleManager->getDefaultQuadSubstyle(); + $quadStyle = $this->maniaControl->manialinkManager->getStyleManager()->getDefaultQuadStyle(); + $quadSubstyle = $this->maniaControl->manialinkManager->getStyleManager()->getDefaultQuadSubstyle(); $maniaLink = new ManiaLink(self::MLID_SERVERINFO_WIDGET); @@ -421,9 +421,9 @@ class WidgetPlugin implements CallbackListener, TimerListener, Plugin { $posY = $this->maniaControl->settingManager->getSettingValue($this, self::SETTING_NEXTMAP_WIDGET_POSY); $width = $this->maniaControl->settingManager->getSettingValue($this, self::SETTING_NEXTMAP_WIDGET_WIDTH); $height = $this->maniaControl->settingManager->getSettingValue($this, self::SETTING_NEXTMAP_WIDGET_HEIGHT); - $quadStyle = $this->maniaControl->manialinkManager->styleManager->getDefaultQuadStyle(); - $quadSubstyle = $this->maniaControl->manialinkManager->styleManager->getDefaultQuadSubstyle(); - $labelStyle = $this->maniaControl->manialinkManager->styleManager->getDefaultLabelStyle(); + $quadStyle = $this->maniaControl->manialinkManager->getStyleManager()->getDefaultQuadStyle(); + $quadSubstyle = $this->maniaControl->manialinkManager->getStyleManager()->getDefaultQuadSubstyle(); + $labelStyle = $this->maniaControl->manialinkManager->getStyleManager()->getDefaultLabelStyle(); $maniaLink = new ManiaLink(self::MLID_NEXTMAP_WIDGET); @@ -440,7 +440,7 @@ class WidgetPlugin implements CallbackListener, TimerListener, Plugin { $backgroundQuad->setStyles($quadStyle, $quadSubstyle); // Check if the Next Map is a queued Map - $queuedMap = $this->maniaControl->mapManager->mapQueue->getNextMap(); + $queuedMap = $this->maniaControl->mapManager->getMapQueue()->getNextMap(); /** * @var Player $requester diff --git a/application/plugins/TheM/QueuePlugin.php b/application/plugins/TheM/QueuePlugin.php index b4b52ac9..17d3be75 100644 --- a/application/plugins/TheM/QueuePlugin.php +++ b/application/plugins/TheM/QueuePlugin.php @@ -30,7 +30,7 @@ use Maniaplanet\DedicatedServer\Xmlrpc\Exception; // TODO: idlekick function (?) class QueuePlugin implements CallbackListener, ManialinkPageAnswerListener, TimerListener, Plugin { - /** + /* * Constants */ const ID = 22; @@ -47,7 +47,7 @@ class QueuePlugin implements CallbackListener, ManialinkPageAnswerListener, Time const QUEUE_ACTIVE_ON_PASS = 'Activate queue when there is a play password'; const QUEUE_CHATMESSAGES = 'Activate chat messages on queue join/leave/move to play'; - /** + /* * Private properties */ /** @var ManiaControl $maniaControl */ @@ -141,8 +141,8 @@ class QueuePlugin implements CallbackListener, ManialinkPageAnswerListener, Time private function showJoinQueueWidget(Player $player) { $maniaLink = new ManiaLink(self::ML_ID); - $quadStyle = $this->maniaControl->manialinkManager->styleManager->getDefaultMainWindowStyle(); - $quadSubstyle = $this->maniaControl->manialinkManager->styleManager->getDefaultMainWindowSubStyle(); + $quadStyle = $this->maniaControl->manialinkManager->getStyleManager()->getDefaultMainWindowStyle(); + $quadSubstyle = $this->maniaControl->manialinkManager->getStyleManager()->getDefaultMainWindowSubStyle(); $maxQueue = $this->maniaControl->settingManager->getSettingValue($this, self::QUEUE_MAX); // Main frame @@ -403,8 +403,8 @@ class QueuePlugin implements CallbackListener, ManialinkPageAnswerListener, Time private function showPlayWidget(Player $player) { $maniaLink = new ManiaLink(self::ML_ID); - $quadStyle = $this->maniaControl->manialinkManager->styleManager->getDefaultMainWindowStyle(); - $quadSubstyle = $this->maniaControl->manialinkManager->styleManager->getDefaultMainWindowSubStyle(); + $quadStyle = $this->maniaControl->manialinkManager->getStyleManager()->getDefaultMainWindowStyle(); + $quadSubstyle = $this->maniaControl->manialinkManager->getStyleManager()->getDefaultMainWindowSubStyle(); // Main frame $frame = new Frame(); diff --git a/application/plugins/TheM/TeamSpeakPlugin.php b/application/plugins/TheM/TeamSpeakPlugin.php index ca6ca0bb..27b5642b 100644 --- a/application/plugins/TheM/TeamSpeakPlugin.php +++ b/application/plugins/TheM/TeamSpeakPlugin.php @@ -26,7 +26,7 @@ use ManiaControl\Utils\Formatter; * @author TheM */ class TeamSpeakPlugin implements CallbackListener, CommandListener, ManialinkPageAnswerListener, TimerListener, Plugin { - /** + /* * Constants */ const ID = 23; @@ -47,7 +47,7 @@ class TeamSpeakPlugin implements CallbackListener, CommandListener, ManialinkPag const TS_ICON = 'Teamspeak.png'; const TS_ICON_MOVER = 'Teamspeak_logo_press.png'; - /** + /* * Private properties */ /** @var ManiaControl $maniaControl */ @@ -129,8 +129,8 @@ class TeamSpeakPlugin implements CallbackListener, CommandListener, ManialinkPag $this->refreshTime = time(); - $this->maniaControl->manialinkManager->iconManager->addIcon(self::TS_ICON); - $this->maniaControl->manialinkManager->iconManager->addIcon(self::TS_ICON_MOVER); + $this->maniaControl->manialinkManager->getIconManager()->addIcon(self::TS_ICON); + $this->maniaControl->manialinkManager->getIconManager()->addIcon(self::TS_ICON_MOVER); $this->maniaControl->timerManager->registerTimerListening($this, 'ts3_queryServer', 1000); @@ -311,8 +311,8 @@ class TeamSpeakPlugin implements CallbackListener, CommandListener, ManialinkPag private function addToMenu() { $this->maniaControl->manialinkManager->registerManialinkPageAnswerListener(self::ACTION_OPEN_TSVIEWER, $this, 'command_tsViewer'); $itemQuad = new Quad(); - $itemQuad->setImage($this->maniaControl->manialinkManager->iconManager->getIcon(self::TS_ICON)); - $itemQuad->setImageFocus($this->maniaControl->manialinkManager->iconManager->getIcon(self::TS_ICON_MOVER)); + $itemQuad->setImage($this->maniaControl->manialinkManager->getIconManager()->getIcon(self::TS_ICON)); + $itemQuad->setImageFocus($this->maniaControl->manialinkManager->getIconManager()->getIcon(self::TS_ICON_MOVER)); $itemQuad->setAction(self::ACTION_OPEN_TSVIEWER); $this->maniaControl->actionsMenu->addMenuItem($itemQuad, true, 1, 'Open TeamSpeak Viewer'); } @@ -341,10 +341,10 @@ class TeamSpeakPlugin implements CallbackListener, CommandListener, ManialinkPag * @param mixed $player */ private function showWidget($player) { - $width = $this->maniaControl->manialinkManager->styleManager->getListWidgetsWidth(); - $height = $this->maniaControl->manialinkManager->styleManager->getListWidgetsHeight(); - $quadStyle = $this->maniaControl->manialinkManager->styleManager->getDefaultMainWindowStyle(); - $quadSubstyle = $this->maniaControl->manialinkManager->styleManager->getDefaultMainWindowSubStyle(); + $width = $this->maniaControl->manialinkManager->getStyleManager()->getListWidgetsWidth(); + $height = $this->maniaControl->manialinkManager->getStyleManager()->getListWidgetsHeight(); + $quadStyle = $this->maniaControl->manialinkManager->getStyleManager()->getDefaultMainWindowStyle(); + $quadSubstyle = $this->maniaControl->manialinkManager->getStyleManager()->getDefaultMainWindowSubStyle(); $maniaLink = new ManiaLink(ManialinkManager::MAIN_MLID);