changed direct public access of maniacontrol properties to using getter methods
This commit is contained in:
		| @@ -50,15 +50,15 @@ class ActionsMenu implements CallbackListener, ManialinkPageAnswerListener { | |||||||
| 	public function __construct(ManiaControl $maniaControl) { | 	public function __construct(ManiaControl $maniaControl) { | ||||||
| 		$this->maniaControl = $maniaControl; | 		$this->maniaControl = $maniaControl; | ||||||
|  |  | ||||||
| 		// Init settings | 		// Settings | ||||||
| 		$this->maniaControl->settingManager->initSetting($this, self::SETTING_MENU_POSX, 156.); | 		$this->maniaControl->getSettingManager()->initSetting($this, self::SETTING_MENU_POSX, 156.); | ||||||
| 		$this->maniaControl->settingManager->initSetting($this, self::SETTING_MENU_POSY, -17.); | 		$this->maniaControl->getSettingManager()->initSetting($this, self::SETTING_MENU_POSY, -17.); | ||||||
| 		$this->maniaControl->settingManager->initSetting($this, self::SETTING_MENU_ITEMSIZE, 6.); | 		$this->maniaControl->getSettingManager()->initSetting($this, self::SETTING_MENU_ITEMSIZE, 6.); | ||||||
|  |  | ||||||
| 		// Register for callbacks | 		// Callbacks | ||||||
| 		$this->maniaControl->callbackManager->registerCallbackListener(Callbacks::AFTERINIT, $this, 'handleAfterInit'); | 		$this->maniaControl->getCallbackManager()->registerCallbackListener(Callbacks::AFTERINIT, $this, 'handleAfterInit'); | ||||||
| 		$this->maniaControl->callbackManager->registerCallbackListener(PlayerManager::CB_PLAYERCONNECT, $this, 'handlePlayerJoined'); | 		$this->maniaControl->getCallbackManager()->registerCallbackListener(PlayerManager::CB_PLAYERCONNECT, $this, 'handlePlayerJoined'); | ||||||
| 		$this->maniaControl->callbackManager->registerCallbackListener(AuthenticationManager::CB_AUTH_LEVEL_CHANGED, $this, 'handlePlayerJoined'); | 		$this->maniaControl->getCallbackManager()->registerCallbackListener(AuthenticationManager::CB_AUTH_LEVEL_CHANGED, $this, 'handlePlayerJoined'); | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	/** | 	/** | ||||||
| @@ -100,10 +100,10 @@ class ActionsMenu implements CallbackListener, ManialinkPageAnswerListener { | |||||||
| 		if (!$this->initCompleted) { | 		if (!$this->initCompleted) { | ||||||
| 			return; | 			return; | ||||||
| 		} | 		} | ||||||
| 		$players = $this->maniaControl->playerManager->getPlayers(); | 		$players = $this->maniaControl->getPlayerManager()->getPlayers(); | ||||||
| 		foreach ($players as $player) { | 		foreach ($players as $player) { | ||||||
| 			$manialink = $this->buildMenuIconsManialink($player); | 			$manialink = $this->buildMenuIconsManialink($player); | ||||||
| 			$this->maniaControl->manialinkManager->sendManialink($manialink, $player->login); | 			$this->maniaControl->getManialinkManager()->sendManialink($manialink, $player->login); | ||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| @@ -114,17 +114,17 @@ class ActionsMenu implements CallbackListener, ManialinkPageAnswerListener { | |||||||
| 	 * @return ManiaLink | 	 * @return ManiaLink | ||||||
| 	 */ | 	 */ | ||||||
| 	private function buildMenuIconsManialink(Player $player) { | 	private function buildMenuIconsManialink(Player $player) { | ||||||
| 		$posX              = $this->maniaControl->settingManager->getSettingValue($this, self::SETTING_MENU_POSX); | 		$posX              = $this->maniaControl->getSettingManager()->getSettingValue($this, self::SETTING_MENU_POSX); | ||||||
| 		$posY              = $this->maniaControl->settingManager->getSettingValue($this, self::SETTING_MENU_POSY); | 		$posY              = $this->maniaControl->getSettingManager()->getSettingValue($this, self::SETTING_MENU_POSY); | ||||||
| 		$itemSize          = $this->maniaControl->settingManager->getSettingValue($this, self::SETTING_MENU_ITEMSIZE); | 		$itemSize          = $this->maniaControl->getSettingManager()->getSettingValue($this, self::SETTING_MENU_ITEMSIZE); | ||||||
| 		$shootManiaOffset  = $this->maniaControl->manialinkManager->getStyleManager()->getDefaultIconOffsetSM(); | 		$shootManiaOffset  = $this->maniaControl->getManialinkManager()->getStyleManager()->getDefaultIconOffsetSM(); | ||||||
| 		$quadStyle         = $this->maniaControl->manialinkManager->getStyleManager()->getDefaultQuadStyle(); | 		$quadStyle         = $this->maniaControl->getManialinkManager()->getStyleManager()->getDefaultQuadStyle(); | ||||||
| 		$quadSubstyle      = $this->maniaControl->manialinkManager->getStyleManager()->getDefaultQuadSubstyle(); | 		$quadSubstyle      = $this->maniaControl->getManialinkManager()->getStyleManager()->getDefaultQuadSubstyle(); | ||||||
| 		$itemMarginFactorX = 1.3; | 		$itemMarginFactorX = 1.3; | ||||||
| 		$itemMarginFactorY = 1.2; | 		$itemMarginFactorY = 1.2; | ||||||
|  |  | ||||||
| 		// If game is shootmania lower the icons position by 20 | 		// If game is shootmania lower the icons position by 20 | ||||||
| 		if ($this->maniaControl->mapManager->getCurrentMap() | 		if ($this->maniaControl->getMapManager()->getCurrentMap() | ||||||
| 		                                   ->getGame() === 'sm' | 		                                   ->getGame() === 'sm' | ||||||
| 		) { | 		) { | ||||||
| 			$posY -= $shootManiaOffset; | 			$posY -= $shootManiaOffset; | ||||||
| @@ -135,7 +135,7 @@ class ActionsMenu implements CallbackListener, ManialinkPageAnswerListener { | |||||||
| 		/* | 		/* | ||||||
| 		 * Admin Menu | 		 * Admin Menu | ||||||
| 		 */ | 		 */ | ||||||
| 		if ($this->maniaControl->authenticationManager->checkRight($player, AuthenticationManager::AUTH_LEVEL_MODERATOR)) { | 		if ($this->maniaControl->getAuthenticationManager()->checkRight($player, AuthenticationManager::AUTH_LEVEL_MODERATOR)) { | ||||||
| 			// Admin Menu Icon Frame | 			// Admin Menu Icon Frame | ||||||
| 			$iconFrame = new Frame(); | 			$iconFrame = new Frame(); | ||||||
| 			$manialink->add($iconFrame); | 			$manialink->add($iconFrame); | ||||||
| @@ -313,6 +313,6 @@ class ActionsMenu implements CallbackListener, ManialinkPageAnswerListener { | |||||||
| 	 */ | 	 */ | ||||||
| 	public function handlePlayerJoined(Player $player) { | 	public function handlePlayerJoined(Player $player) { | ||||||
| 		$maniaLink = $this->buildMenuIconsManialink($player); | 		$maniaLink = $this->buildMenuIconsManialink($player); | ||||||
| 		$this->maniaControl->manialinkManager->sendManialink($maniaLink, $player->login); | 		$this->maniaControl->getManialinkManager()->sendManialink($maniaLink, $player); | ||||||
| 	} | 	} | ||||||
| } | } | ||||||
|   | |||||||
| @@ -38,24 +38,25 @@ class AdminLists implements ManialinkPageAnswerListener, CallbackListener { | |||||||
| 	private $adminListShown = array(); | 	private $adminListShown = array(); | ||||||
|  |  | ||||||
| 	/** | 	/** | ||||||
| 	 * Create a PlayerList Instance | 	 * Construct a new PlayerList instance | ||||||
| 	 * | 	 * | ||||||
| 	 * @param ManiaControl $maniaControl | 	 * @param ManiaControl $maniaControl | ||||||
| 	 */ | 	 */ | ||||||
| 	public function __construct(ManiaControl $maniaControl) { | 	public function __construct(ManiaControl $maniaControl) { | ||||||
| 		$this->maniaControl = $maniaControl; | 		$this->maniaControl = $maniaControl; | ||||||
|  |  | ||||||
| 		$this->maniaControl->callbackManager->registerCallbackListener(CallbackManager::CB_MP_PLAYERMANIALINKPAGEANSWER, $this, 'handleManialinkPageAnswer'); | 		// Callbacks | ||||||
| 		$this->maniaControl->callbackManager->registerCallbackListener(ManialinkManager::CB_MAIN_WINDOW_CLOSED, $this, 'closeWidget'); | 		$this->maniaControl->getCallbackManager()->registerCallbackListener(CallbackManager::CB_MP_PLAYERMANIALINKPAGEANSWER, $this, 'handleManialinkPageAnswer'); | ||||||
| 		$this->maniaControl->callbackManager->registerCallbackListener(ManialinkManager::CB_MAIN_WINDOW_OPENED, $this, 'handleWidgetOpened'); | 		$this->maniaControl->getCallbackManager()->registerCallbackListener(ManialinkManager::CB_MAIN_WINDOW_CLOSED, $this, 'closeWidget'); | ||||||
| 		$this->maniaControl->callbackManager->registerCallbackListener(AuthenticationManager::CB_AUTH_LEVEL_CHANGED, $this, 'updateWidget'); | 		$this->maniaControl->getCallbackManager()->registerCallbackListener(ManialinkManager::CB_MAIN_WINDOW_OPENED, $this, 'handleWidgetOpened'); | ||||||
|  | 		$this->maniaControl->getCallbackManager()->registerCallbackListener(AuthenticationManager::CB_AUTH_LEVEL_CHANGED, $this, 'updateWidget'); | ||||||
|  |  | ||||||
| 		// Menu Entry AdminList | 		// Menu Entry AdminList | ||||||
| 		$this->maniaControl->manialinkManager->registerManialinkPageAnswerListener(self::ACTION_OPEN_ADMIN_LIST, $this, 'openAdminList'); | 		$this->maniaControl->getManialinkManager()->registerManialinkPageAnswerListener(self::ACTION_OPEN_ADMIN_LIST, $this, 'openAdminList'); | ||||||
| 		$itemQuad = new Quad_UIConstruction_Buttons(); | 		$itemQuad = new Quad_UIConstruction_Buttons(); | ||||||
| 		$itemQuad->setSubStyle($itemQuad::SUBSTYLE_Author); | 		$itemQuad->setSubStyle($itemQuad::SUBSTYLE_Author); | ||||||
| 		$itemQuad->setAction(self::ACTION_OPEN_ADMIN_LIST); | 		$itemQuad->setAction(self::ACTION_OPEN_ADMIN_LIST); | ||||||
| 		$this->maniaControl->actionsMenu->addMenuItem($itemQuad, false, 50, 'Open AdminList'); | 		$this->maniaControl->getActionsMenu()->addMenuItem($itemQuad, false, 50, 'Open AdminList'); | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	/** | 	/** | ||||||
| @@ -76,11 +77,11 @@ class AdminLists implements ManialinkPageAnswerListener, CallbackListener { | |||||||
| 	public function showAdminLists(Player $player) { | 	public function showAdminLists(Player $player) { | ||||||
| 		$this->adminListShown[$player->login] = true; | 		$this->adminListShown[$player->login] = true; | ||||||
|  |  | ||||||
| 		$width  = $this->maniaControl->manialinkManager->getStyleManager()->getListWidgetsWidth(); | 		$width  = $this->maniaControl->getManialinkManager()->getStyleManager()->getListWidgetsWidth(); | ||||||
| 		$height = $this->maniaControl->manialinkManager->getStyleManager()->getListWidgetsHeight(); | 		$height = $this->maniaControl->getManialinkManager()->getStyleManager()->getListWidgetsHeight(); | ||||||
|  |  | ||||||
| 		// get Admins | 		// get Admins | ||||||
| 		$admins = $this->maniaControl->authenticationManager->getAdmins(); | 		$admins = $this->maniaControl->getAuthenticationManager()->getAdmins(); | ||||||
|  |  | ||||||
| 		//Create ManiaLink | 		//Create ManiaLink | ||||||
| 		$maniaLink = new ManiaLink(ManialinkManager::MAIN_MLID); | 		$maniaLink = new ManiaLink(ManialinkManager::MAIN_MLID); | ||||||
| @@ -89,7 +90,7 @@ class AdminLists implements ManialinkPageAnswerListener, CallbackListener { | |||||||
| 		$script->addFeature($paging); | 		$script->addFeature($paging); | ||||||
|  |  | ||||||
| 		// Main frame | 		// Main frame | ||||||
| 		$frame = $this->maniaControl->manialinkManager->getStyleManager()->getDefaultListFrame($script, $paging); | 		$frame = $this->maniaControl->getManialinkManager()->getStyleManager()->getDefaultListFrame($script, $paging); | ||||||
| 		$maniaLink->add($frame); | 		$maniaLink->add($frame); | ||||||
|  |  | ||||||
| 		// Start offsets | 		// Start offsets | ||||||
| @@ -97,15 +98,15 @@ class AdminLists implements ManialinkPageAnswerListener, CallbackListener { | |||||||
| 		$posY = $height / 2; | 		$posY = $height / 2; | ||||||
|  |  | ||||||
| 		//Predefine description Label | 		//Predefine description Label | ||||||
| 		$descriptionLabel = $this->maniaControl->manialinkManager->getStyleManager()->getDefaultDescriptionLabel(); | 		$descriptionLabel = $this->maniaControl->getManialinkManager()->getStyleManager()->getDefaultDescriptionLabel(); | ||||||
| 		$frame->add($descriptionLabel); | 		$frame->add($descriptionLabel); | ||||||
|  |  | ||||||
| 		// Headline | 		// Headline | ||||||
| 		$headFrame = new Frame(); | 		$headFrame = new Frame(); | ||||||
| 		$frame->add($headFrame); | 		$frame->add($headFrame); | ||||||
| 		$headFrame->setY($posY - 5); | 		$headFrame->setY($posY - 5); | ||||||
| 		$array = array("Id" => $posX + 5, "Nickname" => $posX + 18, "Login" => $posX + 70, "Actions" => $posX + 120); | 		$array = array('Id' => $posX + 5, 'Nickname' => $posX + 18, 'Login' => $posX + 70, 'Actions' => $posX + 120); | ||||||
| 		$this->maniaControl->manialinkManager->labelLine($headFrame, $array); | 		$this->maniaControl->getManialinkManager()->labelLine($headFrame, $array); | ||||||
|  |  | ||||||
| 		$index = 1; | 		$index = 1; | ||||||
| 		$posY -= 10; | 		$posY -= 10; | ||||||
| @@ -133,7 +134,7 @@ class AdminLists implements ManialinkPageAnswerListener, CallbackListener { | |||||||
| 			} | 			} | ||||||
|  |  | ||||||
| 			$array = array($index => $posX + 5, $admin->nickname => $posX + 18, $admin->login => $posX + 70); | 			$array = array($index => $posX + 5, $admin->nickname => $posX + 18, $admin->login => $posX + 70); | ||||||
| 			$this->maniaControl->manialinkManager->labelLine($playerFrame, $array); | 			$this->maniaControl->getManialinkManager()->labelLine($playerFrame, $array); | ||||||
|  |  | ||||||
|  |  | ||||||
| 			// Level Quad | 			// Level Quad | ||||||
| @@ -149,12 +150,12 @@ class AdminLists implements ManialinkPageAnswerListener, CallbackListener { | |||||||
| 			$rightLabel->setX($posX + 13.9); | 			$rightLabel->setX($posX + 13.9); | ||||||
| 			$rightLabel->setTextSize(0.8); | 			$rightLabel->setTextSize(0.8); | ||||||
| 			$rightLabel->setZ(10); | 			$rightLabel->setZ(10); | ||||||
| 			$rightLabel->setText($this->maniaControl->authenticationManager->getAuthLevelAbbreviation($admin)); | 			$rightLabel->setText($this->maniaControl->getAuthenticationManager()->getAuthLevelAbbreviation($admin)); | ||||||
| 			$description = $this->maniaControl->authenticationManager->getAuthLevelName($admin) . " " . $admin->nickname; | 			$description = $this->maniaControl->getAuthenticationManager()->getAuthLevelName($admin) . " " . $admin->nickname; | ||||||
| 			$rightLabel->addTooltipLabelFeature($descriptionLabel, $description); | 			$rightLabel->addTooltipLabelFeature($descriptionLabel, $description); | ||||||
|  |  | ||||||
| 			//Revoke Button | 			//Revoke Button | ||||||
| 			if ($admin->authLevel > 0 && $this->maniaControl->authenticationManager->checkRight($player, $admin->authLevel + 1)) { | 			if ($admin->authLevel > 0 && $this->maniaControl->getAuthenticationManager()->checkRight($player, $admin->authLevel + 1)) { | ||||||
| 				//Settings | 				//Settings | ||||||
| 				$style      = Label_Text::STYLE_TextCardSmall; | 				$style      = Label_Text::STYLE_TextCardSmall; | ||||||
| 				$textColor  = 'FFF'; | 				$textColor  = 'FFF'; | ||||||
| @@ -186,7 +187,7 @@ class AdminLists implements ManialinkPageAnswerListener, CallbackListener { | |||||||
| 		} | 		} | ||||||
|  |  | ||||||
| 		// Render and display xml | 		// Render and display xml | ||||||
| 		$this->maniaControl->manialinkManager->displayWidget($maniaLink, $player, 'AdminList'); | 		$this->maniaControl->getManialinkManager()->displayWidget($maniaLink, $player, 'AdminList'); | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	/** | 	/** | ||||||
| @@ -207,7 +208,7 @@ class AdminLists implements ManialinkPageAnswerListener, CallbackListener { | |||||||
|  |  | ||||||
| 		switch ($action) { | 		switch ($action) { | ||||||
| 			case self::ACTION_REVOKE_RIGHTS: | 			case self::ACTION_REVOKE_RIGHTS: | ||||||
| 				$this->maniaControl->playerManager->getPlayerActions()->revokeAuthLevel($adminLogin, $targetLogin); | 				$this->maniaControl->getPlayerManager()->getPlayerActions()->revokeAuthLevel($adminLogin, $targetLogin); | ||||||
| 				break; | 				break; | ||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
| @@ -220,7 +221,7 @@ class AdminLists implements ManialinkPageAnswerListener, CallbackListener { | |||||||
| 	public function updateWidget(Player $player) { | 	public function updateWidget(Player $player) { | ||||||
| 		foreach ($this->adminListShown as $login => $shown) { | 		foreach ($this->adminListShown as $login => $shown) { | ||||||
| 			if ($shown) { | 			if ($shown) { | ||||||
| 				$player = $this->maniaControl->playerManager->getPlayer($login); | 				$player = $this->maniaControl->getPlayerManager()->getPlayer($login); | ||||||
| 				if ($player) { | 				if ($player) { | ||||||
| 					$this->showAdminLists($player); | 					$this->showAdminLists($player); | ||||||
| 				} else { | 				} else { | ||||||
|   | |||||||
| @@ -21,17 +21,17 @@ class AuthCommands implements CommandListener { | |||||||
| 	private $maniaControl = null; | 	private $maniaControl = null; | ||||||
|  |  | ||||||
| 	/** | 	/** | ||||||
| 	 * Create a new AuthCommands instance | 	 * Construct a new AuthCommands instance | ||||||
| 	 * | 	 * | ||||||
| 	 * @param ManiaControl $maniaControl | 	 * @param ManiaControl $maniaControl | ||||||
| 	 */ | 	 */ | ||||||
| 	public function __construct(ManiaControl $maniaControl) { | 	public function __construct(ManiaControl $maniaControl) { | ||||||
| 		$this->maniaControl = $maniaControl; | 		$this->maniaControl = $maniaControl; | ||||||
|  |  | ||||||
| 		// Register for commands | 		// Commands | ||||||
| 		$this->maniaControl->commandManager->registerCommandListener('addsuperadmin', $this, 'command_AddSuperAdmin', true, 'Add Player to the AdminList as SuperAdmin.'); | 		$this->maniaControl->getCommandManager()->registerCommandListener('addsuperadmin', $this, 'command_AddSuperAdmin', true, 'Add Player to the AdminList as SuperAdmin.'); | ||||||
| 		$this->maniaControl->commandManager->registerCommandListener('addadmin', $this, 'command_AddAdmin', true, 'Add Player to the AdminList as Admin.'); | 		$this->maniaControl->getCommandManager()->registerCommandListener('addadmin', $this, 'command_AddAdmin', true, 'Add Player to the AdminList as Admin.'); | ||||||
| 		$this->maniaControl->commandManager->registerCommandListener('addmod', $this, 'command_AddModerator', true, 'Add Player to the AdminList as Moderator.'); | 		$this->maniaControl->getCommandManager()->registerCommandListener('addmod', $this, 'command_AddModerator', true, 'Add Player to the AdminList as Moderator.'); | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	/** | 	/** | ||||||
| @@ -42,7 +42,7 @@ class AuthCommands implements CommandListener { | |||||||
| 	 */ | 	 */ | ||||||
| 	public function command_AddSuperAdmin(array $chatCallback, Player $player) { | 	public function command_AddSuperAdmin(array $chatCallback, Player $player) { | ||||||
| 		if (!AuthenticationManager::checkRight($player, AuthenticationManager::AUTH_LEVEL_MASTERADMIN)) { | 		if (!AuthenticationManager::checkRight($player, AuthenticationManager::AUTH_LEVEL_MASTERADMIN)) { | ||||||
| 			$this->maniaControl->authenticationManager->sendNotAllowed($player); | 			$this->maniaControl->getAuthenticationManager()->sendNotAllowed($player); | ||||||
| 			return; | 			return; | ||||||
| 		} | 		} | ||||||
| 		$text         = $chatCallback[1][2]; | 		$text         = $chatCallback[1][2]; | ||||||
| @@ -51,18 +51,18 @@ class AuthCommands implements CommandListener { | |||||||
| 			$this->sendAddSuperAdminUsageInfo($player); | 			$this->sendAddSuperAdminUsageInfo($player); | ||||||
| 			return; | 			return; | ||||||
| 		} | 		} | ||||||
| 		$target = $this->maniaControl->playerManager->getPlayer($commandParts[1]); | 		$target = $this->maniaControl->getPlayerManager()->getPlayer($commandParts[1]); | ||||||
| 		if (!$target) { | 		if (!$target) { | ||||||
| 			$this->maniaControl->chat->sendError("Player '{$commandParts[1]}' not found!", $player->login); | 			$this->maniaControl->getChat()->sendError("Player '{$commandParts[1]}' not found!", $player); | ||||||
| 			return; | 			return; | ||||||
| 		} | 		} | ||||||
| 		$success = $this->maniaControl->authenticationManager->grantAuthLevel($target, AuthenticationManager::AUTH_LEVEL_SUPERADMIN); | 		$success = $this->maniaControl->getAuthenticationManager()->grantAuthLevel($target, AuthenticationManager::AUTH_LEVEL_SUPERADMIN); | ||||||
| 		if (!$success) { | 		if (!$success) { | ||||||
| 			$this->maniaControl->chat->sendError('Error occurred.', $player->login); | 			$this->maniaControl->getChat()->sendError('Error occurred.', $player); | ||||||
| 			return; | 			return; | ||||||
| 		} | 		} | ||||||
| 		$message = '$<' . $player->nickname . '$> added $<' . $target->nickname . '$> as SuperAdmin!'; | 		$message = $player->getEscapedNickname() . ' added ' . $target->getEscapedNickname() . ' as SuperAdmin!'; | ||||||
| 		$this->maniaControl->chat->sendSuccess($message); | 		$this->maniaControl->getChat()->sendSuccess($message); | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	/** | 	/** | ||||||
| @@ -73,7 +73,7 @@ class AuthCommands implements CommandListener { | |||||||
| 	 */ | 	 */ | ||||||
| 	private function sendAddSuperAdminUsageInfo(Player $player) { | 	private function sendAddSuperAdminUsageInfo(Player $player) { | ||||||
| 		$message = "Usage Example: '//addsuperadmin login'"; | 		$message = "Usage Example: '//addsuperadmin login'"; | ||||||
| 		return $this->maniaControl->chat->sendUsageInfo($message, $player->login); | 		return $this->maniaControl->getChat()->sendUsageInfo($message, $player); | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	/** | 	/** | ||||||
| @@ -84,7 +84,7 @@ class AuthCommands implements CommandListener { | |||||||
| 	 */ | 	 */ | ||||||
| 	public function command_AddAdmin(array $chatCallback, Player $player) { | 	public function command_AddAdmin(array $chatCallback, Player $player) { | ||||||
| 		if (!AuthenticationManager::checkRight($player, AuthenticationManager::AUTH_LEVEL_SUPERADMIN)) { | 		if (!AuthenticationManager::checkRight($player, AuthenticationManager::AUTH_LEVEL_SUPERADMIN)) { | ||||||
| 			$this->maniaControl->authenticationManager->sendNotAllowed($player); | 			$this->maniaControl->getAuthenticationManager()->sendNotAllowed($player); | ||||||
| 			return; | 			return; | ||||||
| 		} | 		} | ||||||
| 		$text         = $chatCallback[1][2]; | 		$text         = $chatCallback[1][2]; | ||||||
| @@ -93,18 +93,18 @@ class AuthCommands implements CommandListener { | |||||||
| 			$this->sendAddAdminUsageInfo($player); | 			$this->sendAddAdminUsageInfo($player); | ||||||
| 			return; | 			return; | ||||||
| 		} | 		} | ||||||
| 		$target = $this->maniaControl->playerManager->getPlayer($commandParts[1]); | 		$target = $this->maniaControl->getPlayerManager()->getPlayer($commandParts[1]); | ||||||
| 		if (!$target) { | 		if (!$target) { | ||||||
| 			$this->maniaControl->chat->sendError("Player '{$commandParts[1]}' not found!", $player->login); | 			$this->maniaControl->getChat()->sendError("Player '{$commandParts[1]}' not found!", $player); | ||||||
| 			return; | 			return; | ||||||
| 		} | 		} | ||||||
| 		$success = $this->maniaControl->authenticationManager->grantAuthLevel($target, AuthenticationManager::AUTH_LEVEL_ADMIN); | 		$success = $this->maniaControl->getAuthenticationManager()->grantAuthLevel($target, AuthenticationManager::AUTH_LEVEL_ADMIN); | ||||||
| 		if (!$success) { | 		if (!$success) { | ||||||
| 			$this->maniaControl->chat->sendError('Error occurred.', $player->login); | 			$this->maniaControl->getChat()->sendError('Error occurred.', $player); | ||||||
| 			return; | 			return; | ||||||
| 		} | 		} | ||||||
| 		$message = '$<' . $player->nickname . '$> added $<' . $target->nickname . '$> as Admin!'; | 		$message = $player->getEscapedNickname() . ' added ' . $target->getEscapedNickname() . ' as Admin!'; | ||||||
| 		$this->maniaControl->chat->sendSuccess($message); | 		$this->maniaControl->getChat()->sendSuccess($message); | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	/** | 	/** | ||||||
| @@ -115,7 +115,7 @@ class AuthCommands implements CommandListener { | |||||||
| 	 */ | 	 */ | ||||||
| 	private function sendAddAdminUsageInfo(Player $player) { | 	private function sendAddAdminUsageInfo(Player $player) { | ||||||
| 		$message = "Usage Example: '//addadmin login'"; | 		$message = "Usage Example: '//addadmin login'"; | ||||||
| 		return $this->maniaControl->chat->sendUsageInfo($message, $player->login); | 		return $this->maniaControl->getChat()->sendUsageInfo($message, $player); | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	/** | 	/** | ||||||
| @@ -126,7 +126,7 @@ class AuthCommands implements CommandListener { | |||||||
| 	 */ | 	 */ | ||||||
| 	public function command_AddModerator(array $chatCallback, Player $player) { | 	public function command_AddModerator(array $chatCallback, Player $player) { | ||||||
| 		if (!AuthenticationManager::checkRight($player, AuthenticationManager::AUTH_LEVEL_ADMIN)) { | 		if (!AuthenticationManager::checkRight($player, AuthenticationManager::AUTH_LEVEL_ADMIN)) { | ||||||
| 			$this->maniaControl->authenticationManager->sendNotAllowed($player); | 			$this->maniaControl->getAuthenticationManager()->sendNotAllowed($player); | ||||||
| 			return; | 			return; | ||||||
| 		} | 		} | ||||||
| 		$text         = $chatCallback[1][2]; | 		$text         = $chatCallback[1][2]; | ||||||
| @@ -135,18 +135,18 @@ class AuthCommands implements CommandListener { | |||||||
| 			$this->sendAddModeratorUsageInfo($player); | 			$this->sendAddModeratorUsageInfo($player); | ||||||
| 			return; | 			return; | ||||||
| 		} | 		} | ||||||
| 		$target = $this->maniaControl->playerManager->getPlayer($commandParts[1]); | 		$target = $this->maniaControl->getPlayerManager()->getPlayer($commandParts[1]); | ||||||
| 		if (!$target) { | 		if (!$target) { | ||||||
| 			$this->maniaControl->chat->sendError("Player '{$commandParts[1]}' not found!", $player->login); | 			$this->maniaControl->getChat()->sendError("Player '{$commandParts[1]}' not found!", $player); | ||||||
| 			return; | 			return; | ||||||
| 		} | 		} | ||||||
| 		$success = $this->maniaControl->authenticationManager->grantAuthLevel($target, AuthenticationManager::AUTH_LEVEL_MODERATOR); | 		$success = $this->maniaControl->getAuthenticationManager()->grantAuthLevel($target, AuthenticationManager::AUTH_LEVEL_MODERATOR); | ||||||
| 		if (!$success) { | 		if (!$success) { | ||||||
| 			$this->maniaControl->chat->sendError('Error occurred.', $player->login); | 			$this->maniaControl->getChat()->sendError('Error occurred.', $player); | ||||||
| 			return; | 			return; | ||||||
| 		} | 		} | ||||||
| 		$message = '$<' . $player->nickname . '$> added $<' . $target->nickname . '$> as Moderator!'; | 		$message = $player->getEscapedNickname() . ' added ' . $target->getEscapedNickname() . ' as Moderator!'; | ||||||
| 		$this->maniaControl->chat->sendSuccess($message); | 		$this->maniaControl->getChat()->sendSuccess($message); | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	/** | 	/** | ||||||
| @@ -157,6 +157,6 @@ class AuthCommands implements CommandListener { | |||||||
| 	 */ | 	 */ | ||||||
| 	private function sendAddModeratorUsageInfo(Player $player) { | 	private function sendAddModeratorUsageInfo(Player $player) { | ||||||
| 		$message = "Usage Example: '//addmod login'"; | 		$message = "Usage Example: '//addmod login'"; | ||||||
| 		return $this->maniaControl->chat->sendUsageInfo($message, $player->login); | 		return $this->maniaControl->getChat()->sendUsageInfo($message, $player); | ||||||
| 	} | 	} | ||||||
| } | } | ||||||
|   | |||||||
| @@ -49,7 +49,8 @@ class AuthenticationManager implements CallbackListener { | |||||||
| 		$this->maniaControl = $maniaControl; | 		$this->maniaControl = $maniaControl; | ||||||
| 		$this->authCommands = new AuthCommands($maniaControl); | 		$this->authCommands = new AuthCommands($maniaControl); | ||||||
|  |  | ||||||
| 		$this->maniaControl->callbackManager->registerCallbackListener(Callbacks::ONINIT, $this, 'handleOnInit'); | 		// Callbacks | ||||||
|  | 		$this->maniaControl->getCallbackManager()->registerCallbackListener(Callbacks::ONINIT, $this, 'handleOnInit'); | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	/** | 	/** | ||||||
| @@ -144,14 +145,14 @@ class AuthenticationManager implements CallbackListener { | |||||||
| 	 * @return bool | 	 * @return bool | ||||||
| 	 */ | 	 */ | ||||||
| 	private function updateMasterAdmins() { | 	private function updateMasterAdmins() { | ||||||
| 		$masterAdminsElements = $this->maniaControl->config->xpath('masteradmins'); | 		$masterAdminsElements = $this->maniaControl->getConfig()->xpath('masteradmins'); | ||||||
| 		if (!$masterAdminsElements) { | 		if (!$masterAdminsElements) { | ||||||
| 			$this->maniaControl->log("Missing MasterAdmins configuration!", true); | 			$this->maniaControl->log('Missing MasterAdmins configuration!', true); | ||||||
| 			return false; | 			return false; | ||||||
| 		} | 		} | ||||||
| 		$masterAdminsElement = $masterAdminsElements[0]; | 		$masterAdminsElement = $masterAdminsElements[0]; | ||||||
|  |  | ||||||
| 		$mysqli = $this->maniaControl->database->mysqli; | 		$mysqli = $this->maniaControl->getDatabase()->getMysqli(); | ||||||
|  |  | ||||||
| 		// Remove all MasterAdmins | 		// Remove all MasterAdmins | ||||||
| 		$adminQuery     = "UPDATE `" . PlayerManager::TABLE_PLAYERS . "` | 		$adminQuery     = "UPDATE `" . PlayerManager::TABLE_PLAYERS . "` | ||||||
| @@ -207,7 +208,7 @@ class AuthenticationManager implements CallbackListener { | |||||||
| 	 * @return Player[] | 	 * @return Player[] | ||||||
| 	 */ | 	 */ | ||||||
| 	public function getConnectedAdmins($authLevel = self::AUTH_LEVEL_MODERATOR) { | 	public function getConnectedAdmins($authLevel = self::AUTH_LEVEL_MODERATOR) { | ||||||
| 		$players = $this->maniaControl->playerManager->getPlayers(); | 		$players = $this->maniaControl->getPlayerManager()->getPlayers(); | ||||||
| 		$admins  = array(); | 		$admins  = array(); | ||||||
| 		foreach ($players as $player) { | 		foreach ($players as $player) { | ||||||
| 			if (self::checkRight($player, $authLevel)) { | 			if (self::checkRight($player, $authLevel)) { | ||||||
| @@ -238,7 +239,7 @@ class AuthenticationManager implements CallbackListener { | |||||||
| 	 * @return Player[] | 	 * @return Player[] | ||||||
| 	 */ | 	 */ | ||||||
| 	public function getAdmins($authLevel = self::AUTH_LEVEL_MODERATOR) { | 	public function getAdmins($authLevel = self::AUTH_LEVEL_MODERATOR) { | ||||||
| 		$mysqli = $this->maniaControl->database->mysqli; | 		$mysqli = $this->maniaControl->getDatabase()->getMysqli(); | ||||||
| 		$query  = "SELECT `login` FROM `" . PlayerManager::TABLE_PLAYERS . "` | 		$query  = "SELECT `login` FROM `" . PlayerManager::TABLE_PLAYERS . "` | ||||||
| 				WHERE `authLevel` > " . $authLevel . " | 				WHERE `authLevel` > " . $authLevel . " | ||||||
| 				ORDER BY `authLevel` DESC;"; | 				ORDER BY `authLevel` DESC;"; | ||||||
| @@ -249,7 +250,7 @@ class AuthenticationManager implements CallbackListener { | |||||||
| 		} | 		} | ||||||
| 		$admins = array(); | 		$admins = array(); | ||||||
| 		while ($row = $result->fetch_object()) { | 		while ($row = $result->fetch_object()) { | ||||||
| 			$player = $this->maniaControl->playerManager->getPlayer($row->login, false); | 			$player = $this->maniaControl->getPlayerManager()->getPlayer($row->login, false); | ||||||
| 			if ($player) { | 			if ($player) { | ||||||
| 				array_push($admins, $player); | 				array_push($admins, $player); | ||||||
| 			} | 			} | ||||||
| @@ -274,7 +275,7 @@ class AuthenticationManager implements CallbackListener { | |||||||
| 			return false; | 			return false; | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
| 		$mysqli        = $this->maniaControl->database->mysqli; | 		$mysqli        = $this->maniaControl->getDatabase()->getMysqli(); | ||||||
| 		$authQuery     = "INSERT INTO `" . PlayerManager::TABLE_PLAYERS . "` ( | 		$authQuery     = "INSERT INTO `" . PlayerManager::TABLE_PLAYERS . "` ( | ||||||
| 				`login`, | 				`login`, | ||||||
| 				`authLevel` | 				`authLevel` | ||||||
| @@ -297,7 +298,7 @@ class AuthenticationManager implements CallbackListener { | |||||||
| 		$authStatement->close(); | 		$authStatement->close(); | ||||||
|  |  | ||||||
| 		$player->authLevel = $authLevel; | 		$player->authLevel = $authLevel; | ||||||
| 		$this->maniaControl->callbackManager->triggerCallback(self::CB_AUTH_LEVEL_CHANGED, $player); | 		$this->maniaControl->getCallbackManager()->triggerCallback(self::CB_AUTH_LEVEL_CHANGED, $player); | ||||||
|  |  | ||||||
| 		return true; | 		return true; | ||||||
| 	} | 	} | ||||||
| @@ -312,7 +313,7 @@ class AuthenticationManager implements CallbackListener { | |||||||
| 		if (!$player) { | 		if (!$player) { | ||||||
| 			return false; | 			return false; | ||||||
| 		} | 		} | ||||||
| 		return $this->maniaControl->chat->sendError('You do not have the required Rights to perform this Action!', $player->login); | 		return $this->maniaControl->getChat()->sendError('You do not have the required Rights to perform this Action!', $player); | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	/** | 	/** | ||||||
| @@ -323,7 +324,7 @@ class AuthenticationManager implements CallbackListener { | |||||||
| 	 * @return bool | 	 * @return bool | ||||||
| 	 */ | 	 */ | ||||||
| 	public function checkPermission(Player $player, $rightName) { | 	public function checkPermission(Player $player, $rightName) { | ||||||
| 		$right = $this->maniaControl->settingManager->getSettingValue($this, $rightName); | 		$right = $this->maniaControl->getSettingManager()->getSettingValue($this, $rightName); | ||||||
| 		return $this->checkRight($player, $this->getAuthLevel($right)); | 		return $this->checkRight($player, $this->getAuthLevel($right)); | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| @@ -334,7 +335,7 @@ class AuthenticationManager implements CallbackListener { | |||||||
| 	 * @param int    $authLevelNeeded | 	 * @param int    $authLevelNeeded | ||||||
| 	 */ | 	 */ | ||||||
| 	public function definePermissionLevel($rightName, $authLevelNeeded) { | 	public function definePermissionLevel($rightName, $authLevelNeeded) { | ||||||
| 		$this->maniaControl->settingManager->initSetting($this, $rightName, $this->getPermissionLevelNameArray($authLevelNeeded)); | 		$this->maniaControl->getSettingManager()->initSetting($this, $rightName, $this->getPermissionLevelNameArray($authLevelNeeded)); | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	/** | 	/** | ||||||
|   | |||||||
| @@ -39,7 +39,9 @@ class BillManager implements CallbackListener { | |||||||
| 	 */ | 	 */ | ||||||
| 	public function __construct(ManiaControl $maniaControl) { | 	public function __construct(ManiaControl $maniaControl) { | ||||||
| 		$this->maniaControl = $maniaControl; | 		$this->maniaControl = $maniaControl; | ||||||
| 		$this->maniaControl->callbackManager->registerCallbackListener(CallbackManager::CB_MP_BILLUPDATED, $this, 'handleBillUpdated'); |  | ||||||
|  | 		// Callbacks | ||||||
|  | 		$this->maniaControl->getCallbackManager()->registerCallbackListener(CallbackManager::CB_MP_BILLUPDATED, $this, 'handleBillUpdated'); | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	/** | 	/** | ||||||
| @@ -57,7 +59,7 @@ class BillManager implements CallbackListener { | |||||||
| 			trigger_error("Function is not callable!"); | 			trigger_error("Function is not callable!"); | ||||||
| 			return false; | 			return false; | ||||||
| 		} | 		} | ||||||
| 		$bill                   = $this->maniaControl->client->sendBill($player->login, $amount, $message, $receiver); | 		$bill                   = $this->maniaControl->getClient()->sendBill($player->login, $amount, $message, $receiver); | ||||||
| 		$this->openBills[$bill] = new BillData($function, $player, $amount); | 		$this->openBills[$bill] = new BillData($function, $player, $amount); | ||||||
| 		return true; | 		return true; | ||||||
| 	} | 	} | ||||||
| @@ -72,7 +74,7 @@ class BillManager implements CallbackListener { | |||||||
| 	 * @return bool | 	 * @return bool | ||||||
| 	 */ | 	 */ | ||||||
| 	public function sendPlanets(callable $function, $receiverLogin, $amount, $message) { | 	public function sendPlanets(callable $function, $receiverLogin, $amount, $message) { | ||||||
| 		$bill                   = $this->maniaControl->client->pay($receiverLogin, $amount, $message); | 		$bill                   = $this->maniaControl->getClient()->pay($receiverLogin, $amount, $message); | ||||||
| 		$this->openBills[$bill] = new BillData($function, $receiverLogin, $amount, true); | 		$this->openBills[$bill] = new BillData($function, $receiverLogin, $amount, true); | ||||||
| 		return true; | 		return true; | ||||||
| 	} | 	} | ||||||
|   | |||||||
| @@ -210,15 +210,15 @@ class CallbackManager { | |||||||
| 	 */ | 	 */ | ||||||
| 	public function manageCallbacks() { | 	public function manageCallbacks() { | ||||||
| 		// Manage Timings | 		// Manage Timings | ||||||
| 		$this->maniaControl->timerManager->manageTimings(); | 		$this->maniaControl->getTimerManager()->manageTimings(); | ||||||
|  |  | ||||||
| 		// Server Callbacks | 		// Server Callbacks | ||||||
| 		if (!$this->maniaControl->client) { | 		if (!$this->maniaControl->getClient()) { | ||||||
| 			return; | 			return; | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
| 		// Handle callbacks | 		// Handle callbacks | ||||||
| 		$callbacks = $this->maniaControl->client->executeCallbacks(); | 		$callbacks = $this->maniaControl->getClient()->executeCallbacks(); | ||||||
| 		foreach ($callbacks as $callback) { | 		foreach ($callbacks as $callback) { | ||||||
| 			$this->handleCallback($callback); | 			$this->handleCallback($callback); | ||||||
| 		} | 		} | ||||||
| @@ -236,14 +236,14 @@ class CallbackManager { | |||||||
| 				$this->triggerCallback($callbackName, $callback); | 				$this->triggerCallback($callbackName, $callback); | ||||||
| 				break; | 				break; | ||||||
| 			case self::CB_MP_BEGINMAP: | 			case self::CB_MP_BEGINMAP: | ||||||
| 				$this->maniaControl->mapManager->handleBeginMap($callback); | 				$this->maniaControl->getMapManager()->handleBeginMap($callback); | ||||||
| 				$this->triggerCallback($callbackName, $callback); | 				$this->triggerCallback($callbackName, $callback); | ||||||
| 				break; | 				break; | ||||||
| 			case self::CB_MP_ENDMATCH: | 			case self::CB_MP_ENDMATCH: | ||||||
| 				$this->triggerCallback($callbackName, $callback); | 				$this->triggerCallback($callbackName, $callback); | ||||||
| 				break; | 				break; | ||||||
| 			case self::CB_MP_ENDMAP: | 			case self::CB_MP_ENDMAP: | ||||||
| 				$this->maniaControl->mapManager->handleEndMap($callback); | 				$this->maniaControl->getMapManager()->handleEndMap($callback); | ||||||
| 				$this->triggerCallback($callbackName, $callback); | 				$this->triggerCallback($callbackName, $callback); | ||||||
| 				break; | 				break; | ||||||
| 			case self::CB_MP_MODESCRIPTCALLBACK: | 			case self::CB_MP_MODESCRIPTCALLBACK: | ||||||
|   | |||||||
| @@ -39,79 +39,79 @@ class LibXmlRpcCallbacks implements CallbackListener { | |||||||
| 	public function handleScriptCallback($name, $data) { | 	public function handleScriptCallback($name, $data) { | ||||||
| 		switch ($name) { | 		switch ($name) { | ||||||
| 			case 'LibXmlRpc_BeginMatch': | 			case 'LibXmlRpc_BeginMatch': | ||||||
| 				$this->maniaControl->callbackManager->triggerCallback(Callbacks::BEGINMATCH, $data[0]); | 				$this->maniaControl->getCallbackManager()->triggerCallback(Callbacks::BEGINMATCH, $data[0]); | ||||||
| 				break; | 				break; | ||||||
| 			case 'LibXmlRpc_LoadingMap': | 			case 'LibXmlRpc_LoadingMap': | ||||||
| 				$this->maniaControl->callbackManager->triggerCallback(Callbacks::LOADINGMAP, $data[0]); | 				$this->maniaControl->getCallbackManager()->triggerCallback(Callbacks::LOADINGMAP, $data[0]); | ||||||
| 				break; | 				break; | ||||||
| 			case 'BeginMap': | 			case 'BeginMap': | ||||||
| 			case 'LibXmlRpc_BeginMap': | 			case 'LibXmlRpc_BeginMap': | ||||||
| 				if (!isset($data[2])) { | 				if (!isset($data[2])) { | ||||||
| 					$data[2] = 'False'; | 					$data[2] = 'False'; | ||||||
| 				} | 				} | ||||||
| 				$this->maniaControl->mapManager->handleScriptBeginMap($data[1], $data[2]); | 				$this->maniaControl->getMapManager()->handleScriptBeginMap($data[1], $data[2]); | ||||||
| 				break; | 				break; | ||||||
| 			case 'LibXmlRpc_BeginSubmatch': | 			case 'LibXmlRpc_BeginSubmatch': | ||||||
| 				$this->maniaControl->callbackManager->triggerCallback(Callbacks::BEGINSUBMATCH, $data[0]); | 				$this->maniaControl->getCallbackManager()->triggerCallback(Callbacks::BEGINSUBMATCH, $data[0]); | ||||||
| 				break; | 				break; | ||||||
| 			case 'LibXmlRpc_BeginTurn': | 			case 'LibXmlRpc_BeginTurn': | ||||||
| 				$this->maniaControl->callbackManager->triggerCallback(Callbacks::BEGINTURN, $data[0]); | 				$this->maniaControl->getCallbackManager()->triggerCallback(Callbacks::BEGINTURN, $data[0]); | ||||||
| 				break; | 				break; | ||||||
| 			case 'LibXmlRpc_BeginPlaying': | 			case 'LibXmlRpc_BeginPlaying': | ||||||
| 				$this->maniaControl->callbackManager->triggerCallback(Callbacks::BEGINPLAYING); | 				$this->maniaControl->getCallbackManager()->triggerCallback(Callbacks::BEGINPLAYING); | ||||||
| 				break; | 				break; | ||||||
| 			case 'LibXmlRpc_EndPlaying': | 			case 'LibXmlRpc_EndPlaying': | ||||||
| 				$this->maniaControl->callbackManager->triggerCallback(Callbacks::ENDPLAYING); | 				$this->maniaControl->getCallbackManager()->triggerCallback(Callbacks::ENDPLAYING); | ||||||
| 				break; | 				break; | ||||||
| 			case 'LibXmlRpc_EndTurn': | 			case 'LibXmlRpc_EndTurn': | ||||||
| 				$this->maniaControl->callbackManager->triggerCallback(Callbacks::ENDTURN, $data[0]); | 				$this->maniaControl->getCallbackManager()->triggerCallback(Callbacks::ENDTURN, $data[0]); | ||||||
| 				break; | 				break; | ||||||
| 			case 'LibXmlRpc_EndRound': | 			case 'LibXmlRpc_EndRound': | ||||||
| 				$this->maniaControl->callbackManager->triggerCallback(Callbacks::ENDROUND, $data[0]); | 				$this->maniaControl->getCallbackManager()->triggerCallback(Callbacks::ENDROUND, $data[0]); | ||||||
| 				break; | 				break; | ||||||
| 			case 'LibXmlRpc_EndSubmatch': | 			case 'LibXmlRpc_EndSubmatch': | ||||||
| 				$this->maniaControl->callbackManager->triggerCallback(Callbacks::ENDSUBMATCH, $data[0]); | 				$this->maniaControl->getCallbackManager()->triggerCallback(Callbacks::ENDSUBMATCH, $data[0]); | ||||||
| 				break; | 				break; | ||||||
| 			case 'EndMap': | 			case 'EndMap': | ||||||
| 			case 'LibXmlRpc_EndMap': | 			case 'LibXmlRpc_EndMap': | ||||||
| 				$this->maniaControl->mapManager->handleScriptEndMap(); | 				$this->maniaControl->getMapManager()->handleScriptEndMap(); | ||||||
| 				break; | 				break; | ||||||
| 			case 'LibXmlRpc_BeginPodium': | 			case 'LibXmlRpc_BeginPodium': | ||||||
| 				$this->maniaControl->callbackManager->triggerCallback(Callbacks::BEGINPODIUM); | 				$this->maniaControl->getCallbackManager()->triggerCallback(Callbacks::BEGINPODIUM); | ||||||
| 				break; | 				break; | ||||||
| 			case 'LibXmlRpc_EndPodium': | 			case 'LibXmlRpc_EndPodium': | ||||||
| 				$this->maniaControl->callbackManager->triggerCallback(Callbacks::ENDPODIUM); | 				$this->maniaControl->getCallbackManager()->triggerCallback(Callbacks::ENDPODIUM); | ||||||
| 				break; | 				break; | ||||||
| 			case 'LibXmlRpc_UnloadingMap': | 			case 'LibXmlRpc_UnloadingMap': | ||||||
| 				$this->maniaControl->callbackManager->triggerCallback(Callbacks::UNLOADINGMAP, $data[0]); | 				$this->maniaControl->getCallbackManager()->triggerCallback(Callbacks::UNLOADINGMAP, $data[0]); | ||||||
| 				break; | 				break; | ||||||
| 			case 'LibXmlRpc_EndMatch': | 			case 'LibXmlRpc_EndMatch': | ||||||
| 				$this->maniaControl->callbackManager->triggerCallback(Callbacks::ENDMATCH, $data[0]); | 				$this->maniaControl->getCallbackManager()->triggerCallback(Callbacks::ENDMATCH, $data[0]); | ||||||
| 				break; | 				break; | ||||||
| 			case 'LibXmlRpc_BeginWarmUp': | 			case 'LibXmlRpc_BeginWarmUp': | ||||||
| 				$this->maniaControl->callbackManager->triggerCallback(Callbacks::BEGINWARMUP); | 				$this->maniaControl->getCallbackManager()->triggerCallback(Callbacks::BEGINWARMUP); | ||||||
| 				break; | 				break; | ||||||
| 			case 'LibXmlRpc_EndWarmUp': | 			case 'LibXmlRpc_EndWarmUp': | ||||||
| 				$this->maniaControl->callbackManager->triggerCallback(Callbacks::ENDWARMUP); | 				$this->maniaControl->getCallbackManager()->triggerCallback(Callbacks::ENDWARMUP); | ||||||
| 				break; | 				break; | ||||||
| 			case 'LibXmlRpc_PlayerRanking': | 			case 'LibXmlRpc_PlayerRanking': | ||||||
| 				//TODO really useful? what does it have what RankingsManager not have? | 				//TODO really useful? what does it have what RankingsManager not have? | ||||||
| 				$this->triggerPlayerRanking($data[0]); | 				$this->triggerPlayerRanking($data[0]); | ||||||
| 				break; | 				break; | ||||||
| 			case 'LibXmlRpc_OnStartLine': | 			case 'LibXmlRpc_OnStartLine': | ||||||
| 				$this->maniaControl->callbackManager->triggerCallback(Callbacks::ONSTARTLINE, $data[0]); | 				$this->maniaControl->getCallbackManager()->triggerCallback(Callbacks::ONSTARTLINE, $data[0]); | ||||||
| 				break; | 				break; | ||||||
| 			case 'LibXmlRpc_OnWayPoint': | 			case 'LibXmlRpc_OnWayPoint': | ||||||
| 				$this->maniaControl->callbackManager->triggerCallback(Callbacks::ONWAYPOINT, $data); | 				$this->maniaControl->getCallbackManager()->triggerCallback(Callbacks::ONWAYPOINT, $data); | ||||||
| 				break; | 				break; | ||||||
| 			case 'LibXmlRpc_OnGiveUp': | 			case 'LibXmlRpc_OnGiveUp': | ||||||
| 				$this->maniaControl->callbackManager->triggerCallback(Callbacks::ONGIVEUP, $data[0]); | 				$this->maniaControl->getCallbackManager()->triggerCallback(Callbacks::ONGIVEUP, $data[0]); | ||||||
| 				break; | 				break; | ||||||
| 			case 'LibXmlRpc_OnRespawn': | 			case 'LibXmlRpc_OnRespawn': | ||||||
| 				$this->maniaControl->callbackManager->triggerCallback(Callbacks::ONRESPAWN, $data[0]); | 				$this->maniaControl->getCallbackManager()->triggerCallback(Callbacks::ONRESPAWN, $data[0]); | ||||||
| 				break; | 				break; | ||||||
| 			case 'LibXmlRpc_OnStunt': | 			case 'LibXmlRpc_OnStunt': | ||||||
| 				$this->maniaControl->callbackManager->triggerCallback(Callbacks::ONSTUNT, $data); | 				$this->maniaControl->getCallbackManager()->triggerCallback(Callbacks::ONSTUNT, $data); | ||||||
| 				break; | 				break; | ||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
| @@ -122,7 +122,7 @@ class LibXmlRpcCallbacks implements CallbackListener { | |||||||
| 	 * @param array $data | 	 * @param array $data | ||||||
| 	 */ | 	 */ | ||||||
| 	private function triggerPlayerRanking(array $data) { | 	private function triggerPlayerRanking(array $data) { | ||||||
| 		$player = $this->maniaControl->playerManager->getPlayer($data[1]); | 		$player = $this->maniaControl->getPlayerManager()->getPlayer($data[1]); | ||||||
| 		$this->maniaControl->callbackManager->triggerCallback(Callbacks::PLAYERRANKING, $player, $data[0], $data[6], $data[5]); | 		$this->maniaControl->getCallbackManager()->triggerCallback(Callbacks::PLAYERRANKING, $player, $data[0], $data[6], $data[5]); | ||||||
| 	} | 	} | ||||||
| } | } | ||||||
|   | |||||||
| @@ -49,16 +49,16 @@ class ShootManiaCallbacks implements CallbackListener { | |||||||
| 	public function handleScriptCallbacks($name, $data) { | 	public function handleScriptCallbacks($name, $data) { | ||||||
| 		switch ($name) { | 		switch ($name) { | ||||||
| 			case 'LibXmlRpc_Rankings': | 			case 'LibXmlRpc_Rankings': | ||||||
| 				$this->maniaControl->server->getRankingManager()->updateRankings($data[0]); | 				$this->maniaControl->getServer()->getRankingManager()->updateRankings($data[0]); | ||||||
| 				break; | 				break; | ||||||
| 			case 'LibXmlRpc_Scores': | 			case 'LibXmlRpc_Scores': | ||||||
| 				$this->maniaControl->callbackManager->triggerCallback(Callbacks::SCORES, $data[0]); | 				$this->maniaControl->getCallbackManager()->triggerCallback(Callbacks::SCORES, $data[0]); | ||||||
| 				break; | 				break; | ||||||
| 			case 'LibAFK_IsAFK': | 			case 'LibAFK_IsAFK': | ||||||
| 				$this->triggerAfkStatus($data[0]); | 				$this->triggerAfkStatus($data[0]); | ||||||
| 				break; | 				break; | ||||||
| 			case 'WarmUp_Status': | 			case 'WarmUp_Status': | ||||||
| 				$this->maniaControl->callbackManager->triggerCallback(Callbacks::WARMUPSTATUS, $data[0]); | 				$this->maniaControl->getCallbackManager()->triggerCallback(Callbacks::WARMUPSTATUS, $data[0]); | ||||||
| 				break; | 				break; | ||||||
| 			case self::CB_TIMEATTACK_ONCHECKPOINT: | 			case self::CB_TIMEATTACK_ONCHECKPOINT: | ||||||
| 				$this->handleTimeAttackOnCheckpoint($name, $data); | 				$this->handleTimeAttackOnCheckpoint($name, $data); | ||||||
| @@ -75,8 +75,8 @@ class ShootManiaCallbacks implements CallbackListener { | |||||||
| 	 * @param string $login | 	 * @param string $login | ||||||
| 	 */ | 	 */ | ||||||
| 	private function triggerAfkStatus($login) { | 	private function triggerAfkStatus($login) { | ||||||
| 		$player = $this->maniaControl->playerManager->getPlayer($login); | 		$player = $this->maniaControl->getPlayerManager()->getPlayer($login); | ||||||
| 		$this->maniaControl->callbackManager->triggerCallback(Callbacks::AFKSTATUS, $player); | 		$this->maniaControl->getCallbackManager()->triggerCallback(Callbacks::AFKSTATUS, $player); | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	/** | 	/** | ||||||
| @@ -87,7 +87,7 @@ class ShootManiaCallbacks implements CallbackListener { | |||||||
| 	 */ | 	 */ | ||||||
| 	public function handleTimeAttackOnCheckpoint($name, array $data) { | 	public function handleTimeAttackOnCheckpoint($name, array $data) { | ||||||
| 		$login  = $data[0]; | 		$login  = $data[0]; | ||||||
| 		$player = $this->maniaControl->playerManager->getPlayer($login); | 		$player = $this->maniaControl->getPlayerManager()->getPlayer($login); | ||||||
| 		if (!$player) { | 		if (!$player) { | ||||||
| 			return; | 			return; | ||||||
| 		} | 		} | ||||||
| @@ -99,7 +99,7 @@ class ShootManiaCallbacks implements CallbackListener { | |||||||
| 		$checkpointCallback->setPlayer($player); | 		$checkpointCallback->setPlayer($player); | ||||||
| 		$checkpointCallback->time = (int)$data[1]; | 		$checkpointCallback->time = (int)$data[1]; | ||||||
|  |  | ||||||
| 		$this->maniaControl->callbackManager->triggerCallback($checkpointCallback); | 		$this->maniaControl->getCallbackManager()->triggerCallback($checkpointCallback); | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	/** | 	/** | ||||||
| @@ -110,7 +110,7 @@ class ShootManiaCallbacks implements CallbackListener { | |||||||
| 	 */ | 	 */ | ||||||
| 	public function handleTimeAttackOnFinish($name, array $data) { | 	public function handleTimeAttackOnFinish($name, array $data) { | ||||||
| 		$login  = $data[0]; | 		$login  = $data[0]; | ||||||
| 		$player = $this->maniaControl->playerManager->getPlayer($login); | 		$player = $this->maniaControl->getPlayerManager()->getPlayer($login); | ||||||
| 		if (!$player) { | 		if (!$player) { | ||||||
| 			return; | 			return; | ||||||
| 		} | 		} | ||||||
| @@ -122,6 +122,6 @@ class ShootManiaCallbacks implements CallbackListener { | |||||||
| 		$finishCallback->setPlayer($player); | 		$finishCallback->setPlayer($player); | ||||||
| 		$finishCallback->time = (int)$data[1]; | 		$finishCallback->time = (int)$data[1]; | ||||||
|  |  | ||||||
| 		$this->maniaControl->callbackManager->triggerCallback($finishCallback); | 		$this->maniaControl->getCallbackManager()->triggerCallback($finishCallback); | ||||||
| 	} | 	} | ||||||
| } | } | ||||||
|   | |||||||
| @@ -42,7 +42,7 @@ class TrackManiaCallbacks implements CallbackListener { | |||||||
| 	 */ | 	 */ | ||||||
| 	public function handleOnWayPointCallback(array $callback) { | 	public function handleOnWayPointCallback(array $callback) { | ||||||
| 		$login  = $callback[0]; | 		$login  = $callback[0]; | ||||||
| 		$player = $this->maniaControl->playerManager->getPlayer($login); | 		$player = $this->maniaControl->getPlayerManager()->getPlayer($login); | ||||||
| 		if (!$player) { | 		if (!$player) { | ||||||
| 			return; | 			return; | ||||||
| 		} | 		} | ||||||
| @@ -61,7 +61,7 @@ class TrackManiaCallbacks implements CallbackListener { | |||||||
| 		$wayPointCallback->isEndLap      = Formatter::parseBoolean($callback[7]); | 		$wayPointCallback->isEndLap      = Formatter::parseBoolean($callback[7]); | ||||||
|  |  | ||||||
| 		if ($wayPointCallback->checkpoint > 0) { | 		if ($wayPointCallback->checkpoint > 0) { | ||||||
| 			$currentMap = $this->maniaControl->mapManager->getCurrentMap(); | 			$currentMap = $this->maniaControl->getMapManager()->getCurrentMap(); | ||||||
| 			$wayPointCallback->lap += $wayPointCallback->checkpoint / $currentMap->nbCheckpoints; | 			$wayPointCallback->lap += $wayPointCallback->checkpoint / $currentMap->nbCheckpoints; | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
| @@ -73,7 +73,7 @@ class TrackManiaCallbacks implements CallbackListener { | |||||||
| 			$wayPointCallback->name = $wayPointCallback::CHECKPOINT; | 			$wayPointCallback->name = $wayPointCallback::CHECKPOINT; | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
| 		$this->maniaControl->callbackManager->triggerCallback($wayPointCallback); | 		$this->maniaControl->getCallbackManager()->triggerCallback($wayPointCallback); | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	/** | 	/** | ||||||
| @@ -84,7 +84,7 @@ class TrackManiaCallbacks implements CallbackListener { | |||||||
| 	public function handlePlayerCheckpointCallback(array $callback) { | 	public function handlePlayerCheckpointCallback(array $callback) { | ||||||
| 		$data   = $callback[1]; | 		$data   = $callback[1]; | ||||||
| 		$login  = $data[1]; | 		$login  = $data[1]; | ||||||
| 		$player = $this->maniaControl->playerManager->getPlayer($login); | 		$player = $this->maniaControl->getPlayerManager()->getPlayer($login); | ||||||
| 		if (!$player) { | 		if (!$player) { | ||||||
| 			return; | 			return; | ||||||
| 		} | 		} | ||||||
| @@ -100,7 +100,7 @@ class TrackManiaCallbacks implements CallbackListener { | |||||||
| 		$checkpointCallback->lapCheckpoint = $checkpointCallback->checkpoint; | 		$checkpointCallback->lapCheckpoint = $checkpointCallback->checkpoint; | ||||||
|  |  | ||||||
| 		if ($checkpointCallback->lap > 0) { | 		if ($checkpointCallback->lap > 0) { | ||||||
| 			$currentMap = $this->maniaControl->mapManager->getCurrentMap(); | 			$currentMap = $this->maniaControl->getMapManager()->getCurrentMap(); | ||||||
| 			$checkpointCallback->lapCheckpoint -= $checkpointCallback->lap * $currentMap->nbCheckpoints; | 			$checkpointCallback->lapCheckpoint -= $checkpointCallback->lap * $currentMap->nbCheckpoints; | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
| @@ -110,7 +110,7 @@ class TrackManiaCallbacks implements CallbackListener { | |||||||
| 			$checkpointCallback->name = $checkpointCallback::CHECKPOINT; | 			$checkpointCallback->name = $checkpointCallback::CHECKPOINT; | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
| 		$this->maniaControl->callbackManager->triggerCallback($checkpointCallback); | 		$this->maniaControl->getCallbackManager()->triggerCallback($checkpointCallback); | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	/** | 	/** | ||||||
| @@ -121,7 +121,7 @@ class TrackManiaCallbacks implements CallbackListener { | |||||||
| 	public function handlePlayerFinishCallback(array $callback) { | 	public function handlePlayerFinishCallback(array $callback) { | ||||||
| 		$data   = $callback[1]; | 		$data   = $callback[1]; | ||||||
| 		$login  = $data[1]; | 		$login  = $data[1]; | ||||||
| 		$player = $this->maniaControl->playerManager->getPlayer($login); | 		$player = $this->maniaControl->getPlayerManager()->getPlayer($login); | ||||||
| 		if (!$player) { | 		if (!$player) { | ||||||
| 			return; | 			return; | ||||||
| 		} | 		} | ||||||
| @@ -134,6 +134,6 @@ class TrackManiaCallbacks implements CallbackListener { | |||||||
| 		$finishCallback->setPlayer($player); | 		$finishCallback->setPlayer($player); | ||||||
| 		$finishCallback->time = (int)$data[2]; | 		$finishCallback->time = (int)$data[2]; | ||||||
|  |  | ||||||
| 		$this->maniaControl->callbackManager->triggerCallback($finishCallback); | 		$this->maniaControl->getCallbackManager()->triggerCallback($finishCallback); | ||||||
| 	} | 	} | ||||||
| } | } | ||||||
|   | |||||||
| @@ -37,12 +37,12 @@ class Chat { | |||||||
| 	public function __construct(ManiaControl $maniaControl) { | 	public function __construct(ManiaControl $maniaControl) { | ||||||
| 		$this->maniaControl = $maniaControl; | 		$this->maniaControl = $maniaControl; | ||||||
|  |  | ||||||
| 		// Init settings | 		// Settings | ||||||
| 		$this->maniaControl->settingManager->initSetting($this, self::SETTING_PREFIX, '» '); | 		$this->maniaControl->getSettingManager()->initSetting($this, self::SETTING_PREFIX, '» '); | ||||||
| 		$this->maniaControl->settingManager->initSetting($this, self::SETTING_FORMAT_INFORMATION, '$fff'); | 		$this->maniaControl->getSettingManager()->initSetting($this, self::SETTING_FORMAT_INFORMATION, '$fff'); | ||||||
| 		$this->maniaControl->settingManager->initSetting($this, self::SETTING_FORMAT_SUCCESS, '$0f0'); | 		$this->maniaControl->getSettingManager()->initSetting($this, self::SETTING_FORMAT_SUCCESS, '$0f0'); | ||||||
| 		$this->maniaControl->settingManager->initSetting($this, self::SETTING_FORMAT_ERROR, '$f30'); | 		$this->maniaControl->getSettingManager()->initSetting($this, self::SETTING_FORMAT_ERROR, '$f30'); | ||||||
| 		$this->maniaControl->settingManager->initSetting($this, self::SETTING_FORMAT_USAGEINFO, '$f80'); | 		$this->maniaControl->getSettingManager()->initSetting($this, self::SETTING_FORMAT_USAGEINFO, '$f80'); | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	/** | 	/** | ||||||
| @@ -54,7 +54,7 @@ class Chat { | |||||||
| 	 * @return bool | 	 * @return bool | ||||||
| 	 */ | 	 */ | ||||||
| 	public function sendInformation($message, $login = null, $prefix = true) { | 	public function sendInformation($message, $login = null, $prefix = true) { | ||||||
| 		$format = $this->maniaControl->settingManager->getSettingValue($this, self::SETTING_FORMAT_INFORMATION); | 		$format = $this->maniaControl->getSettingManager()->getSettingValue($this, self::SETTING_FORMAT_INFORMATION); | ||||||
| 		return $this->sendChat($format . $message, $login, $prefix); | 		return $this->sendChat($format . $message, $login, $prefix); | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| @@ -67,21 +67,21 @@ class Chat { | |||||||
| 	 * @return bool | 	 * @return bool | ||||||
| 	 */ | 	 */ | ||||||
| 	public function sendChat($message, $login = null, $prefix = true) { | 	public function sendChat($message, $login = null, $prefix = true) { | ||||||
| 		if (!$this->maniaControl->client) { | 		if (!$this->maniaControl->getClient()) { | ||||||
| 			return false; | 			return false; | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
| 		if (!$login) { | 		if (!$login) { | ||||||
| 			$prefix      = $this->getPrefix($prefix); | 			$prefix      = $this->getPrefix($prefix); | ||||||
| 			$chatMessage = '$<$z$ff0' . str_replace(' ', '', $prefix) . $prefix . $message . '$>'; | 			$chatMessage = '$<$z$ff0' . str_replace(' ', '', $prefix) . $prefix . $message . '$>'; | ||||||
| 			$this->maniaControl->client->chatSendServerMessage($chatMessage); | 			$this->maniaControl->getClient()->chatSendServerMessage($chatMessage); | ||||||
| 		} else { | 		} else { | ||||||
| 			$chatMessage = '$<$z$ff0' . $this->getPrefix($prefix) . $message . '$>'; | 			$chatMessage = '$<$z$ff0' . $this->getPrefix($prefix) . $message . '$>'; | ||||||
| 			if (!is_array($login)) { | 			if (!is_array($login)) { | ||||||
| 				$login = Player::parseLogin($login); | 				$login = Player::parseLogin($login); | ||||||
| 			} | 			} | ||||||
| 			try { | 			try { | ||||||
| 				$this->maniaControl->client->chatSendServerMessage($chatMessage, $login); | 				$this->maniaControl->getClient()->chatSendServerMessage($chatMessage, $login); | ||||||
| 			} catch (UnknownPlayerException $e) { | 			} catch (UnknownPlayerException $e) { | ||||||
| 			} | 			} | ||||||
| 		} | 		} | ||||||
| @@ -99,7 +99,7 @@ class Chat { | |||||||
| 			return $prefix; | 			return $prefix; | ||||||
| 		} | 		} | ||||||
| 		if ($prefix === true) { | 		if ($prefix === true) { | ||||||
| 			return $this->maniaControl->settingManager->getSettingValue($this, self::SETTING_PREFIX); | 			return $this->maniaControl->getSettingManager()->getSettingValue($this, self::SETTING_PREFIX); | ||||||
| 		} | 		} | ||||||
| 		return ''; | 		return ''; | ||||||
| 	} | 	} | ||||||
| @@ -112,7 +112,7 @@ class Chat { | |||||||
| 	 * @param bool   $prefix | 	 * @param bool   $prefix | ||||||
| 	 */ | 	 */ | ||||||
| 	public function sendErrorToAdmins($message, $minLevel = AuthenticationManager::AUTH_LEVEL_MODERATOR, $prefix = true) { | 	public function sendErrorToAdmins($message, $minLevel = AuthenticationManager::AUTH_LEVEL_MODERATOR, $prefix = true) { | ||||||
| 		$format = $this->maniaControl->settingManager->getSettingValue($this, self::SETTING_FORMAT_ERROR); | 		$format = $this->maniaControl->getSettingManager()->getSettingValue($this, self::SETTING_FORMAT_ERROR); | ||||||
| 		$this->sendMessageToAdmins($format . $message, $minLevel, $prefix); | 		$this->sendMessageToAdmins($format . $message, $minLevel, $prefix); | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| @@ -125,7 +125,7 @@ class Chat { | |||||||
| 	 * @return bool | 	 * @return bool | ||||||
| 	 */ | 	 */ | ||||||
| 	public function sendMessageToAdmins($message, $minLevel = AuthenticationManager::AUTH_LEVEL_MODERATOR, $prefix = true) { | 	public function sendMessageToAdmins($message, $minLevel = AuthenticationManager::AUTH_LEVEL_MODERATOR, $prefix = true) { | ||||||
| 		$admins = $this->maniaControl->authenticationManager->getConnectedAdmins($minLevel); | 		$admins = $this->maniaControl->getAuthenticationManager()->getConnectedAdmins($minLevel); | ||||||
| 		return $this->sendChat($message, $admins, $prefix); | 		return $this->sendChat($message, $admins, $prefix); | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| @@ -138,7 +138,7 @@ class Chat { | |||||||
| 	 * @return bool | 	 * @return bool | ||||||
| 	 */ | 	 */ | ||||||
| 	public function sendSuccess($message, $login = null, $prefix = true) { | 	public function sendSuccess($message, $login = null, $prefix = true) { | ||||||
| 		$format = $this->maniaControl->settingManager->getSettingValue($this, self::SETTING_FORMAT_SUCCESS); | 		$format = $this->maniaControl->getSettingManager()->getSettingValue($this, self::SETTING_FORMAT_SUCCESS); | ||||||
| 		return $this->sendChat($format . $message, $login, $prefix); | 		return $this->sendChat($format . $message, $login, $prefix); | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| @@ -151,7 +151,7 @@ class Chat { | |||||||
| 	 * @return bool | 	 * @return bool | ||||||
| 	 */ | 	 */ | ||||||
| 	public function sendSuccessToAdmins($message, $minLevel = AuthenticationManager::AUTH_LEVEL_MODERATOR, $prefix = true) { | 	public function sendSuccessToAdmins($message, $minLevel = AuthenticationManager::AUTH_LEVEL_MODERATOR, $prefix = true) { | ||||||
| 		$format = $this->maniaControl->settingManager->getSettingValue($this, self::SETTING_FORMAT_SUCCESS); | 		$format = $this->maniaControl->getSettingManager()->getSettingValue($this, self::SETTING_FORMAT_SUCCESS); | ||||||
| 		return $this->sendMessageToAdmins($format . $message, $minLevel, $prefix); | 		return $this->sendMessageToAdmins($format . $message, $minLevel, $prefix); | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| @@ -176,7 +176,7 @@ class Chat { | |||||||
| 	 * @return bool | 	 * @return bool | ||||||
| 	 */ | 	 */ | ||||||
| 	public function sendError($message, $login = null, $prefix = true) { | 	public function sendError($message, $login = null, $prefix = true) { | ||||||
| 		$format = $this->maniaControl->settingManager->getSettingValue($this, self::SETTING_FORMAT_ERROR); | 		$format = $this->maniaControl->getSettingManager()->getSettingValue($this, self::SETTING_FORMAT_ERROR); | ||||||
| 		return $this->sendChat($format . $message, $login, $prefix); | 		return $this->sendChat($format . $message, $login, $prefix); | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| @@ -189,7 +189,7 @@ class Chat { | |||||||
| 	 */ | 	 */ | ||||||
| 	public function sendExceptionToAdmins(\Exception $exception, $minLevel = AuthenticationManager::AUTH_LEVEL_MODERATOR, | 	public function sendExceptionToAdmins(\Exception $exception, $minLevel = AuthenticationManager::AUTH_LEVEL_MODERATOR, | ||||||
| 	                                      $prefix = true) { | 	                                      $prefix = true) { | ||||||
| 		$format  = $this->maniaControl->settingManager->getSettingValue($this, self::SETTING_FORMAT_ERROR); | 		$format  = $this->maniaControl->getSettingManager()->getSettingValue($this, self::SETTING_FORMAT_ERROR); | ||||||
| 		$message = $format . "Exception: '{$exception->getMessage()}' ({$exception->getCode()})"; | 		$message = $format . "Exception: '{$exception->getMessage()}' ({$exception->getCode()})"; | ||||||
| 		$this->sendMessageToAdmins($message, $minLevel, $prefix); | 		$this->sendMessageToAdmins($message, $minLevel, $prefix); | ||||||
| 	} | 	} | ||||||
| @@ -203,7 +203,7 @@ class Chat { | |||||||
| 	 * @return bool | 	 * @return bool | ||||||
| 	 */ | 	 */ | ||||||
| 	public function sendUsageInfo($message, $login = null, $prefix = false) { | 	public function sendUsageInfo($message, $login = null, $prefix = false) { | ||||||
| 		$format = $this->maniaControl->settingManager->getSettingValue($this, self::SETTING_FORMAT_USAGEINFO); | 		$format = $this->maniaControl->getSettingManager()->getSettingValue($this, self::SETTING_FORMAT_USAGEINFO); | ||||||
| 		return $this->sendChat($format . $message, $login, $prefix); | 		return $this->sendChat($format . $message, $login, $prefix); | ||||||
| 	} | 	} | ||||||
| } | } | ||||||
|   | |||||||
| @@ -39,7 +39,7 @@ class CommandManager implements CallbackListener { | |||||||
| 		$this->helpManager = new HelpManager($this->maniaControl); | 		$this->helpManager = new HelpManager($this->maniaControl); | ||||||
|  |  | ||||||
| 		// Callbacks | 		// Callbacks | ||||||
| 		$this->maniaControl->callbackManager->registerCallbackListener(CallbackManager::CB_MP_PLAYERCHAT, $this, 'handleChatCallback'); | 		$this->maniaControl->getCallbackManager()->registerCallbackListener(CallbackManager::CB_MP_PLAYERCHAT, $this, 'handleChatCallback'); | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	/** | 	/** | ||||||
| @@ -163,7 +163,7 @@ class CommandManager implements CallbackListener { | |||||||
|  |  | ||||||
| 		// Check for valid player | 		// Check for valid player | ||||||
| 		$login  = $callback[1][1]; | 		$login  = $callback[1][1]; | ||||||
| 		$player = $this->maniaControl->playerManager->getPlayer($login); | 		$player = $this->maniaControl->getPlayerManager()->getPlayer($login); | ||||||
| 		if (!$player) { | 		if (!$player) { | ||||||
| 			return; | 			return; | ||||||
| 		} | 		} | ||||||
|   | |||||||
| @@ -38,17 +38,17 @@ class HelpManager implements CommandListener, CallbackListener { | |||||||
| 		$this->maniaControl = $maniaControl; | 		$this->maniaControl = $maniaControl; | ||||||
|  |  | ||||||
| 		// Callbacks | 		// Callbacks | ||||||
| 		$this->maniaControl->callbackManager->registerCallbackListener(Callbacks::ONINIT, $this, 'handleOnInit'); | 		$this->maniaControl->getCallbackManager()->registerCallbackListener(Callbacks::ONINIT, $this, 'handleOnInit'); | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	/** | 	/** | ||||||
| 	 * Handle ManiaControl OnInit Callback | 	 * Handle ManiaControl OnInit Callback | ||||||
| 	 */ | 	 */ | ||||||
| 	public function handleOnInit() { | 	public function handleOnInit() { | ||||||
| 		$this->maniaControl->commandManager->registerCommandListener('help', $this, 'command_playerHelp', false, 'Shows all commands in chat.'); | 		$this->maniaControl->getCommandManager()->registerCommandListener('help', $this, 'command_playerHelp', false, 'Shows all commands in chat.'); | ||||||
| 		$this->maniaControl->commandManager->registerCommandListener('helpall', $this, 'command_playerHelpAll', false, 'Shows all commands in ManiaLink with description.'); | 		$this->maniaControl->getCommandManager()->registerCommandListener('helpall', $this, 'command_playerHelpAll', false, 'Shows all commands in ManiaLink with description.'); | ||||||
| 		$this->maniaControl->commandManager->registerCommandListener('help', $this, 'command_adminHelp', true, 'Shows all admin commands in chat.'); | 		$this->maniaControl->getCommandManager()->registerCommandListener('help', $this, 'command_adminHelp', true, 'Shows all admin commands in chat.'); | ||||||
| 		$this->maniaControl->commandManager->registerCommandListener('helpall', $this, 'command_adminHelpAll', true, 'Shows all admin commands in ManiaLink with description.'); | 		$this->maniaControl->getCommandManager()->registerCommandListener('helpall', $this, 'command_adminHelpAll', true, 'Shows all admin commands in ManiaLink with description.'); | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	/** | 	/** | ||||||
| @@ -79,7 +79,7 @@ class HelpManager implements CommandListener, CallbackListener { | |||||||
| 			$message .= $command['Name'] . ','; | 			$message .= $command['Name'] . ','; | ||||||
| 		} | 		} | ||||||
| 		$message = substr($message, 0, -1); | 		$message = substr($message, 0, -1); | ||||||
| 		$this->maniaControl->chat->sendChat($message, $player->login); | 		$this->maniaControl->getChat()->sendChat($message, $player); | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	/** | 	/** | ||||||
| @@ -110,7 +110,7 @@ class HelpManager implements CommandListener, CallbackListener { | |||||||
| 			$message .= $command['Name'] . ','; | 			$message .= $command['Name'] . ','; | ||||||
| 		} | 		} | ||||||
| 		$message = substr($message, 0, -1); | 		$message = substr($message, 0, -1); | ||||||
| 		$this->maniaControl->chat->sendChat($message, $player->login); | 		$this->maniaControl->getChat()->sendChat($message, $player); | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	/** | 	/** | ||||||
| @@ -161,8 +161,8 @@ class HelpManager implements CommandListener, CallbackListener { | |||||||
| 	 * @param mixed $player | 	 * @param mixed $player | ||||||
| 	 */ | 	 */ | ||||||
| 	private function showHelpAllList(array $commands, $player) { | 	private function showHelpAllList(array $commands, $player) { | ||||||
| 		$width  = $this->maniaControl->manialinkManager->getStyleManager()->getListWidgetsWidth(); | 		$width  = $this->maniaControl->getManialinkManager()->getStyleManager()->getListWidgetsWidth(); | ||||||
| 		$height = $this->maniaControl->manialinkManager->getStyleManager()->getListWidgetsHeight(); | 		$height = $this->maniaControl->getManialinkManager()->getStyleManager()->getListWidgetsHeight(); | ||||||
|  |  | ||||||
| 		// create manialink | 		// create manialink | ||||||
| 		$maniaLink = new ManiaLink(ManialinkManager::MAIN_MLID); | 		$maniaLink = new ManiaLink(ManialinkManager::MAIN_MLID); | ||||||
| @@ -171,7 +171,7 @@ class HelpManager implements CommandListener, CallbackListener { | |||||||
| 		$script->addFeature($paging); | 		$script->addFeature($paging); | ||||||
|  |  | ||||||
| 		// Main frame | 		// Main frame | ||||||
| 		$frame = $this->maniaControl->manialinkManager->getStyleManager()->getDefaultListFrame($script, $paging); | 		$frame = $this->maniaControl->getManialinkManager()->getStyleManager()->getDefaultListFrame($script, $paging); | ||||||
| 		$maniaLink->add($frame); | 		$maniaLink->add($frame); | ||||||
|  |  | ||||||
| 		// Start offsets | 		// Start offsets | ||||||
| @@ -179,7 +179,7 @@ class HelpManager implements CommandListener, CallbackListener { | |||||||
| 		$posY = $height / 2; | 		$posY = $height / 2; | ||||||
|  |  | ||||||
| 		//Predefine description Label | 		//Predefine description Label | ||||||
| 		$descriptionLabel = $this->maniaControl->manialinkManager->getStyleManager()->getDefaultDescriptionLabel(); | 		$descriptionLabel = $this->maniaControl->getManialinkManager()->getStyleManager()->getDefaultDescriptionLabel(); | ||||||
| 		$frame->add($descriptionLabel); | 		$frame->add($descriptionLabel); | ||||||
|  |  | ||||||
| 		// Headline | 		// Headline | ||||||
| @@ -187,7 +187,7 @@ class HelpManager implements CommandListener, CallbackListener { | |||||||
| 		$frame->add($headFrame); | 		$frame->add($headFrame); | ||||||
| 		$headFrame->setY($posY - 5); | 		$headFrame->setY($posY - 5); | ||||||
| 		$array = array('Command' => $posX + 5, 'Description' => $posX + 50); | 		$array = array('Command' => $posX + 5, 'Description' => $posX + 50); | ||||||
| 		$this->maniaControl->manialinkManager->labelLine($headFrame, $array); | 		$this->maniaControl->getManialinkManager()->labelLine($headFrame, $array); | ||||||
|  |  | ||||||
| 		$index = 1; | 		$index = 1; | ||||||
| 		$posY -= 10; | 		$posY -= 10; | ||||||
| @@ -214,7 +214,7 @@ class HelpManager implements CommandListener, CallbackListener { | |||||||
| 			} | 			} | ||||||
|  |  | ||||||
| 			$array  = array($command['Name'] => $posX + 5, $command['Description'] => $posX + 50); | 			$array  = array($command['Name'] => $posX + 5, $command['Description'] => $posX + 50); | ||||||
| 			$labels = $this->maniaControl->manialinkManager->labelLine($playerFrame, $array); | 			$labels = $this->maniaControl->getManialinkManager()->labelLine($playerFrame, $array); | ||||||
|  |  | ||||||
| 			$label = $labels[0]; | 			$label = $labels[0]; | ||||||
| 			$label->setWidth(40); | 			$label->setWidth(40); | ||||||
| @@ -224,7 +224,7 @@ class HelpManager implements CommandListener, CallbackListener { | |||||||
| 		} | 		} | ||||||
|  |  | ||||||
| 		// Render and display xml | 		// Render and display xml | ||||||
| 		$this->maniaControl->manialinkManager->displayWidget($maniaLink, $player, 'HelpAllList'); | 		$this->maniaControl->getManialinkManager()->displayWidget($maniaLink, $player, 'HelpAllList'); | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	/** | 	/** | ||||||
|   | |||||||
| @@ -69,25 +69,25 @@ class Configurator implements CallbackListener, CommandListener, ManialinkPageAn | |||||||
| 		$this->maniaControl = $maniaControl; | 		$this->maniaControl = $maniaControl; | ||||||
| 		$this->addActionsMenuItem(); | 		$this->addActionsMenuItem(); | ||||||
|  |  | ||||||
| 		// Init settings | 		// Settings | ||||||
| 		$this->maniaControl->settingManager->initSetting($this, self::SETTING_MENU_POSX, 0.); | 		$this->maniaControl->getSettingManager()->initSetting($this, self::SETTING_MENU_POSX, 0.); | ||||||
| 		$this->maniaControl->settingManager->initSetting($this, self::SETTING_MENU_POSY, 3.); | 		$this->maniaControl->getSettingManager()->initSetting($this, self::SETTING_MENU_POSY, 3.); | ||||||
| 		$this->maniaControl->settingManager->initSetting($this, self::SETTING_MENU_WIDTH, 170.); | 		$this->maniaControl->getSettingManager()->initSetting($this, self::SETTING_MENU_WIDTH, 170.); | ||||||
| 		$this->maniaControl->settingManager->initSetting($this, self::SETTING_MENU_HEIGHT, 81.); | 		$this->maniaControl->getSettingManager()->initSetting($this, self::SETTING_MENU_HEIGHT, 81.); | ||||||
| 		$this->maniaControl->settingManager->initSetting($this, self::SETTING_MENU_STYLE, Quad_BgRaceScore2::STYLE); | 		$this->maniaControl->getSettingManager()->initSetting($this, self::SETTING_MENU_STYLE, Quad_BgRaceScore2::STYLE); | ||||||
| 		$this->maniaControl->settingManager->initSetting($this, self::SETTING_MENU_SUBSTYLE, Quad_BgRaceScore2::SUBSTYLE_HandleSelectable); | 		$this->maniaControl->getSettingManager()->initSetting($this, self::SETTING_MENU_SUBSTYLE, Quad_BgRaceScore2::SUBSTYLE_HandleSelectable); | ||||||
|  |  | ||||||
| 		// Permission for opening | 		// Permissions | ||||||
| 		$this->maniaControl->authenticationManager->definePermissionLevel(self::SETTING_PERMISSION_OPEN_CONFIGURATOR, AuthenticationManager::AUTH_LEVEL_ADMIN); | 		$this->maniaControl->getAuthenticationManager()->definePermissionLevel(self::SETTING_PERMISSION_OPEN_CONFIGURATOR, AuthenticationManager::AUTH_LEVEL_ADMIN); | ||||||
|  |  | ||||||
| 		// Register for page answers | 		// Page answers | ||||||
| 		$this->maniaControl->manialinkManager->registerManialinkPageAnswerListener(self::ACTION_TOGGLEMENU, $this, 'handleToggleMenuAction'); | 		$this->maniaControl->getManialinkManager()->registerManialinkPageAnswerListener(self::ACTION_TOGGLEMENU, $this, 'handleToggleMenuAction'); | ||||||
| 		$this->maniaControl->manialinkManager->registerManialinkPageAnswerListener(self::ACTION_SAVECONFIG, $this, 'handleSaveConfigAction'); | 		$this->maniaControl->getManialinkManager()->registerManialinkPageAnswerListener(self::ACTION_SAVECONFIG, $this, 'handleSaveConfigAction'); | ||||||
|  |  | ||||||
| 		// Register for callbacks | 		// Callbacks | ||||||
| 		$this->maniaControl->callbackManager->registerCallbackListener(CallbackManager::CB_MP_PLAYERMANIALINKPAGEANSWER, $this, 'handleManialinkPageAnswer'); | 		$this->maniaControl->getCallbackManager()->registerCallbackListener(CallbackManager::CB_MP_PLAYERMANIALINKPAGEANSWER, $this, 'handleManialinkPageAnswer'); | ||||||
| 		$this->maniaControl->callbackManager->registerCallbackListener(ManialinkManager::CB_MAIN_WINDOW_OPENED, $this, 'handleWidgetOpened'); | 		$this->maniaControl->getCallbackManager()->registerCallbackListener(ManialinkManager::CB_MAIN_WINDOW_OPENED, $this, 'handleWidgetOpened'); | ||||||
| 		$this->maniaControl->callbackManager->registerCallbackListener(ManialinkManager::CB_MAIN_WINDOW_CLOSED, $this, 'closeWidget'); | 		$this->maniaControl->getCallbackManager()->registerCallbackListener(ManialinkManager::CB_MAIN_WINDOW_CLOSED, $this, 'closeWidget'); | ||||||
|  |  | ||||||
| 		// Create server options menu | 		// Create server options menu | ||||||
| 		$this->serverOptionsMenu = new ServerOptionsMenu($maniaControl); | 		$this->serverOptionsMenu = new ServerOptionsMenu($maniaControl); | ||||||
| @@ -105,8 +105,8 @@ class Configurator implements CallbackListener, CommandListener, ManialinkPageAn | |||||||
| 		$this->maniaControlSettings = new ManiaControlSettings($maniaControl); | 		$this->maniaControlSettings = new ManiaControlSettings($maniaControl); | ||||||
| 		$this->addMenu($this->maniaControlSettings); | 		$this->addMenu($this->maniaControlSettings); | ||||||
|  |  | ||||||
| 		// Register for commands | 		// Chat commands | ||||||
| 		$this->maniaControl->commandManager->registerCommandListener('config', $this, 'handleConfigCommand', true, 'Loads Config panel.'); | 		$this->maniaControl->getCommandManager()->registerCommandListener('config', $this, 'handleConfigCommand', true, 'Loads Config panel.'); | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	/** | 	/** | ||||||
| @@ -116,7 +116,7 @@ class Configurator implements CallbackListener, CommandListener, ManialinkPageAn | |||||||
| 		$itemQuad = new Quad_UIConstruction_Buttons(); | 		$itemQuad = new Quad_UIConstruction_Buttons(); | ||||||
| 		$itemQuad->setSubStyle($itemQuad::SUBSTYLE_Tools) | 		$itemQuad->setSubStyle($itemQuad::SUBSTYLE_Tools) | ||||||
| 		         ->setAction(self::ACTION_TOGGLEMENU); | 		         ->setAction(self::ACTION_TOGGLEMENU); | ||||||
| 		$this->maniaControl->actionsMenu->addAdminMenuItem($itemQuad, 100, 'Settings'); | 		$this->maniaControl->getActionsMenu()->addAdminMenuItem($itemQuad, 100, 'Settings'); | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	/** | 	/** | ||||||
| @@ -135,8 +135,8 @@ class Configurator implements CallbackListener, CommandListener, ManialinkPageAn | |||||||
| 	 * @param Player $player | 	 * @param Player $player | ||||||
| 	 */ | 	 */ | ||||||
| 	public function handleConfigCommand(array $callback, Player $player) { | 	public function handleConfigCommand(array $callback, Player $player) { | ||||||
| 		if (!$this->maniaControl->authenticationManager->checkPermission($player, self::SETTING_PERMISSION_OPEN_CONFIGURATOR)) { | 		if (!$this->maniaControl->getAuthenticationManager()->checkPermission($player, self::SETTING_PERMISSION_OPEN_CONFIGURATOR)) { | ||||||
| 			$this->maniaControl->authenticationManager->sendNotAllowed($player); | 			$this->maniaControl->getAuthenticationManager()->sendNotAllowed($player); | ||||||
| 			return; | 			return; | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
| @@ -154,7 +154,7 @@ class Configurator implements CallbackListener, CommandListener, ManialinkPageAn | |||||||
| 			$menuId = $this->getMenuId($menuId->getTitle()); | 			$menuId = $this->getMenuId($menuId->getTitle()); | ||||||
| 		} | 		} | ||||||
| 		$manialink = $this->buildManialink($menuId, $player); | 		$manialink = $this->buildManialink($menuId, $player); | ||||||
| 		$this->maniaControl->manialinkManager->displayWidget($manialink, $player, self::MENU_NAME); | 		$this->maniaControl->getManialinkManager()->displayWidget($manialink, $player, self::MENU_NAME); | ||||||
| 		$player->setCache($this, self::CACHE_MENU_SHOWN, true); | 		$player->setCache($this, self::CACHE_MENU_SHOWN, true); | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| @@ -183,12 +183,12 @@ class Configurator implements CallbackListener, CommandListener, ManialinkPageAn | |||||||
| 	 * @return \FML\ManiaLink | 	 * @return \FML\ManiaLink | ||||||
| 	 */ | 	 */ | ||||||
| 	private function buildManialink($menuIdShown = 0, Player $player = null) { | 	private function buildManialink($menuIdShown = 0, Player $player = null) { | ||||||
| 		$menuPosX     = $this->maniaControl->settingManager->getSettingValue($this, self::SETTING_MENU_POSX); | 		$menuPosX     = $this->maniaControl->getSettingManager()->getSettingValue($this, self::SETTING_MENU_POSX); | ||||||
| 		$menuPosY     = $this->maniaControl->settingManager->getSettingValue($this, self::SETTING_MENU_POSY); | 		$menuPosY     = $this->maniaControl->getSettingManager()->getSettingValue($this, self::SETTING_MENU_POSY); | ||||||
| 		$menuWidth    = $this->maniaControl->settingManager->getSettingValue($this, self::SETTING_MENU_WIDTH); | 		$menuWidth    = $this->maniaControl->getSettingManager()->getSettingValue($this, self::SETTING_MENU_WIDTH); | ||||||
| 		$menuHeight   = $this->maniaControl->settingManager->getSettingValue($this, self::SETTING_MENU_HEIGHT); | 		$menuHeight   = $this->maniaControl->getSettingManager()->getSettingValue($this, self::SETTING_MENU_HEIGHT); | ||||||
| 		$quadStyle    = $this->maniaControl->settingManager->getSettingValue($this, self::SETTING_MENU_STYLE); | 		$quadStyle    = $this->maniaControl->getSettingManager()->getSettingValue($this, self::SETTING_MENU_STYLE); | ||||||
| 		$quadSubstyle = $this->maniaControl->settingManager->getSettingValue($this, self::SETTING_MENU_SUBSTYLE); | 		$quadSubstyle = $this->maniaControl->getSettingManager()->getSettingValue($this, self::SETTING_MENU_SUBSTYLE); | ||||||
|  |  | ||||||
| 		$menuListWidth  = $menuWidth * 0.3; | 		$menuListWidth  = $menuWidth * 0.3; | ||||||
| 		$menuItemHeight = 10.; | 		$menuItemHeight = 10.; | ||||||
| @@ -242,7 +242,7 @@ class Configurator implements CallbackListener, CommandListener, ManialinkPageAn | |||||||
| 				if ($menuControl) { | 				if ($menuControl) { | ||||||
| 					$menusFrame->add($menuControl); | 					$menusFrame->add($menuControl); | ||||||
| 				} else { | 				} else { | ||||||
| 					$this->maniaControl->chat->sendError('Error loading Menu!', $player); | 					$this->maniaControl->getChat()->sendError('Error loading Menu!', $player); | ||||||
| 				} | 				} | ||||||
| 			} | 			} | ||||||
|  |  | ||||||
| @@ -313,7 +313,7 @@ class Configurator implements CallbackListener, CommandListener, ManialinkPageAn | |||||||
| 	 */ | 	 */ | ||||||
| 	public function hideMenu(Player $player) { | 	public function hideMenu(Player $player) { | ||||||
| 		$this->closeWidget($player); | 		$this->closeWidget($player); | ||||||
| 		$this->maniaControl->manialinkManager->closeWidget($player); | 		$this->maniaControl->getManialinkManager()->closeWidget($player); | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	/** | 	/** | ||||||
| @@ -362,7 +362,7 @@ class Configurator implements CallbackListener, CommandListener, ManialinkPageAn | |||||||
| 		} | 		} | ||||||
|  |  | ||||||
| 		$login  = $callback[1][1]; | 		$login  = $callback[1][1]; | ||||||
| 		$player = $this->maniaControl->playerManager->getPlayer($login); | 		$player = $this->maniaControl->getPlayerManager()->getPlayer($login); | ||||||
|  |  | ||||||
| 		if ($player) { | 		if ($player) { | ||||||
| 			$actionArray = explode('.', $callback[1][2]); | 			$actionArray = explode('.', $callback[1][2]); | ||||||
|   | |||||||
| @@ -44,17 +44,18 @@ class ManiaControlSettings implements ConfiguratorMenu, CallbackListener { | |||||||
| 	private $maniaControl = null; | 	private $maniaControl = null; | ||||||
|  |  | ||||||
| 	/** | 	/** | ||||||
| 	 * Create a new ManiaControl Settings Instance | 	 * Construct a new ManiaControl Settings instance | ||||||
| 	 * | 	 * | ||||||
| 	 * @param ManiaControl $maniaControl | 	 * @param ManiaControl $maniaControl | ||||||
| 	 */ | 	 */ | ||||||
| 	public function __construct(ManiaControl $maniaControl) { | 	public function __construct(ManiaControl $maniaControl) { | ||||||
| 		$this->maniaControl = $maniaControl; | 		$this->maniaControl = $maniaControl; | ||||||
|  |  | ||||||
| 		// Register for callbacks | 		// Callbacks | ||||||
| 		$this->maniaControl->callbackManager->registerCallbackListener(CallbackManager::CB_MP_PLAYERMANIALINKPAGEANSWER, $this, 'handleManialinkPageAnswer'); | 		$this->maniaControl->getCallbackManager()->registerCallbackListener(CallbackManager::CB_MP_PLAYERMANIALINKPAGEANSWER, $this, 'handleManialinkPageAnswer'); | ||||||
|  |  | ||||||
| 		$this->maniaControl->authenticationManager->definePermissionLevel(self::SETTING_PERMISSION_CHANGE_MC_SETTINGS, AuthenticationManager::AUTH_LEVEL_ADMIN); | 		// Permissions | ||||||
|  | 		$this->maniaControl->getAuthenticationManager()->definePermissionLevel(self::SETTING_PERMISSION_CHANGE_MC_SETTINGS, AuthenticationManager::AUTH_LEVEL_ADMIN); | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	/** | 	/** | ||||||
| @@ -86,7 +87,7 @@ class ManiaControlSettings implements ConfiguratorMenu, CallbackListener { | |||||||
| 	 * @return \FML\Controls\Frame | 	 * @return \FML\Controls\Frame | ||||||
| 	 */ | 	 */ | ||||||
| 	private function getMenuSettingsForClass($settingClass, $width, $height, Script $script, Player $player) { | 	private function getMenuSettingsForClass($settingClass, $width, $height, Script $script, Player $player) { | ||||||
| 		$settings = $this->maniaControl->settingManager->getSettingsByClass($settingClass); | 		$settings = $this->maniaControl->getSettingManager()->getSettingsByClass($settingClass); | ||||||
|  |  | ||||||
| 		$paging = new Paging(); | 		$paging = new Paging(); | ||||||
| 		$script->addFeature($paging); | 		$script->addFeature($paging); | ||||||
| @@ -213,7 +214,7 @@ class ManiaControlSettings implements ConfiguratorMenu, CallbackListener { | |||||||
| 	 * @return \FML\Controls\Frame | 	 * @return \FML\Controls\Frame | ||||||
| 	 */ | 	 */ | ||||||
| 	private function getMenuSettingClasses($width, $height, Script $script, Player $player) { | 	private function getMenuSettingClasses($width, $height, Script $script, Player $player) { | ||||||
| 		$settingClasses = $this->maniaControl->settingManager->getSettingClasses(true); | 		$settingClasses = $this->maniaControl->getSettingManager()->getSettingClasses(true); | ||||||
|  |  | ||||||
| 		$paging = new Paging(); | 		$paging = new Paging(); | ||||||
| 		$script->addFeature($paging); | 		$script->addFeature($paging); | ||||||
| @@ -296,20 +297,20 @@ class ManiaControlSettings implements ConfiguratorMenu, CallbackListener { | |||||||
| 		if ($actionId === self::ACTION_SETTINGCLASS_BACK) { | 		if ($actionId === self::ACTION_SETTINGCLASS_BACK) { | ||||||
| 			// Back to classes list | 			// Back to classes list | ||||||
| 			$login  = $callback[1][1]; | 			$login  = $callback[1][1]; | ||||||
| 			$player = $this->maniaControl->playerManager->getPlayer($login); | 			$player = $this->maniaControl->getPlayerManager()->getPlayer($login); | ||||||
| 			$player->destroyCache($this, self::CACHE_CLASS_OPENED); | 			$player->destroyCache($this, self::CACHE_CLASS_OPENED); | ||||||
| 			$menuId = $this->maniaControl->configurator->getMenuId($this); | 			$menuId = $this->maniaControl->getConfigurator()->getMenuId($this); | ||||||
| 			$this->maniaControl->configurator->showMenu($player, $menuId); | 			$this->maniaControl->getConfigurator()->showMenu($player, $menuId); | ||||||
| 		} else if (strpos($actionId, self::ACTION_PREFIX_SETTINGCLASS) === 0) { | 		} else if (strpos($actionId, self::ACTION_PREFIX_SETTINGCLASS) === 0) { | ||||||
| 			// Setting class selected | 			// Setting class selected | ||||||
| 			$settingClass = substr($actionId, strlen(self::ACTION_PREFIX_SETTINGCLASS)); | 			$settingClass = substr($actionId, strlen(self::ACTION_PREFIX_SETTINGCLASS)); | ||||||
|  |  | ||||||
| 			$login  = $callback[1][1]; | 			$login  = $callback[1][1]; | ||||||
| 			$player = $this->maniaControl->playerManager->getPlayer($login); | 			$player = $this->maniaControl->getPlayerManager()->getPlayer($login); | ||||||
| 			$player->setCache($this, self::CACHE_CLASS_OPENED, $settingClass); | 			$player->setCache($this, self::CACHE_CLASS_OPENED, $settingClass); | ||||||
|  |  | ||||||
| 			$menuId = $this->maniaControl->configurator->getMenuId($this); | 			$menuId = $this->maniaControl->getConfigurator()->getMenuId($this); | ||||||
| 			$this->maniaControl->configurator->showMenu($player, $menuId); | 			$this->maniaControl->getConfigurator()->showMenu($player, $menuId); | ||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| @@ -317,8 +318,8 @@ class ManiaControlSettings implements ConfiguratorMenu, CallbackListener { | |||||||
| 	 * @see \ManiaControl\Configurators\ConfiguratorMenu::saveConfigData() | 	 * @see \ManiaControl\Configurators\ConfiguratorMenu::saveConfigData() | ||||||
| 	 */ | 	 */ | ||||||
| 	public function saveConfigData(array $configData, Player $player) { | 	public function saveConfigData(array $configData, Player $player) { | ||||||
| 		if (!$this->maniaControl->authenticationManager->checkPermission($player, self::SETTING_PERMISSION_CHANGE_MC_SETTINGS)) { | 		if (!$this->maniaControl->getAuthenticationManager()->checkPermission($player, self::SETTING_PERMISSION_CHANGE_MC_SETTINGS)) { | ||||||
| 			$this->maniaControl->authenticationManager->sendNotAllowed($player); | 			$this->maniaControl->getAuthenticationManager()->sendNotAllowed($player); | ||||||
| 			return; | 			return; | ||||||
| 		} | 		} | ||||||
| 		if (!$configData[3] || strpos($configData[3][0]['Name'], self::ACTION_PREFIX_SETTING) !== 0) { | 		if (!$configData[3] || strpos($configData[3][0]['Name'], self::ACTION_PREFIX_SETTING) !== 0) { | ||||||
| @@ -329,7 +330,7 @@ class ManiaControlSettings implements ConfiguratorMenu, CallbackListener { | |||||||
|  |  | ||||||
| 		foreach ($configData[3] as $settingData) { | 		foreach ($configData[3] as $settingData) { | ||||||
| 			$settingIndex  = (int)substr($settingData['Name'], $prefixLength); | 			$settingIndex  = (int)substr($settingData['Name'], $prefixLength); | ||||||
| 			$settingObject = $this->maniaControl->settingManager->getSettingObjectByIndex($settingIndex); | 			$settingObject = $this->maniaControl->getSettingManager()->getSettingObjectByIndex($settingIndex); | ||||||
| 			if (!$settingObject) { | 			if (!$settingObject) { | ||||||
| 				continue; | 				continue; | ||||||
| 			} | 			} | ||||||
| @@ -339,12 +340,12 @@ class ManiaControlSettings implements ConfiguratorMenu, CallbackListener { | |||||||
| 			} | 			} | ||||||
|  |  | ||||||
| 			$settingObject->value = $settingData['Value']; | 			$settingObject->value = $settingData['Value']; | ||||||
| 			$this->maniaControl->settingManager->saveSetting($settingObject); | 			$this->maniaControl->getSettingManager()->saveSetting($settingObject); | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
| 		$this->maniaControl->chat->sendSuccess('Settings saved!', $player); | 		$this->maniaControl->getChat()->sendSuccess('Settings saved!', $player); | ||||||
|  |  | ||||||
| 		// Reopen the Menu | 		// Reopen the Menu | ||||||
| 		$this->maniaControl->configurator->showMenu($player, $this); | 		$this->maniaControl->getConfigurator()->showMenu($player, $this); | ||||||
| 	} | 	} | ||||||
| } | } | ||||||
|   | |||||||
| @@ -52,12 +52,14 @@ class ScriptSettings implements ConfiguratorMenu, CallbackListener { | |||||||
| 		$this->initTables(); | 		$this->initTables(); | ||||||
|  |  | ||||||
| 		// Callbacks | 		// Callbacks | ||||||
| 		$this->maniaControl->callbackManager->registerCallbackListener(Callbacks::ONINIT, $this, 'onInit'); | 		$this->maniaControl->getCallbackManager()->registerCallbackListener(Callbacks::ONINIT, $this, 'onInit'); | ||||||
| 		$this->maniaControl->callbackManager->registerCallbackListener(Callbacks::BEGINMAP, $this, 'onBeginMap'); | 		$this->maniaControl->getCallbackManager()->registerCallbackListener(Callbacks::BEGINMAP, $this, 'onBeginMap'); | ||||||
| 		$this->maniaControl->settingManager->initSetting($this, self::SETTING_LOAD_DEFAULT_SETTINGS_MAP_BEGIN, false); |  | ||||||
|  | 		// Settings | ||||||
|  | 		$this->maniaControl->getSettingManager()->initSetting($this, self::SETTING_LOAD_DEFAULT_SETTINGS_MAP_BEGIN, false); | ||||||
|  |  | ||||||
| 		// Permissions | 		// Permissions | ||||||
| 		$this->maniaControl->authenticationManager->definePermissionLevel(self::SETTING_PERMISSION_CHANGE_SCRIPT_SETTINGS, AuthenticationManager::AUTH_LEVEL_ADMIN); | 		$this->maniaControl->getAuthenticationManager()->definePermissionLevel(self::SETTING_PERMISSION_CHANGE_SCRIPT_SETTINGS, AuthenticationManager::AUTH_LEVEL_ADMIN); | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	/** | 	/** | ||||||
| @@ -66,7 +68,7 @@ class ScriptSettings implements ConfiguratorMenu, CallbackListener { | |||||||
| 	 * @return boolean | 	 * @return boolean | ||||||
| 	 */ | 	 */ | ||||||
| 	private function initTables() { | 	private function initTables() { | ||||||
| 		$mysqli = $this->maniaControl->database->mysqli; | 		$mysqli = $this->maniaControl->getDatabase()->getMysqli(); | ||||||
| 		$query  = "CREATE TABLE IF NOT EXISTS `" . self::TABLE_SCRIPT_SETTINGS . "` ( | 		$query  = "CREATE TABLE IF NOT EXISTS `" . self::TABLE_SCRIPT_SETTINGS . "` ( | ||||||
| 				`index` int(11) NOT NULL AUTO_INCREMENT, | 				`index` int(11) NOT NULL AUTO_INCREMENT, | ||||||
| 				`serverIndex` int(11) NOT NULL, | 				`serverIndex` int(11) NOT NULL, | ||||||
| @@ -111,13 +113,13 @@ class ScriptSettings implements ConfiguratorMenu, CallbackListener { | |||||||
| 	 */ | 	 */ | ||||||
| 	public function loadSettingsFromDatabase() { | 	public function loadSettingsFromDatabase() { | ||||||
| 		try { | 		try { | ||||||
| 			$scriptSettings = $this->maniaControl->client->getModeScriptSettings(); | 			$scriptSettings = $this->maniaControl->getClient()->getModeScriptSettings(); | ||||||
| 		} catch (GameModeException $e) { | 		} catch (GameModeException $e) { | ||||||
| 			return false; | 			return false; | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
| 		$mysqli      = $this->maniaControl->database->mysqli; | 		$mysqli      = $this->maniaControl->getDatabase()->getMysqli(); | ||||||
| 		$serverIndex = $this->maniaControl->server->index; | 		$serverIndex = $this->maniaControl->getServer()->index; | ||||||
| 		$query       = "SELECT * FROM `" . self::TABLE_SCRIPT_SETTINGS . "` | 		$query       = "SELECT * FROM `" . self::TABLE_SCRIPT_SETTINGS . "` | ||||||
| 				WHERE serverIndex = {$serverIndex};"; | 				WHERE serverIndex = {$serverIndex};"; | ||||||
| 		$result      = $mysqli->query($query); | 		$result      = $mysqli->query($query); | ||||||
| @@ -139,14 +141,14 @@ class ScriptSettings implements ConfiguratorMenu, CallbackListener { | |||||||
| 			return true; | 			return true; | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
| 		return $this->maniaControl->client->setModeScriptSettings($loadedSettings); | 		return $this->maniaControl->getClient()->setModeScriptSettings($loadedSettings); | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	/** | 	/** | ||||||
| 	 * Handle Begin Map Callback | 	 * Handle Begin Map Callback | ||||||
| 	 */ | 	 */ | ||||||
| 	public function onBeginMap() { | 	public function onBeginMap() { | ||||||
| 		if ($this->maniaControl->settingManager->getSettingValue($this, self::SETTING_LOAD_DEFAULT_SETTINGS_MAP_BEGIN)) { | 		if ($this->maniaControl->getSettingManager()->getSettingValue($this, self::SETTING_LOAD_DEFAULT_SETTINGS_MAP_BEGIN)) { | ||||||
| 			$this->loadSettingsFromDatabase(); | 			$this->loadSettingsFromDatabase(); | ||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
| @@ -160,7 +162,7 @@ class ScriptSettings implements ConfiguratorMenu, CallbackListener { | |||||||
| 		$frame = new Frame(); | 		$frame = new Frame(); | ||||||
|  |  | ||||||
| 		try { | 		try { | ||||||
| 			$scriptInfo = $this->maniaControl->client->getModeScriptInfo(); | 			$scriptInfo = $this->maniaControl->getClient()->getModeScriptInfo(); | ||||||
| 		} catch (GameModeException $e) { | 		} catch (GameModeException $e) { | ||||||
| 			$label = new Label(); | 			$label = new Label(); | ||||||
| 			$frame->add($label); | 			$frame->add($label); | ||||||
| @@ -171,7 +173,7 @@ class ScriptSettings implements ConfiguratorMenu, CallbackListener { | |||||||
| 		$scriptParams = $scriptInfo->paramDescs; | 		$scriptParams = $scriptInfo->paramDescs; | ||||||
|  |  | ||||||
| 		try { | 		try { | ||||||
| 			$scriptSettings = $this->maniaControl->client->getModeScriptSettings(); | 			$scriptSettings = $this->maniaControl->getClient()->getModeScriptSettings(); | ||||||
| 		} catch (GameModeException $e) { | 		} catch (GameModeException $e) { | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
| @@ -278,8 +280,8 @@ class ScriptSettings implements ConfiguratorMenu, CallbackListener { | |||||||
| 	 * @see \ManiaControl\Configurators\ConfiguratorMenu::saveConfigData() | 	 * @see \ManiaControl\Configurators\ConfiguratorMenu::saveConfigData() | ||||||
| 	 */ | 	 */ | ||||||
| 	public function saveConfigData(array $configData, Player $player) { | 	public function saveConfigData(array $configData, Player $player) { | ||||||
| 		if (!$this->maniaControl->authenticationManager->checkPermission($player, self::SETTING_PERMISSION_CHANGE_SCRIPT_SETTINGS)) { | 		if (!$this->maniaControl->getAuthenticationManager()->checkPermission($player, self::SETTING_PERMISSION_CHANGE_SCRIPT_SETTINGS)) { | ||||||
| 			$this->maniaControl->authenticationManager->sendNotAllowed($player); | 			$this->maniaControl->getAuthenticationManager()->sendNotAllowed($player); | ||||||
| 			return; | 			return; | ||||||
| 		} | 		} | ||||||
| 		if (!$configData[3] || strpos($configData[3][0]['Name'], self::ACTION_PREFIX_SETTING) !== 0) { | 		if (!$configData[3] || strpos($configData[3][0]['Name'], self::ACTION_PREFIX_SETTING) !== 0) { | ||||||
| @@ -287,7 +289,7 @@ class ScriptSettings implements ConfiguratorMenu, CallbackListener { | |||||||
| 		} | 		} | ||||||
|  |  | ||||||
| 		try { | 		try { | ||||||
| 			$scriptSettings = $this->maniaControl->client->getModeScriptSettings(); | 			$scriptSettings = $this->maniaControl->getClient()->getModeScriptSettings(); | ||||||
| 		} catch (GameModeException $e) { | 		} catch (GameModeException $e) { | ||||||
| 			return; | 			return; | ||||||
| 		} | 		} | ||||||
| @@ -313,13 +315,13 @@ class ScriptSettings implements ConfiguratorMenu, CallbackListener { | |||||||
|  |  | ||||||
| 		$success = $this->applyNewScriptSettings($newSettings, $player); | 		$success = $this->applyNewScriptSettings($newSettings, $player); | ||||||
| 		if ($success) { | 		if ($success) { | ||||||
| 			$this->maniaControl->chat->sendSuccess('Script Settings saved!', $player); | 			$this->maniaControl->getChat()->sendSuccess('Script Settings saved!', $player); | ||||||
| 		} else { | 		} else { | ||||||
| 			$this->maniaControl->chat->sendError('Script Settings Saving failed!', $player); | 			$this->maniaControl->getChat()->sendError('Script Settings Saving failed!', $player); | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
| 		// Reopen the Menu | 		// Reopen the Menu | ||||||
| 		$this->maniaControl->configurator->showMenu($player, $this); | 		$this->maniaControl->getConfigurator()->showMenu($player, $this); | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	/** | 	/** | ||||||
| @@ -334,10 +336,10 @@ class ScriptSettings implements ConfiguratorMenu, CallbackListener { | |||||||
| 			return true; | 			return true; | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
| 		$this->maniaControl->client->setModeScriptSettings($newSettings); | 		$this->maniaControl->getClient()->setModeScriptSettings($newSettings); | ||||||
|  |  | ||||||
| 		// Save Settings into Database | 		// Save Settings into Database | ||||||
| 		$mysqli    = $this->maniaControl->database->mysqli; | 		$mysqli    = $this->maniaControl->getDatabase()->getMysqli(); | ||||||
| 		$query     = "INSERT INTO `" . self::TABLE_SCRIPT_SETTINGS . "` ( | 		$query     = "INSERT INTO `" . self::TABLE_SCRIPT_SETTINGS . "` ( | ||||||
| 				`serverIndex`, | 				`serverIndex`, | ||||||
| 				`settingName`, | 				`settingName`, | ||||||
| @@ -353,13 +355,13 @@ class ScriptSettings implements ConfiguratorMenu, CallbackListener { | |||||||
| 		} | 		} | ||||||
| 		$settingName  = null; | 		$settingName  = null; | ||||||
| 		$settingValue = null; | 		$settingValue = null; | ||||||
| 		$statement->bind_param('iss', $this->maniaControl->server->index, $settingName, $settingValue); | 		$statement->bind_param('iss', $this->maniaControl->getServer()->index, $settingName, $settingValue); | ||||||
|  |  | ||||||
| 		// Notifications | 		// Notifications | ||||||
| 		$settingsCount = count($newSettings); | 		$settingsCount = count($newSettings); | ||||||
| 		$settingIndex  = 0; | 		$settingIndex  = 0; | ||||||
| 		$title         = $this->maniaControl->authenticationManager->getAuthLevelName($player); | 		$title         = $this->maniaControl->getAuthenticationManager()->getAuthLevelName($player); | ||||||
| 		$chatMessage   = '$ff0' . $title . ' $<' . $player->nickname . '$> set ScriptSetting' . ($settingsCount > 1 ? 's' : '') . ' '; | 		$chatMessage   = '$ff0' . $title . ' '. $player->getEscapedNickname() . ' set ScriptSetting' . ($settingsCount > 1 ? 's' : '') . ' '; | ||||||
| 		foreach ($newSettings as $setting => $value) { | 		foreach ($newSettings as $setting => $value) { | ||||||
| 			$chatMessage .= '$<' . '$fff' . preg_replace('/^S_/', '', $setting) . '$z$s$ff0 '; | 			$chatMessage .= '$<' . '$fff' . preg_replace('/^S_/', '', $setting) . '$z$s$ff0 '; | ||||||
| 			$chatMessage .= 'to $fff' . $this->parseSettingValue($value) . '$>'; | 			$chatMessage .= 'to $fff' . $this->parseSettingValue($value) . '$>'; | ||||||
| @@ -377,16 +379,16 @@ class ScriptSettings implements ConfiguratorMenu, CallbackListener { | |||||||
| 			} | 			} | ||||||
|  |  | ||||||
| 			// Trigger own callback | 			// Trigger own callback | ||||||
| 			$this->maniaControl->callbackManager->triggerCallback(self::CB_SCRIPTSETTING_CHANGED, $setting, $value); | 			$this->maniaControl->getCallbackManager()->triggerCallback(self::CB_SCRIPTSETTING_CHANGED, $setting, $value); | ||||||
|  |  | ||||||
| 			$settingIndex++; | 			$settingIndex++; | ||||||
| 		} | 		} | ||||||
| 		$statement->close(); | 		$statement->close(); | ||||||
|  |  | ||||||
| 		$this->maniaControl->callbackManager->triggerCallback(self::CB_SCRIPTSETTINGS_CHANGED); | 		$this->maniaControl->getCallbackManager()->triggerCallback(self::CB_SCRIPTSETTINGS_CHANGED); | ||||||
|  |  | ||||||
| 		$chatMessage .= '!'; | 		$chatMessage .= '!'; | ||||||
| 		$this->maniaControl->chat->sendInformation($chatMessage); | 		$this->maniaControl->getChat()->sendInformation($chatMessage); | ||||||
| 		$this->maniaControl->log($chatMessage, true); | 		$this->maniaControl->log($chatMessage, true); | ||||||
| 		return true; | 		return true; | ||||||
| 	} | 	} | ||||||
|   | |||||||
| @@ -17,6 +17,7 @@ class Database implements TimerListener { | |||||||
| 	 * Public properties | 	 * Public properties | ||||||
| 	 */ | 	 */ | ||||||
| 	/** @var \mysqli $mysqli */ | 	/** @var \mysqli $mysqli */ | ||||||
|  | 	/** @deprecated see getMysqli() */ | ||||||
| 	public $mysqli = null; | 	public $mysqli = null; | ||||||
|  |  | ||||||
| 	/* | 	/* | ||||||
| @@ -43,19 +44,19 @@ class Database implements TimerListener { | |||||||
| 		// Open database connection | 		// Open database connection | ||||||
| 		$this->loadConfig(); | 		$this->loadConfig(); | ||||||
| 		$this->mysqli = @new \mysqli($this->config->host, $this->config->user, $this->config->pass, null, $this->config->port); | 		$this->mysqli = @new \mysqli($this->config->host, $this->config->user, $this->config->pass, null, $this->config->port); | ||||||
| 		if ($this->mysqli->connect_error) { | 		if ($connectError = $this->getMysqli()->connect_error) { | ||||||
| 			$message = "Couldn't connect to Database: '{$this->mysqli->connect_error}'"; | 			$message = "Couldn't connect to Database: '{$connectError}'"; | ||||||
| 			$this->maniaControl->quit($message, true); | 			$this->maniaControl->quit($message, true); | ||||||
| 		} | 		} | ||||||
| 		$this->mysqli->set_charset("utf8"); | 		$this->getMysqli()->set_charset("utf8"); | ||||||
|  |  | ||||||
| 		$this->initDatabase(); | 		$this->initDatabase(); | ||||||
| 		$this->optimizeTables(); | 		$this->optimizeTables(); | ||||||
|  |  | ||||||
| 		// Register Method which checks the Database Connection every 5 seconds | 		// Register Method which checks the Database Connection every 5 seconds | ||||||
| 		$this->maniaControl->timerManager->registerTimerListening($this, 'checkConnection', 5000); | 		$this->maniaControl->getTimerManager()->registerTimerListening($this, 'checkConnection', 5000); | ||||||
|  |  | ||||||
| 		// Create migration helper | 		// Children | ||||||
| 		$this->migrationHelper = new MigrationHelper($maniaControl); | 		$this->migrationHelper = new MigrationHelper($maniaControl); | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| @@ -63,7 +64,7 @@ class Database implements TimerListener { | |||||||
| 	 * Load the Database Config | 	 * Load the Database Config | ||||||
| 	 */ | 	 */ | ||||||
| 	private function loadConfig() { | 	private function loadConfig() { | ||||||
| 		$databaseElements = $this->maniaControl->config->xpath('database'); | 		$databaseElements = $this->maniaControl->getConfig()->xpath('database'); | ||||||
| 		if (!$databaseElements) { | 		if (!$databaseElements) { | ||||||
| 			trigger_error('No Database configured!', E_USER_ERROR); | 			trigger_error('No Database configured!', E_USER_ERROR); | ||||||
| 		} | 		} | ||||||
| @@ -122,24 +123,24 @@ class Database implements TimerListener { | |||||||
| 	 */ | 	 */ | ||||||
| 	private function initDatabase() { | 	private function initDatabase() { | ||||||
| 		// Try to connect | 		// Try to connect | ||||||
| 		$result = $this->mysqli->select_db($this->config->name); | 		$result = $this->getMysqli()->select_db($this->config->name); | ||||||
| 		if ($result) { | 		if ($result) { | ||||||
| 			return true; | 			return true; | ||||||
| 		} | 		} | ||||||
| 		$this->maniaControl->log("Database '{$this->config->name}' doesn't exist! Trying to create it..."); | 		$this->maniaControl->log("Database '{$this->config->name}' doesn't exist! Trying to create it..."); | ||||||
|  |  | ||||||
| 		// Create database | 		// Create database | ||||||
| 		$databaseQuery = "CREATE DATABASE " . $this->mysqli->escape_string($this->config->name) . ";"; | 		$databaseQuery = "CREATE DATABASE " . $this->getMysqli()->escape_string($this->config->name) . ";"; | ||||||
| 		$this->mysqli->query($databaseQuery); | 		$this->getMysqli()->query($databaseQuery); | ||||||
| 		if ($this->mysqli->error) { | 		if ($this->getMysqli()->error) { | ||||||
| 			$this->maniaControl->quit($this->mysqli->error, true); | 			$this->maniaControl->quit($this->getMysqli()->error, true); | ||||||
| 			return false; | 			return false; | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
| 		// Connect to new database | 		// Connect to new database | ||||||
| 		$this->mysqli->select_db($this->config->name); | 		$this->getMysqli()->select_db($this->config->name); | ||||||
| 		if ($this->mysqli->error) { | 		if ($error = $this->getMysqli()->error) { | ||||||
| 			$message = "Couldn't select database '{$this->config->name}'. {$this->mysqli->error}"; | 			$message = "Couldn't select database '{$this->config->name}'. {$error}"; | ||||||
| 			$this->maniaControl->quit($message, true); | 			$this->maniaControl->quit($message, true); | ||||||
| 			return false; | 			return false; | ||||||
| 		} | 		} | ||||||
| @@ -153,10 +154,10 @@ class Database implements TimerListener { | |||||||
| 	 * @return bool | 	 * @return bool | ||||||
| 	 */ | 	 */ | ||||||
| 	private function optimizeTables() { | 	private function optimizeTables() { | ||||||
| 		$showQuery = "SHOW TABLES;"; | 		$showQuery = 'SHOW TABLES;'; | ||||||
| 		$result    = $this->mysqli->query($showQuery); | 		$result    = $this->getMysqli()->query($showQuery); | ||||||
| 		if ($this->mysqli->error) { | 		if ($error = $this->getMysqli()->error) { | ||||||
| 			trigger_error($this->mysqli->error); | 			trigger_error($error); | ||||||
| 			return false; | 			return false; | ||||||
| 		} | 		} | ||||||
| 		$count = $result->num_rows; | 		$count = $result->num_rows; | ||||||
| @@ -164,26 +165,35 @@ class Database implements TimerListener { | |||||||
| 			$result->free(); | 			$result->free(); | ||||||
| 			return true; | 			return true; | ||||||
| 		} | 		} | ||||||
| 		$optimizeQuery = "OPTIMIZE TABLE "; | 		$optimizeQuery = 'OPTIMIZE TABLE '; | ||||||
| 		$index         = 0; | 		$index         = 0; | ||||||
| 		while ($row = $result->fetch_row()) { | 		while ($row = $result->fetch_row()) { | ||||||
| 			$tableName = $row[0]; | 			$tableName = $row[0]; | ||||||
| 			$optimizeQuery .= "`{$tableName}`"; | 			$optimizeQuery .= "`{$tableName}`"; | ||||||
| 			if ($index < $count - 1) { | 			if ($index < $count - 1) { | ||||||
| 				$optimizeQuery .= ", "; | 				$optimizeQuery .= ','; | ||||||
| 			} | 			} | ||||||
| 			$index++; | 			$index++; | ||||||
| 		} | 		} | ||||||
| 		$result->free(); | 		$result->free(); | ||||||
| 		$optimizeQuery .= ";"; | 		$optimizeQuery .= ';'; | ||||||
| 		$this->mysqli->query($optimizeQuery); | 		$this->getMysqli()->query($optimizeQuery); | ||||||
| 		if ($this->mysqli->error) { | 		if ($error = $this->getMysqli()->error) { | ||||||
| 			trigger_error($this->mysqli->error); | 			trigger_error($error); | ||||||
| 			return false; | 			return false; | ||||||
| 		} | 		} | ||||||
| 		return true; | 		return true; | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
|  | 	/** | ||||||
|  | 	 * Return the mysqli instance | ||||||
|  | 	 * | ||||||
|  | 	 * @return \mysqli | ||||||
|  | 	 */ | ||||||
|  | 	public function getMysqli() { | ||||||
|  | 		return $this->mysqli; | ||||||
|  | 	} | ||||||
|  |  | ||||||
| 	/** | 	/** | ||||||
| 	 * Return the database config | 	 * Return the database config | ||||||
| 	 * | 	 * | ||||||
| @@ -202,20 +212,11 @@ class Database implements TimerListener { | |||||||
| 		return $this->migrationHelper; | 		return $this->migrationHelper; | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	/** |  | ||||||
| 	 * Return the mysqli instance |  | ||||||
| 	 * |  | ||||||
| 	 * @return \mysqli |  | ||||||
| 	 */ |  | ||||||
| 	public function getMysqli() { |  | ||||||
| 		return $this->mysqli; |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
| 	/** | 	/** | ||||||
| 	 * Check whether the Database Connection is still open | 	 * Check whether the Database Connection is still open | ||||||
| 	 */ | 	 */ | ||||||
| 	public function checkConnection() { | 	public function checkConnection() { | ||||||
| 		if (!$this->mysqli || !$this->mysqli->ping()) { | 		if (!$this->getMysqli() || !$this->getMysqli()->ping()) { | ||||||
| 			$this->maniaControl->quit('The MySQL Server has gone away!', true); | 			$this->maniaControl->quit('The MySQL Server has gone away!', true); | ||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
| @@ -224,8 +225,8 @@ class Database implements TimerListener { | |||||||
| 	 * Destruct Database Connection | 	 * Destruct Database Connection | ||||||
| 	 */ | 	 */ | ||||||
| 	public function __destruct() { | 	public function __destruct() { | ||||||
| 		if ($this->mysqli && !$this->mysqli->connect_error) { | 		if ($this->getMysqli() && !$this->getMysqli()->connect_error) { | ||||||
| 			$this->mysqli->close(); | 			$this->getMysqli()->close(); | ||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
| } | } | ||||||
|   | |||||||
| @@ -40,7 +40,7 @@ class MigrationHelper { | |||||||
| 		$sourceClass = ClassUtil::getClass($sourceClass); | 		$sourceClass = ClassUtil::getClass($sourceClass); | ||||||
| 		$targetClass = ClassUtil::getClass($targetClass); | 		$targetClass = ClassUtil::getClass($targetClass); | ||||||
|  |  | ||||||
| 		$mysqli = $this->maniaControl->database->mysqli; | 		$mysqli = $this->maniaControl->getDatabase()->getMysqli(); | ||||||
|  |  | ||||||
| 		$query     = "INSERT IGNORE INTO `" . SettingManager::TABLE_SETTINGS . "` | 		$query     = "INSERT IGNORE INTO `" . SettingManager::TABLE_SETTINGS . "` | ||||||
| 				(`class`, `setting`, `type`, `value`, `default`) | 				(`class`, `setting`, `type`, `value`, `default`) | ||||||
|   | |||||||
| @@ -47,7 +47,7 @@ class ErrorHandler { | |||||||
| 	 * Initialize error handler features | 	 * Initialize error handler features | ||||||
| 	 */ | 	 */ | ||||||
| 	public function init() { | 	public function init() { | ||||||
| 		$this->maniaControl->settingManager->initSetting($this, self::SETTING_RESTART_ON_EXCEPTION, true); | 		$this->maniaControl->getSettingManager()->initSetting($this, self::SETTING_RESTART_ON_EXCEPTION, true); | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	/** | 	/** | ||||||
| @@ -125,7 +125,7 @@ class ErrorHandler { | |||||||
| 				if ($pluginId > 0) { | 				if ($pluginId > 0) { | ||||||
| 					$report['PluginId'] = $pluginId; | 					$report['PluginId'] = $pluginId; | ||||||
| 					if ($isFatalError) { | 					if ($isFatalError) { | ||||||
| 						$this->maniaControl->pluginManager->deactivatePlugin($sourceClass); | 						$this->maniaControl->getPluginManager()->deactivatePlugin($sourceClass); | ||||||
| 					} | 					} | ||||||
| 				} | 				} | ||||||
| 			} | 			} | ||||||
| @@ -135,13 +135,13 @@ class ErrorHandler { | |||||||
| 			$report['OperatingSystem'] = php_uname(); | 			$report['OperatingSystem'] = php_uname(); | ||||||
| 			$report['PHPVersion']      = phpversion(); | 			$report['PHPVersion']      = phpversion(); | ||||||
|  |  | ||||||
| 			if ($this->maniaControl->server) { | 			if ($this->maniaControl->getServer()) { | ||||||
| 				$report['ServerLogin'] = $this->maniaControl->server->login; | 				$report['ServerLogin'] = $this->maniaControl->getServer()->login; | ||||||
| 			} | 			} | ||||||
|  |  | ||||||
| 			if ($this->maniaControl->settingManager && $this->maniaControl->updateManager) { | 			if ($this->maniaControl->getSettingManager() && $this->maniaControl->getUpdateManager()) { | ||||||
| 				$report['UpdateChannel']       = $this->maniaControl->settingManager->getSettingValue($this->maniaControl->updateManager, UpdateManager::SETTING_UPDATECHECK_CHANNEL); | 				$report['UpdateChannel']       = $this->maniaControl->getSettingManager()->getSettingValue($this->maniaControl->getUpdateManager(), UpdateManager::SETTING_UPDATECHECK_CHANNEL); | ||||||
| 				$report['ManiaControlVersion'] = ManiaControl::VERSION . ' ' . $this->maniaControl->updateManager->getNightlyBuildDate(); | 				$report['ManiaControlVersion'] = ManiaControl::VERSION . ' ' . $this->maniaControl->getUpdateManager()->getNightlyBuildDate(); | ||||||
| 			} else { | 			} else { | ||||||
| 				$report['ManiaControlVersion'] = ManiaControl::VERSION; | 				$report['ManiaControlVersion'] = ManiaControl::VERSION; | ||||||
| 			} | 			} | ||||||
| @@ -393,19 +393,19 @@ class ErrorHandler { | |||||||
| 	public function handleShutdown() { | 	public function handleShutdown() { | ||||||
| 		// TODO: skip client-related actions on transport exception (e.g. server down) | 		// TODO: skip client-related actions on transport exception (e.g. server down) | ||||||
|  |  | ||||||
| 		if ($this->maniaControl->callbackManager) { | 		if ($this->maniaControl->getCallbackManager()) { | ||||||
| 			// OnShutdown callback | 			// OnShutdown callback | ||||||
| 			$this->maniaControl->callbackManager->triggerCallback(Callbacks::ONSHUTDOWN); | 			$this->maniaControl->getCallbackManager()->triggerCallback(Callbacks::ONSHUTDOWN); | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
| 		if ($this->maniaControl->chat) { | 		if ($this->maniaControl->getChat()) { | ||||||
| 			// Announce quit | 			// Announce quit | ||||||
| 			$this->maniaControl->chat->sendInformation('ManiaControl shutting down.'); | 			$this->maniaControl->getChat()->sendInformation('ManiaControl shutting down.'); | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
| 		if ($this->maniaControl->client) { | 		if ($this->maniaControl->getClient()) { | ||||||
| 			try { | 			try { | ||||||
| 				$this->maniaControl->client->sendHideManialinkPage(); | 				$this->maniaControl->getClient()->sendHideManialinkPage(); | ||||||
| 			} catch (TransportException $e) { | 			} catch (TransportException $e) { | ||||||
| 				$this->handleException($e, false); | 				$this->handleException($e, false); | ||||||
| 			} | 			} | ||||||
| @@ -448,13 +448,13 @@ class ErrorHandler { | |||||||
| 			$report['OperatingSystem'] = php_uname(); | 			$report['OperatingSystem'] = php_uname(); | ||||||
| 			$report['PHPVersion']      = phpversion(); | 			$report['PHPVersion']      = phpversion(); | ||||||
|  |  | ||||||
| 			if ($this->maniaControl->server) { | 			if ($this->maniaControl->getServer()) { | ||||||
| 				$report['ServerLogin'] = $this->maniaControl->server->login; | 				$report['ServerLogin'] = $this->maniaControl->getServer()->login; | ||||||
| 			} | 			} | ||||||
|  |  | ||||||
| 			if ($this->maniaControl->settingManager && $this->maniaControl->updateManager) { | 			if ($this->maniaControl->getSettingManager() && $this->maniaControl->getUpdateManager()) { | ||||||
| 				$report['UpdateChannel']       = $this->maniaControl->settingManager->getSettingValue($this->maniaControl->updateManager, UpdateManager::SETTING_UPDATECHECK_CHANNEL); | 				$report['UpdateChannel']       = $this->maniaControl->getSettingManager()->getSettingValue($this->maniaControl->getUpdateManager(), UpdateManager::SETTING_UPDATECHECK_CHANNEL); | ||||||
| 				$report['ManiaControlVersion'] = ManiaControl::VERSION . ' #' . $this->maniaControl->updateManager->getNightlyBuildDate(); | 				$report['ManiaControlVersion'] = ManiaControl::VERSION . ' #' . $this->maniaControl->getUpdateManager()->getNightlyBuildDate(); | ||||||
| 			} else { | 			} else { | ||||||
| 				$report['ManiaControlVersion'] = ManiaControl::VERSION; | 				$report['ManiaControlVersion'] = ManiaControl::VERSION; | ||||||
| 			} | 			} | ||||||
| @@ -487,10 +487,10 @@ class ErrorHandler { | |||||||
| 	 * @return bool | 	 * @return bool | ||||||
| 	 */ | 	 */ | ||||||
| 	private function shouldRestart() { | 	private function shouldRestart() { | ||||||
| 		if (!$this->maniaControl || !$this->maniaControl->settingManager || DEV_MODE) { | 		if (!$this->maniaControl || !$this->maniaControl->getSettingManager() || DEV_MODE) { | ||||||
| 			return false; | 			return false; | ||||||
| 		} | 		} | ||||||
| 		$setting = $this->maniaControl->settingManager->getSettingValue($this, self::SETTING_RESTART_ON_EXCEPTION, true); | 		$setting = $this->maniaControl->getSettingManager()->getSettingValue($this, self::SETTING_RESTART_ON_EXCEPTION, true); | ||||||
| 		return $setting; | 		return $setting; | ||||||
| 	} | 	} | ||||||
| } | } | ||||||
|   | |||||||
| @@ -59,29 +59,68 @@ class ManiaControl implements CallbackListener, CommandListener, TimerListener { | |||||||
| 	/* | 	/* | ||||||
| 	 * Public properties | 	 * Public properties | ||||||
| 	 */ | 	 */ | ||||||
|  | 	/** @var ActionsMenu $actionsMenu */ | ||||||
|  | 	/** @deprecated see getActionsMenu() */ | ||||||
| 	public $actionsMenu = null; | 	public $actionsMenu = null; | ||||||
|  | 	/** @var AuthenticationManager $authenticationManager */ | ||||||
|  | 	/** @deprecated see getAuthenticationManager() */ | ||||||
| 	public $authenticationManager = null; | 	public $authenticationManager = null; | ||||||
|  | 	/** @var CallbackManager $callbackManager */ | ||||||
|  | 	/** @deprecated see getCallbackManager() */ | ||||||
| 	public $callbackManager = null; | 	public $callbackManager = null; | ||||||
|  | 	/** @var Chat $chat */ | ||||||
|  | 	/** @deprecated see getChat() */ | ||||||
| 	public $chat = null; | 	public $chat = null; | ||||||
| 	/** @var \SimpleXMLElement $config */ | 	/** @var \SimpleXMLElement $config */ | ||||||
|  | 	/** @deprecated see getConfig() */ | ||||||
| 	public $config = null; | 	public $config = null; | ||||||
|  | 	/** @var Configurator $configurator */ | ||||||
|  | 	/** @deprecated see getConfigurator() */ | ||||||
| 	public $configurator = null; | 	public $configurator = null; | ||||||
| 	/** @var Connection $client */ | 	/** @var Connection $client */ | ||||||
|  | 	/** @deprecated see getClient() */ | ||||||
| 	public $client = null; | 	public $client = null; | ||||||
|  | 	/** @var CommandManager $commandManager */ | ||||||
|  | 	/** @deprecated see getCommandManager() */ | ||||||
| 	public $commandManager = null; | 	public $commandManager = null; | ||||||
|  | 	/** @var Database $database */ | ||||||
|  | 	/** @deprecated see getDatabase() */ | ||||||
| 	public $database = null; | 	public $database = null; | ||||||
|  | 	/** @var ManialinkManager $manialinkManager */ | ||||||
|  | 	/** @deprecated see getManialinkManager */ | ||||||
| 	public $manialinkManager = null; | 	public $manialinkManager = null; | ||||||
|  | 	/** @var MapManager $mapManager */ | ||||||
|  | 	/** @deprecated see getMapManager() */ | ||||||
| 	public $mapManager = null; | 	public $mapManager = null; | ||||||
|  | 	/** @var PlayerManager $playerManager */ | ||||||
|  | 	/** @deprecated see getPlayerManager() */ | ||||||
| 	public $playerManager = null; | 	public $playerManager = null; | ||||||
|  | 	/** @var PluginManager $pluginManager */ | ||||||
|  | 	/** @deprecated see getPluginManager() */ | ||||||
| 	public $pluginManager = null; | 	public $pluginManager = null; | ||||||
|  | 	/** @var Server $server */ | ||||||
|  | 	/** @deprecated see getServer() */ | ||||||
| 	public $server = null; | 	public $server = null; | ||||||
|  | 	/** @var SettingManager $settingManager */ | ||||||
|  | 	/** @deprecated see getSettingManager() */ | ||||||
| 	public $settingManager = null; | 	public $settingManager = null; | ||||||
|  | 	/** @var StatisticManager $statisticManager */ | ||||||
|  | 	/** @deprecated see getStatisticManager() */ | ||||||
| 	public $statisticManager = null; | 	public $statisticManager = null; | ||||||
| 	/** @var UpdateManager $updateManager */ | 	/** @var UpdateManager $updateManager */ | ||||||
|  | 	/** @deprecated see getUpdateManager() */ | ||||||
| 	public $updateManager = null; | 	public $updateManager = null; | ||||||
|  | 	/** @var ErrorHandler $errorHandler */ | ||||||
|  | 	/** @deprecated see getErrorHandler() */ | ||||||
| 	public $errorHandler = null; | 	public $errorHandler = null; | ||||||
|  | 	/** @var TimerManager $timerManager */ | ||||||
|  | 	/** @deprecated see getTimerManager() */ | ||||||
| 	public $timerManager = null; | 	public $timerManager = null; | ||||||
|  | 	/** @var AsynchronousFileReader $fileReader */ | ||||||
|  | 	/** @deprecated see getFileReader() */ | ||||||
| 	public $fileReader = null; | 	public $fileReader = null; | ||||||
|  | 	/** @var BillManager $billManager */ | ||||||
|  | 	/** @deprecated see getBillManager() */ | ||||||
| 	public $billManager = null; | 	public $billManager = null; | ||||||
|  |  | ||||||
| 	/* | 	/* | ||||||
| @@ -119,19 +158,19 @@ class ManiaControl implements CallbackListener, CommandListener, TimerListener { | |||||||
| 		$this->pluginManager         = new PluginManager($this); | 		$this->pluginManager         = new PluginManager($this); | ||||||
| 		$this->updateManager         = new UpdateManager($this); | 		$this->updateManager         = new UpdateManager($this); | ||||||
|  |  | ||||||
| 		$this->errorHandler->init(); | 		$this->getErrorHandler()->init(); | ||||||
|  |  | ||||||
| 		// Define Permission Levels | 		// Permissions | ||||||
| 		$this->authenticationManager->definePermissionLevel(self::SETTING_PERMISSION_SHUTDOWN, AuthenticationManager::AUTH_LEVEL_SUPERADMIN); | 		$this->getAuthenticationManager()->definePermissionLevel(self::SETTING_PERMISSION_SHUTDOWN, AuthenticationManager::AUTH_LEVEL_SUPERADMIN); | ||||||
| 		$this->authenticationManager->definePermissionLevel(self::SETTING_PERMISSION_RESTART, AuthenticationManager::AUTH_LEVEL_SUPERADMIN); | 		$this->getAuthenticationManager()->definePermissionLevel(self::SETTING_PERMISSION_RESTART, AuthenticationManager::AUTH_LEVEL_SUPERADMIN); | ||||||
|  |  | ||||||
| 		// Register for commands | 		// Commands | ||||||
| 		$this->commandManager->registerCommandListener('version', $this, 'commandVersion', false, 'Shows ManiaControl version.'); | 		$this->getCommandManager()->registerCommandListener('version', $this, 'commandVersion', false, 'Shows ManiaControl version.'); | ||||||
| 		$this->commandManager->registerCommandListener('restart', $this, 'commandRestart', true, 'Restarts ManiaControl.'); | 		$this->getCommandManager()->registerCommandListener('restart', $this, 'commandRestart', true, 'Restarts ManiaControl.'); | ||||||
| 		$this->commandManager->registerCommandListener('shutdown', $this, 'commandShutdown', true, 'Shuts ManiaControl down.'); | 		$this->getCommandManager()->registerCommandListener('shutdown', $this, 'commandShutdown', true, 'Shuts ManiaControl down.'); | ||||||
|  |  | ||||||
| 		// Check connection every 30 seconds | 		// Check connection every 30 seconds | ||||||
| 		$this->timerManager->registerTimerListening($this, 'checkConnection', 1000 * 30); | 		$this->getTimerManager()->registerTimerListening($this, 'checkConnection', 1000 * 30); | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	/** | 	/** | ||||||
| @@ -153,13 +192,14 @@ class ManiaControl implements CallbackListener, CommandListener, TimerListener { | |||||||
| 	private function loadConfig() { | 	private function loadConfig() { | ||||||
| 		$configId       = CommandLineHelper::getParameter('-config'); | 		$configId       = CommandLineHelper::getParameter('-config'); | ||||||
| 		$configFileName = ($configId ? $configId : 'server.xml'); | 		$configFileName = ($configId ? $configId : 'server.xml'); | ||||||
| 		$this->config   = FileUtil::loadConfig($configFileName); | 		$config   = FileUtil::loadConfig($configFileName); | ||||||
| 		if (!$this->config) { | 		if (!$config) { | ||||||
| 			$this->quit("Error loading Configuration XML-File! ('{$configFileName}')", true); | 			$this->quit("Error loading Configuration XML-File! ('{$configFileName}')", true); | ||||||
| 		} | 		} | ||||||
| 		if ($this->config->count() < 3) { | 		if ($config->count() < 3) { | ||||||
| 			$this->quit("Your Configuration File ('{$configFileName}') doesn't seem to be maintained properly. Please check it again!", true); | 			$this->quit("Your Configuration File ('{$configFileName}') doesn't seem to be maintained properly. Please check it again!", true); | ||||||
| 		} | 		} | ||||||
|  | 		$this->config = $config; | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	/** | 	/** | ||||||
| @@ -169,17 +209,206 @@ class ManiaControl implements CallbackListener, CommandListener, TimerListener { | |||||||
| 	 * @param bool   $errorPrefix | 	 * @param bool   $errorPrefix | ||||||
| 	 */ | 	 */ | ||||||
| 	public function quit($message = null, $errorPrefix = false) { | 	public function quit($message = null, $errorPrefix = false) { | ||||||
| 		Connection::delete($this->client); | 		Connection::delete($this->getClient()); | ||||||
| 		$this->client = null; | 		$this->client = null; | ||||||
| 		SystemUtil::quit($message, $errorPrefix); | 		SystemUtil::quit($message, $errorPrefix); | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
|  | 	/** | ||||||
|  | 	 * Return the actions menu | ||||||
|  | 	 * | ||||||
|  | 	 * @return ActionsMenu | ||||||
|  | 	 */ | ||||||
|  | 	public function getActionsMenu() { | ||||||
|  | 		return $this->actionsMenu; | ||||||
|  | 	} | ||||||
|  |  | ||||||
|  | 	/** | ||||||
|  | 	 * Return the authentication manager | ||||||
|  | 	 * | ||||||
|  | 	 * @return AuthenticationManager | ||||||
|  | 	 */ | ||||||
|  | 	public function getAuthenticationManager() { | ||||||
|  | 		return $this->authenticationManager; | ||||||
|  | 	} | ||||||
|  |  | ||||||
|  | 	/** | ||||||
|  | 	 * Return the callback manager | ||||||
|  | 	 * | ||||||
|  | 	 * @return CallbackManager | ||||||
|  | 	 */ | ||||||
|  | 	public function getCallbackManager() { | ||||||
|  | 		return $this->callbackManager; | ||||||
|  | 	} | ||||||
|  |  | ||||||
|  | 	/** | ||||||
|  | 	 * Return the chat | ||||||
|  | 	 * | ||||||
|  | 	 * @return Chat | ||||||
|  | 	 */ | ||||||
|  | 	public function getChat() { | ||||||
|  | 		return $this->chat; | ||||||
|  | 	} | ||||||
|  |  | ||||||
|  | 	/** | ||||||
|  | 	 * Return the config | ||||||
|  | 	 * | ||||||
|  | 	 * @return \SimpleXMLElement | ||||||
|  | 	 */ | ||||||
|  | 	public function getConfig() { | ||||||
|  | 		return $this->config; | ||||||
|  | 	} | ||||||
|  |  | ||||||
|  | 	/** | ||||||
|  | 	 * Return the configurator | ||||||
|  | 	 * | ||||||
|  | 	 * @return Configurator | ||||||
|  | 	 */ | ||||||
|  | 	public function getConfigurator() { | ||||||
|  | 		return $this->configurator; | ||||||
|  | 	} | ||||||
|  |  | ||||||
|  | 	/** | ||||||
|  | 	 * Return the client | ||||||
|  | 	 * | ||||||
|  | 	 * @return Connection | ||||||
|  | 	 */ | ||||||
|  | 	public function getClient() { | ||||||
|  | 		return $this->client; | ||||||
|  | 	} | ||||||
|  |  | ||||||
|  | 	/** | ||||||
|  | 	 * Return the command manager | ||||||
|  | 	 * | ||||||
|  | 	 * @return CommandManager | ||||||
|  | 	 */ | ||||||
|  | 	public function getCommandManager() { | ||||||
|  | 		return $this->commandManager; | ||||||
|  | 	} | ||||||
|  |  | ||||||
|  | 	/** | ||||||
|  | 	 * Return the database | ||||||
|  | 	 * | ||||||
|  | 	 * @return Database | ||||||
|  | 	 */ | ||||||
|  | 	public function getDatabase() { | ||||||
|  | 		return $this->database; | ||||||
|  | 	} | ||||||
|  |  | ||||||
|  | 	/** | ||||||
|  | 	 * Return the manialink manager | ||||||
|  | 	 * | ||||||
|  | 	 * @return ManialinkManager | ||||||
|  | 	 */ | ||||||
|  | 	public function getManialinkManager() { | ||||||
|  | 		return $this->manialinkManager; | ||||||
|  | 	} | ||||||
|  |  | ||||||
|  | 	/** | ||||||
|  | 	 * Return the map manager | ||||||
|  | 	 * | ||||||
|  | 	 * @return MapManager | ||||||
|  | 	 */ | ||||||
|  | 	public function getMapManager() { | ||||||
|  | 		return $this->mapManager; | ||||||
|  | 	} | ||||||
|  |  | ||||||
|  | 	/** | ||||||
|  | 	 * Return the player manager | ||||||
|  | 	 * | ||||||
|  | 	 * @return PlayerManager | ||||||
|  | 	 */ | ||||||
|  | 	public function getPlayerManager() { | ||||||
|  | 		return $this->playerManager; | ||||||
|  | 	} | ||||||
|  |  | ||||||
|  | 	/** | ||||||
|  | 	 * Return the plugin manager | ||||||
|  | 	 * | ||||||
|  | 	 * @return PluginManager | ||||||
|  | 	 */ | ||||||
|  | 	public function getPluginManager() { | ||||||
|  | 		return $this->pluginManager; | ||||||
|  | 	} | ||||||
|  |  | ||||||
|  | 	/** | ||||||
|  | 	 * Return the server | ||||||
|  | 	 * | ||||||
|  | 	 * @return Server | ||||||
|  | 	 */ | ||||||
|  | 	public function getServer() { | ||||||
|  | 		return $this->server; | ||||||
|  | 	} | ||||||
|  |  | ||||||
|  | 	/** | ||||||
|  | 	 * Return the setting manager | ||||||
|  | 	 * | ||||||
|  | 	 * @return SettingManager | ||||||
|  | 	 */ | ||||||
|  | 	public function getSettingManager() { | ||||||
|  | 		return $this->settingManager; | ||||||
|  | 	} | ||||||
|  |  | ||||||
|  | 	/** | ||||||
|  | 	 * Return the statistic manager | ||||||
|  | 	 * | ||||||
|  | 	 * @return StatisticManager | ||||||
|  | 	 */ | ||||||
|  | 	public function getStatisticManager() { | ||||||
|  | 		return $this->statisticManager; | ||||||
|  | 	} | ||||||
|  |  | ||||||
|  | 	/** | ||||||
|  | 	 * Return the update manager | ||||||
|  | 	 * | ||||||
|  | 	 * @return UpdateManager | ||||||
|  | 	 */ | ||||||
|  | 	public function getUpdateManager() { | ||||||
|  | 		return $this->updateManager; | ||||||
|  | 	} | ||||||
|  |  | ||||||
|  | 	/** | ||||||
|  | 	 * Return the error handler | ||||||
|  | 	 * | ||||||
|  | 	 * @return ErrorHandler | ||||||
|  | 	 */ | ||||||
|  | 	public function getErrorHandler() { | ||||||
|  | 		return $this->errorHandler; | ||||||
|  | 	} | ||||||
|  |  | ||||||
|  | 	/** | ||||||
|  | 	 * Return the timer manager | ||||||
|  | 	 * | ||||||
|  | 	 * @return TimerManager | ||||||
|  | 	 */ | ||||||
|  | 	public function getTimerManager() { | ||||||
|  | 		return $this->timerManager; | ||||||
|  | 	} | ||||||
|  |  | ||||||
|  | 	/** | ||||||
|  | 	 * Return the file reader | ||||||
|  | 	 * | ||||||
|  | 	 * @return AsynchronousFileReader | ||||||
|  | 	 */ | ||||||
|  | 	public function getFileReader() { | ||||||
|  | 		return $this->fileReader; | ||||||
|  | 	} | ||||||
|  |  | ||||||
|  | 	/** | ||||||
|  | 	 * Return the bill manager | ||||||
|  | 	 * | ||||||
|  | 	 * @return BillManager | ||||||
|  | 	 */ | ||||||
|  | 	public function getBillManager() { | ||||||
|  | 		return $this->billManager; | ||||||
|  | 	} | ||||||
|  |  | ||||||
| 	/** | 	/** | ||||||
| 	 * Check connection | 	 * Check connection | ||||||
| 	 */ | 	 */ | ||||||
| 	public function checkConnection() { | 	public function checkConnection() { | ||||||
| 		if ($this->client->getIdleTime() > 180) { | 		if ($this->getClient()->getIdleTime() > 180) { | ||||||
| 			$this->client->getServerName(); | 			$this->getClient()->getServerName(); | ||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| @@ -191,7 +420,7 @@ class ManiaControl implements CallbackListener, CommandListener, TimerListener { | |||||||
| 	 */ | 	 */ | ||||||
| 	public function commandVersion(array $chatCallback, Player $player) { | 	public function commandVersion(array $chatCallback, Player $player) { | ||||||
| 		$message = 'This server is using ManiaControl v' . ManiaControl::VERSION . '!'; | 		$message = 'This server is using ManiaControl v' . ManiaControl::VERSION . '!'; | ||||||
| 		$this->chat->sendInformation($message, $player->login); | 		$this->getChat()->sendInformation($message, $player); | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	/** | 	/** | ||||||
| @@ -201,8 +430,8 @@ class ManiaControl implements CallbackListener, CommandListener, TimerListener { | |||||||
| 	 * @param Player $player | 	 * @param Player $player | ||||||
| 	 */ | 	 */ | ||||||
| 	public function commandRestart(array $chatCallback, Player $player) { | 	public function commandRestart(array $chatCallback, Player $player) { | ||||||
| 		if (!$this->authenticationManager->checkPermission($player, self::SETTING_PERMISSION_RESTART)) { | 		if (!$this->getAuthenticationManager()->checkPermission($player, self::SETTING_PERMISSION_RESTART)) { | ||||||
| 			$this->authenticationManager->sendNotAllowed($player); | 			$this->getAuthenticationManager()->sendNotAllowed($player); | ||||||
| 			return; | 			return; | ||||||
| 		} | 		} | ||||||
| 		$this->restart("ManiaControl Restart requested by '{$player->login}'!"); | 		$this->restart("ManiaControl Restart requested by '{$player->login}'!"); | ||||||
| @@ -215,18 +444,18 @@ class ManiaControl implements CallbackListener, CommandListener, TimerListener { | |||||||
| 	 */ | 	 */ | ||||||
| 	public function restart($message = null) { | 	public function restart($message = null) { | ||||||
| 		// Shutdown callback | 		// Shutdown callback | ||||||
| 		$this->callbackManager->triggerCallback(Callbacks::ONSHUTDOWN); | 		$this->getCallbackManager()->triggerCallback(Callbacks::ONSHUTDOWN); | ||||||
|  |  | ||||||
| 		// Announce restart | 		// Announce restart | ||||||
| 		if ($message) { | 		if ($message) { | ||||||
| 			$this->log($message); | 			$this->log($message); | ||||||
| 		} | 		} | ||||||
| 		$this->chat->sendInformation('Restarting ManiaControl...'); | 		$this->getChat()->sendInformation('Restarting ManiaControl...'); | ||||||
| 		$this->log('Restarting ManiaControl!'); | 		$this->log('Restarting ManiaControl!'); | ||||||
|  |  | ||||||
| 		// Hide widgets | 		// Hide widgets | ||||||
| 		if ($this->client) { | 		if ($this->getClient()) { | ||||||
| 			$this->client->sendHideManialinkPage(); | 			$this->getClient()->sendHideManialinkPage(); | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
| 		// Start new instance | 		// Start new instance | ||||||
| @@ -243,8 +472,8 @@ class ManiaControl implements CallbackListener, CommandListener, TimerListener { | |||||||
| 	 * @param Player $player | 	 * @param Player $player | ||||||
| 	 */ | 	 */ | ||||||
| 	public function commandShutdown(array $chat, Player $player) { | 	public function commandShutdown(array $chat, Player $player) { | ||||||
| 		if (!$this->authenticationManager->checkPermission($player, self::SETTING_PERMISSION_SHUTDOWN)) { | 		if (!$this->getAuthenticationManager()->checkPermission($player, self::SETTING_PERMISSION_SHUTDOWN)) { | ||||||
| 			$this->authenticationManager->sendNotAllowed($player); | 			$this->getAuthenticationManager()->sendNotAllowed($player); | ||||||
| 			return; | 			return; | ||||||
| 		} | 		} | ||||||
| 		$this->requestQuit("ManiaControl Shutdown requested by '{$player->login}'!"); | 		$this->requestQuit("ManiaControl Shutdown requested by '{$player->login}'!"); | ||||||
| @@ -273,28 +502,28 @@ class ManiaControl implements CallbackListener, CommandListener, TimerListener { | |||||||
| 		} | 		} | ||||||
|  |  | ||||||
| 		// Check if the version of the server is high enough | 		// Check if the version of the server is high enough | ||||||
| 		$version = $this->client->getVersion(); | 		$version = $this->getClient()->getVersion(); | ||||||
| 		if ($version->build < self::MIN_DEDIVERSION) { | 		if ($version->build < self::MIN_DEDIVERSION) { | ||||||
| 			$this->quit("The Server has Version '{$version->build}', while at least '" . self::MIN_DEDIVERSION . "' is required!", true); | 			$this->quit("The Server has Version '{$version->build}', while at least '" . self::MIN_DEDIVERSION . "' is required!", true); | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
| 		// Listen for shutdown | 		// Listen for shutdown | ||||||
| 		$this->callbackManager->registerCallbackListener(CallbackManager::CB_MP_SERVERSTOP, $this, 'handleServerStopCallback'); | 		$this->getCallbackManager()->registerCallbackListener(CallbackManager::CB_MP_SERVERSTOP, $this, 'handleServerStopCallback'); | ||||||
|  |  | ||||||
| 		// OnInit callback | 		// OnInit callback | ||||||
| 		$this->callbackManager->triggerCallback(Callbacks::ONINIT); | 		$this->getCallbackManager()->triggerCallback(Callbacks::ONINIT); | ||||||
|  |  | ||||||
| 		// Load plugins | 		// Load plugins | ||||||
| 		$this->pluginManager->loadPlugins(); | 		$this->getPluginManager()->loadPlugins(); | ||||||
| 		$this->updateManager->pluginUpdateManager->checkPluginsUpdate(); | 		$this->getUpdateManager()->getPluginUpdateManager()->checkPluginsUpdate(); | ||||||
|  |  | ||||||
| 		// AfterInit callback | 		// AfterInit callback | ||||||
| 		$this->callbackManager->triggerCallback(Callbacks::AFTERINIT); | 		$this->getCallbackManager()->triggerCallback(Callbacks::AFTERINIT); | ||||||
|  |  | ||||||
| 		// Loading finished | 		// Loading finished | ||||||
| 		$this->log('Loading completed!'); | 		$this->log('Loading completed!'); | ||||||
| 		$this->log('Link: maniaplanet://#join=' . $this->server->login . '@' . $this->server->titleId); | 		$this->log('Link: '.$this->getServer()->getJoinLink()); | ||||||
| 		$this->chat->sendInformation('ManiaControl v' . self::VERSION . ' successfully started!'); | 		$this->getChat()->sendInformation('ManiaControl v' . self::VERSION . ' successfully started!'); | ||||||
|  |  | ||||||
| 		// Main loop | 		// Main loop | ||||||
| 		while (!$this->requestQuitMessage) { | 		while (!$this->requestQuitMessage) { | ||||||
| @@ -310,25 +539,25 @@ class ManiaControl implements CallbackListener, CommandListener, TimerListener { | |||||||
| 	 */ | 	 */ | ||||||
| 	private function connect() { | 	private function connect() { | ||||||
| 		// Load remote client | 		// Load remote client | ||||||
| 		$this->server->loadConfig(); | 		$serverConfig = $this->getServer()->loadConfig(); | ||||||
|  |  | ||||||
| 		$this->log("Connecting to Server at {$this->server->config->host}:{$this->server->config->port}..."); | 		$this->log("Connecting to Server at {$serverConfig->host}:{$serverConfig->port}..."); | ||||||
|  |  | ||||||
| 		try { | 		try { | ||||||
| 			$this->client = Connection::factory($this->server->config->host, $this->server->config->port, self::SCRIPT_TIMEOUT, $this->server->config->user, $this->server->config->pass, self::API_VERSION); | 			$this->client = Connection::factory($serverConfig->host, $serverConfig->port, self::SCRIPT_TIMEOUT, $serverConfig->user, $serverConfig->pass, self::API_VERSION); | ||||||
| 		} catch (TransportException $exception) { | 		} catch (TransportException $exception) { | ||||||
| 			$message = "Couldn't connect to the server: '{$exception->getMessage()}'"; | 			$message = "Couldn't connect to the server: '{$exception->getMessage()}'"; | ||||||
| 			$this->quit($message, true); | 			$this->quit($message, true); | ||||||
| 		} catch (AuthenticationException $exception) { | 		} catch (AuthenticationException $exception) { | ||||||
| 			$message = "Couldn't authenticate on Server with User '{$this->server->config->user}' & Pass '{$this->server->config->pass}'! " . $exception->getMessage(); | 			$message = "Couldn't authenticate on Server with User '{$serverConfig->user}' & Pass '{$serverConfig->pass}'! " . $exception->getMessage(); | ||||||
| 			$this->quit($message, true); | 			$this->quit($message, true); | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
| 		// Enable callback system | 		// Enable callback system | ||||||
| 		$this->client->enableCallbacks(true); | 		$this->getClient()->enableCallbacks(true); | ||||||
|  |  | ||||||
| 		// Wait for server to be ready | 		// Wait for server to be ready | ||||||
| 		if (!$this->server->waitForStatus(4)) { | 		if (!$this->getServer()->waitForStatus(4)) { | ||||||
| 			$this->quit("Server couldn't get ready!"); | 			$this->quit("Server couldn't get ready!"); | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
| @@ -336,10 +565,11 @@ class ManiaControl implements CallbackListener, CommandListener, TimerListener { | |||||||
| 		$this->log('Server Connection successfully established!'); | 		$this->log('Server Connection successfully established!'); | ||||||
|  |  | ||||||
| 		// Hide old widgets | 		// Hide old widgets | ||||||
| 		$this->client->sendHideManialinkPage(); | 		$this->getClient()->sendHideManialinkPage(); | ||||||
|  |  | ||||||
| 		// Enable script callbacks | 		// Enable script callbacks | ||||||
| 		$this->server->getScriptManager()->enableScriptCallbacks(); | 		$this->getServer()->getScriptManager() | ||||||
|  | 		             ->enableScriptCallbacks(); | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	/** | 	/** | ||||||
| @@ -352,14 +582,14 @@ class ManiaControl implements CallbackListener, CommandListener, TimerListener { | |||||||
| 		set_time_limit(self::SCRIPT_TIMEOUT); | 		set_time_limit(self::SCRIPT_TIMEOUT); | ||||||
|  |  | ||||||
| 		try { | 		try { | ||||||
| 			$this->callbackManager->manageCallbacks(); | 			$this->getCallbackManager()->manageCallbacks(); | ||||||
| 		} catch (TransportException $e) { | 		} catch (TransportException $e) { | ||||||
| 			$this->log('Connection interrupted!'); | 			$this->log('Connection interrupted!'); | ||||||
| 			$this->quit($e->getMessage(), true); | 			$this->quit($e->getMessage(), true); | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
| 		// Manage FileReader | 		// Manage FileReader | ||||||
| 		$this->fileReader->appendData(); | 		$this->getFileReader()->appendData(); | ||||||
|  |  | ||||||
| 		// Yield for next tick | 		// Yield for next tick | ||||||
| 		$loopEnd      = microtime(true); | 		$loopEnd      = microtime(true); | ||||||
|   | |||||||
| @@ -50,20 +50,20 @@ class ManiaExchangeList implements CallbackListener, ManialinkPageAnswerListener | |||||||
| 	private $mapListShown = array(); | 	private $mapListShown = array(); | ||||||
|  |  | ||||||
| 	/** | 	/** | ||||||
| 	 * Create a new MapList Instance | 	 * Construct a new MX List instance | ||||||
| 	 * | 	 * | ||||||
| 	 * @param ManiaControl $maniaControl | 	 * @param ManiaControl $maniaControl | ||||||
| 	 */ | 	 */ | ||||||
| 	public function __construct(ManiaControl $maniaControl) { | 	public function __construct(ManiaControl $maniaControl) { | ||||||
| 		$this->maniaControl = $maniaControl; | 		$this->maniaControl = $maniaControl; | ||||||
|  |  | ||||||
| 		// Register for Callbacks | 		// Callbacks | ||||||
| 		$this->maniaControl->callbackManager->registerCallbackListener(ManialinkManager::CB_MAIN_WINDOW_CLOSED, $this, 'closeWidget'); | 		$this->maniaControl->getCallbackManager()->registerCallbackListener(ManialinkManager::CB_MAIN_WINDOW_CLOSED, $this, 'closeWidget'); | ||||||
| 		$this->maniaControl->callbackManager->registerCallbackListener(ManialinkManager::CB_MAIN_WINDOW_OPENED, $this, 'handleWidgetOpened'); | 		$this->maniaControl->getCallbackManager()->registerCallbackListener(ManialinkManager::CB_MAIN_WINDOW_OPENED, $this, 'handleWidgetOpened'); | ||||||
| 		$this->maniaControl->callbackManager->registerCallbackListener(CallbackManager::CB_MP_PLAYERMANIALINKPAGEANSWER, $this, 'handleManialinkPageAnswer'); | 		$this->maniaControl->getCallbackManager()->registerCallbackListener(CallbackManager::CB_MP_PLAYERMANIALINKPAGEANSWER, $this, 'handleManialinkPageAnswer'); | ||||||
|  |  | ||||||
| 		$this->maniaControl->manialinkManager->registerManialinkPageAnswerListener(self::ACTION_SEARCH_MAPNAME, $this, 'showList'); | 		$this->maniaControl->getManialinkManager()->registerManialinkPageAnswerListener(self::ACTION_SEARCH_MAPNAME, $this, 'showList'); | ||||||
| 		$this->maniaControl->manialinkManager->registerManialinkPageAnswerListener(self::ACTION_SEARCH_AUTHOR, $this, 'showList'); | 		$this->maniaControl->getManialinkManager()->registerManialinkPageAnswerListener(self::ACTION_SEARCH_AUTHOR, $this, 'showList'); | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	/** | 	/** | ||||||
| @@ -80,7 +80,7 @@ class ManiaExchangeList implements CallbackListener, ManialinkPageAnswerListener | |||||||
|  |  | ||||||
| 		$action = $actionArray[0] . '.' . $actionArray[1]; | 		$action = $actionArray[0] . '.' . $actionArray[1]; | ||||||
| 		$login  = $callback[1][1]; | 		$login  = $callback[1][1]; | ||||||
| 		$player = $this->maniaControl->playerManager->getPlayer($login); | 		$player = $this->maniaControl->getPlayerManager()->getPlayer($login); | ||||||
| 		$mapId  = (int)$actionArray[2]; | 		$mapId  = (int)$actionArray[2]; | ||||||
|  |  | ||||||
| 		switch ($action) { | 		switch ($action) { | ||||||
| @@ -89,7 +89,7 @@ class ManiaExchangeList implements CallbackListener, ManialinkPageAnswerListener | |||||||
| 				$this->showList($callback, $player); | 				$this->showList($callback, $player); | ||||||
| 				break; | 				break; | ||||||
| 			case self::ACTION_ADD_MAP: | 			case self::ACTION_ADD_MAP: | ||||||
| 				$this->maniaControl->mapManager->addMapFromMx($mapId, $player->login); | 				$this->maniaControl->getMapManager()->addMapFromMx($mapId, $player->login); | ||||||
| 				break; | 				break; | ||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
| @@ -131,9 +131,9 @@ class ManiaExchangeList implements CallbackListener, ManialinkPageAnswerListener | |||||||
| 		} | 		} | ||||||
|  |  | ||||||
| 		// search for matching maps | 		// search for matching maps | ||||||
| 		$this->maniaControl->mapManager->getMXManager()->fetchMapsAsync(function (array $maps) use (&$player) { | 		$this->maniaControl->getMapManager()->getMXManager()->fetchMapsAsync(function (array $maps) use (&$player) { | ||||||
| 			if (!$maps) { | 			if (!$maps) { | ||||||
| 				$this->maniaControl->chat->sendError('No maps found, or MX is down!', $player->login); | 				$this->maniaControl->getChat()->sendError('No maps found, or MX is down!', $player->login); | ||||||
| 				return; | 				return; | ||||||
| 			} | 			} | ||||||
| 			$this->showManiaExchangeList($maps, $player); | 			$this->showManiaExchangeList($maps, $player); | ||||||
| @@ -149,8 +149,8 @@ class ManiaExchangeList implements CallbackListener, ManialinkPageAnswerListener | |||||||
| 	 */ | 	 */ | ||||||
| 	private function showManiaExchangeList(array $maps, Player $player) { | 	private function showManiaExchangeList(array $maps, Player $player) { | ||||||
| 		// Start offsets | 		// Start offsets | ||||||
| 		$width  = $this->maniaControl->manialinkManager->getStyleManager()->getListWidgetsWidth(); | 		$width  = $this->maniaControl->getManialinkManager()->getStyleManager()->getListWidgetsWidth(); | ||||||
| 		$height = $this->maniaControl->manialinkManager->getStyleManager()->getListWidgetsHeight(); | 		$height = $this->maniaControl->getManialinkManager()->getStyleManager()->getListWidgetsHeight(); | ||||||
| 		$posX   = -$width / 2; | 		$posX   = -$width / 2; | ||||||
| 		$posY   = $height / 2; | 		$posY   = $height / 2; | ||||||
|  |  | ||||||
| @@ -161,11 +161,11 @@ class ManiaExchangeList implements CallbackListener, ManialinkPageAnswerListener | |||||||
| 		$script->addFeature($paging); | 		$script->addFeature($paging); | ||||||
|  |  | ||||||
| 		// Main frame | 		// Main frame | ||||||
| 		$frame = $this->maniaControl->manialinkManager->getStyleManager()->getDefaultListFrame($script, $paging); | 		$frame = $this->maniaControl->getManialinkManager()->getStyleManager()->getDefaultListFrame($script, $paging); | ||||||
| 		$maniaLink->add($frame); | 		$maniaLink->add($frame); | ||||||
|  |  | ||||||
| 		//Predefine description Label | 		//Predefine description Label | ||||||
| 		$descriptionLabel = $this->maniaControl->manialinkManager->getStyleManager()->getDefaultDescriptionLabel(); | 		$descriptionLabel = $this->maniaControl->getManialinkManager()->getStyleManager()->getDefaultDescriptionLabel(); | ||||||
| 		$frame->add($descriptionLabel); | 		$frame->add($descriptionLabel); | ||||||
|  |  | ||||||
| 		// Headline | 		// Headline | ||||||
| @@ -173,7 +173,7 @@ class ManiaExchangeList implements CallbackListener, ManialinkPageAnswerListener | |||||||
| 		$frame->add($headFrame); | 		$frame->add($headFrame); | ||||||
| 		$headFrame->setY($posY - 12); | 		$headFrame->setY($posY - 12); | ||||||
| 		$array = array('$oId' => $posX + 3.5, '$oName' => $posX + 12.5, '$oAuthor' => $posX + 59, '$oKarma' => $posX + 85, '$oType' => $posX + 103, '$oMood' => $posX + 118, '$oLast Update' => $posX + 130); | 		$array = array('$oId' => $posX + 3.5, '$oName' => $posX + 12.5, '$oAuthor' => $posX + 59, '$oKarma' => $posX + 85, '$oType' => $posX + 103, '$oMood' => $posX + 118, '$oLast Update' => $posX + 130); | ||||||
| 		$this->maniaControl->manialinkManager->labelLine($headFrame, $array); | 		$this->maniaControl->getManialinkManager()->labelLine($headFrame, $array); | ||||||
|  |  | ||||||
| 		$index     = 0; | 		$index     = 0; | ||||||
| 		$posY      = $height / 2 - 16; | 		$posY      = $height / 2 - 16; | ||||||
| @@ -202,7 +202,7 @@ class ManiaExchangeList implements CallbackListener, ManialinkPageAnswerListener | |||||||
|  |  | ||||||
| 			$time        = Formatter::time_elapsed_string(strtotime($map->updated)); | 			$time        = Formatter::time_elapsed_string(strtotime($map->updated)); | ||||||
| 			$array       = array('$s' . $map->id => $posX + 3.5, '$s' . $map->name => $posX + 12.5, '$s' . $map->author => $posX + 59, '$s' . str_replace('Arena', '', $map->maptype) => $posX + 103, '$s' . $map->mood => $posX + 118, '$s' . $time => $posX + 130); | 			$array       = array('$s' . $map->id => $posX + 3.5, '$s' . $map->name => $posX + 12.5, '$s' . $map->author => $posX + 59, '$s' . str_replace('Arena', '', $map->maptype) => $posX + 103, '$s' . $map->mood => $posX + 118, '$s' . $time => $posX + 130); | ||||||
| 			$labels      = $this->maniaControl->manialinkManager->labelLine($mapFrame, $array); | 			$labels      = $this->maniaControl->getManialinkManager()->labelLine($mapFrame, $array); | ||||||
| 			$authorLabel = $labels[2]; | 			$authorLabel = $labels[2]; | ||||||
| 			$authorLabel->setAction(self::ACTION_GET_MAPS_FROM_AUTHOR . '.' . $map->author); | 			$authorLabel->setAction(self::ACTION_GET_MAPS_FROM_AUTHOR . '.' . $map->author); | ||||||
|  |  | ||||||
| @@ -211,15 +211,15 @@ class ManiaExchangeList implements CallbackListener, ManialinkPageAnswerListener | |||||||
| 			$mxQuad = new Quad(); | 			$mxQuad = new Quad(); | ||||||
| 			$mapFrame->add($mxQuad); | 			$mapFrame->add($mxQuad); | ||||||
| 			$mxQuad->setSize(3, 3); | 			$mxQuad->setSize(3, 3); | ||||||
| 			$mxQuad->setImage($this->maniaControl->manialinkManager->getIconManager()->getIcon(IconManager::MX_ICON)); | 			$mxQuad->setImage($this->maniaControl->getManialinkManager()->getIconManager()->getIcon(IconManager::MX_ICON)); | ||||||
| 			$mxQuad->setImageFocus($this->maniaControl->manialinkManager->getIconManager()->getIcon(IconManager::MX_ICON_MOVER)); | 			$mxQuad->setImageFocus($this->maniaControl->getManialinkManager()->getIconManager()->getIcon(IconManager::MX_ICON_MOVER)); | ||||||
| 			$mxQuad->setX($posX + 56); | 			$mxQuad->setX($posX + 56); | ||||||
| 			$mxQuad->setUrl($map->pageurl); | 			$mxQuad->setUrl($map->pageurl); | ||||||
| 			$mxQuad->setZ(0.01); | 			$mxQuad->setZ(0.01); | ||||||
| 			$description = 'View $<' . $map->name . '$> on Mania-Exchange'; | 			$description = 'View $<' . $map->name . '$> on Mania-Exchange'; | ||||||
| 			$mxQuad->addTooltipLabelFeature($descriptionLabel, $description); | 			$mxQuad->addTooltipLabelFeature($descriptionLabel, $description); | ||||||
|  |  | ||||||
| 			if ($this->maniaControl->authenticationManager->checkPermission($player, MapManager::SETTING_PERMISSION_ADD_MAP)) { | 			if ($this->maniaControl->getAuthenticationManager()->checkPermission($player, MapManager::SETTING_PERMISSION_ADD_MAP)) { | ||||||
| 				$addQuad = new Quad_Icons64x64_1(); | 				$addQuad = new Quad_Icons64x64_1(); | ||||||
| 				$mapFrame->add($addQuad); | 				$mapFrame->add($addQuad); | ||||||
| 				$addQuad->setX($posX + 53); | 				$addQuad->setX($posX + 53); | ||||||
| @@ -326,7 +326,7 @@ class ManiaExchangeList implements CallbackListener, ManialinkPageAnswerListener | |||||||
| 		$quad->setAction(self::ACTION_SEARCH_AUTHOR); | 		$quad->setAction(self::ACTION_SEARCH_AUTHOR); | ||||||
|  |  | ||||||
| 		// render and display xml | 		// render and display xml | ||||||
| 		$this->maniaControl->manialinkManager->displayWidget($maniaLink, $player, 'ManiaExchangeList'); | 		$this->maniaControl->getManialinkManager()->displayWidget($maniaLink, $player, 'ManiaExchangeList'); | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	/** | 	/** | ||||||
|   | |||||||
| @@ -81,10 +81,10 @@ class ManiaExchangeManager { | |||||||
| 			$maps = array($maps); | 			$maps = array($maps); | ||||||
| 		} else { | 		} else { | ||||||
| 			// Fetch Information for whole MapList | 			// Fetch Information for whole MapList | ||||||
| 			$maps = $this->maniaControl->mapManager->getMaps(); | 			$maps = $this->maniaControl->getMapManager()->getMaps(); | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
| 		$mysqli      = $this->maniaControl->database->mysqli; | 		$mysqli      = $this->maniaControl->getDatabase()->getMysqli(); | ||||||
| 		$mapIdString = ''; | 		$mapIdString = ''; | ||||||
|  |  | ||||||
| 		// Fetch mx ids | 		// Fetch mx ids | ||||||
| @@ -100,7 +100,7 @@ class ManiaExchangeManager { | |||||||
| 		foreach ($maps as $map) { | 		foreach ($maps as $map) { | ||||||
| 			if (!$map) { | 			if (!$map) { | ||||||
| 				// TODO: remove after resolving of error report about "non-object" | 				// TODO: remove after resolving of error report about "non-object" | ||||||
| 				$this->maniaControl->errorHandler->triggerDebugNotice('Non-Object-Map', $map, $maps); | 				$this->maniaControl->getErrorHandler()->triggerDebugNotice('Non-Object-Map', $map, $maps); | ||||||
| 				continue; | 				continue; | ||||||
| 			} | 			} | ||||||
| 			/** @var Map $map */ | 			/** @var Map $map */ | ||||||
| @@ -153,13 +153,13 @@ class ManiaExchangeManager { | |||||||
| 	 */ | 	 */ | ||||||
| 	public function fetchMaplistByMixedUidIdString($string) { | 	public function fetchMaplistByMixedUidIdString($string) { | ||||||
| 		// Get Title Prefix | 		// Get Title Prefix | ||||||
| 		$titlePrefix = $this->maniaControl->mapManager->getCurrentMap() | 		$titlePrefix = $this->maniaControl->getMapManager()->getCurrentMap() | ||||||
| 		                                              ->getGame(); | 		                                              ->getGame(); | ||||||
|  |  | ||||||
| 		// compile search URL | 		// compile search URL | ||||||
| 		$url = "http://api.mania-exchange.com/{$titlePrefix}/maps/?ids={$string}"; | 		$url = "http://api.mania-exchange.com/{$titlePrefix}/maps/?ids={$string}"; | ||||||
|  |  | ||||||
| 		$this->maniaControl->fileReader->loadFile($url, function ($mapInfo, $error) use ($titlePrefix, $url) { | 		$this->maniaControl->getFileReader()->loadFile($url, function ($mapInfo, $error) use ($titlePrefix, $url) { | ||||||
| 			if ($error) { | 			if ($error) { | ||||||
| 				trigger_error("Error: '{$error}' for Url '{$url}'"); | 				trigger_error("Error: '{$error}' for Url '{$url}'"); | ||||||
| 				return; | 				return; | ||||||
| @@ -194,7 +194,7 @@ class ManiaExchangeManager { | |||||||
| 	 * @param array $mxMapInfos | 	 * @param array $mxMapInfos | ||||||
| 	 */ | 	 */ | ||||||
| 	public function updateMapObjectsWithManiaExchangeIds(array $mxMapInfos) { | 	public function updateMapObjectsWithManiaExchangeIds(array $mxMapInfos) { | ||||||
| 		$mysqli = $this->maniaControl->database->mysqli; | 		$mysqli = $this->maniaControl->getDatabase()->getMysqli(); | ||||||
| 		// Save map data | 		// Save map data | ||||||
| 		$saveMapQuery     = "UPDATE `" . MapManager::TABLE_MAPS . "` | 		$saveMapQuery     = "UPDATE `" . MapManager::TABLE_MAPS . "` | ||||||
| 				SET `mxid` = ? | 				SET `mxid` = ? | ||||||
| @@ -220,7 +220,7 @@ class ManiaExchangeManager { | |||||||
| 			} else { | 			} else { | ||||||
| 				$uid = $mxMapInfo->uid; | 				$uid = $mxMapInfo->uid; | ||||||
| 			} | 			} | ||||||
| 			$map = $this->maniaControl->mapManager->getMapByUid($uid); | 			$map = $this->maniaControl->getMapManager()->getMapByUid($uid); | ||||||
| 			if ($map) { | 			if ($map) { | ||||||
| 				// TODO: how does it come that $map can be empty here? we got an error report for that | 				// TODO: how does it come that $map can be empty here? we got an error report for that | ||||||
| 				/** @var Map $map */ | 				/** @var Map $map */ | ||||||
| @@ -247,13 +247,13 @@ class ManiaExchangeManager { | |||||||
| 	 */ | 	 */ | ||||||
| 	public function fetchMapInfo($mapId, callable $function) { | 	public function fetchMapInfo($mapId, callable $function) { | ||||||
| 		// Get Title Prefix | 		// Get Title Prefix | ||||||
| 		$titlePrefix = $this->maniaControl->mapManager->getCurrentMap() | 		$titlePrefix = $this->maniaControl->getMapManager()->getCurrentMap() | ||||||
| 		                                              ->getGame(); | 		                                              ->getGame(); | ||||||
|  |  | ||||||
| 		// compile search URL | 		// compile search URL | ||||||
| 		$url = 'http://api.mania-exchange.com/' . $titlePrefix . '/maps/?ids=' . $mapId; | 		$url = 'http://api.mania-exchange.com/' . $titlePrefix . '/maps/?ids=' . $mapId; | ||||||
|  |  | ||||||
| 		$this->maniaControl->fileReader->loadFile($url, function ($mapInfo, $error) use (&$function, $titlePrefix, $url) { | 		$this->maniaControl->getFileReader()->loadFile($url, function ($mapInfo, $error) use (&$function, $titlePrefix, $url) { | ||||||
| 			$mxMapInfo = null; | 			$mxMapInfo = null; | ||||||
| 			if ($error) { | 			if ($error) { | ||||||
| 				trigger_error($error); | 				trigger_error($error); | ||||||
| @@ -294,8 +294,8 @@ class ManiaExchangeManager { | |||||||
| 		// TODO: remove $env because it's not really used? | 		// TODO: remove $env because it's not really used? | ||||||
|  |  | ||||||
| 		// Get Title Id | 		// Get Title Id | ||||||
| 		$titleId     = $this->maniaControl->server->titleId; | 		$titleId     = $this->maniaControl->getServer()->titleId; | ||||||
| 		$titlePrefix = $this->maniaControl->mapManager->getCurrentMap() | 		$titlePrefix = $this->maniaControl->getMapManager()->getCurrentMap() | ||||||
| 		                                              ->getGame(); | 		                                              ->getGame(); | ||||||
|  |  | ||||||
| 		// compile search URL | 		// compile search URL | ||||||
| @@ -322,13 +322,13 @@ class ManiaExchangeManager { | |||||||
|  |  | ||||||
| 		// Get MapTypes | 		// Get MapTypes | ||||||
| 		try { | 		try { | ||||||
| 			$scriptInfos = $this->maniaControl->client->getModeScriptInfo(); | 			$scriptInfos = $this->maniaControl->getClient()->getModeScriptInfo(); | ||||||
| 			$mapTypes    = $scriptInfos->compatibleMapTypes; | 			$mapTypes    = $scriptInfos->compatibleMapTypes; | ||||||
| 			$url .= '&mtype=' . $mapTypes; | 			$url .= '&mtype=' . $mapTypes; | ||||||
| 		} catch (GameModeException $e) { | 		} catch (GameModeException $e) { | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
| 		$this->maniaControl->fileReader->loadFile($url, function ($mapInfo, $error) use (&$function, $titlePrefix) { | 		$this->maniaControl->getFileReader()->loadFile($url, function ($mapInfo, $error) use (&$function, $titlePrefix) { | ||||||
| 			if ($error) { | 			if ($error) { | ||||||
| 				trigger_error($error); | 				trigger_error($error); | ||||||
| 				return; | 				return; | ||||||
|   | |||||||
| @@ -40,9 +40,9 @@ class CustomUIManager implements CallbackListener, TimerListener { | |||||||
| 		$this->maniaControl = $maniaControl; | 		$this->maniaControl = $maniaControl; | ||||||
| 		$this->prepareManialink(); | 		$this->prepareManialink(); | ||||||
|  |  | ||||||
| 		// Register for callbacks | 		// Callbacks | ||||||
| 		$this->maniaControl->timerManager->registerTimerListening($this, 'handle1Second', 1000); | 		$this->maniaControl->getCallbackManager()->registerCallbackListener(PlayerManager::CB_PLAYERCONNECT, $this, 'handlePlayerJoined'); | ||||||
| 		$this->maniaControl->callbackManager->registerCallbackListener(PlayerManager::CB_PLAYERCONNECT, $this, 'handlePlayerJoined'); | 		$this->maniaControl->getTimerManager()->registerTimerListening($this, 'handle1Second', 1000); | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	/** | 	/** | ||||||
| @@ -70,10 +70,10 @@ class CustomUIManager implements CallbackListener, TimerListener { | |||||||
| 	 */ | 	 */ | ||||||
| 	public function updateManialink(Player $player = null) { | 	public function updateManialink(Player $player = null) { | ||||||
| 		if ($player) { | 		if ($player) { | ||||||
| 			$this->maniaControl->manialinkManager->sendManialink($this->customUI, $player); | 			$this->maniaControl->getManialinkManager()->sendManialink($this->customUI, $player); | ||||||
| 			return; | 			return; | ||||||
| 		} | 		} | ||||||
| 		$this->maniaControl->manialinkManager->sendManialink($this->customUI); | 		$this->maniaControl->getManialinkManager()->sendManialink($this->customUI); | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	/** | 	/** | ||||||
| @@ -86,7 +86,7 @@ class CustomUIManager implements CallbackListener, TimerListener { | |||||||
|  |  | ||||||
| 		//TODO: validate necessity | 		//TODO: validate necessity | ||||||
| 		//send it again after 500ms | 		//send it again after 500ms | ||||||
| 		$this->maniaControl->timerManager->registerOneTimeListening($this, function () use (&$player) { | 		$this->maniaControl->getTimerManager()->registerOneTimeListening($this, function () use (&$player) { | ||||||
| 			$this->updateManialink($player); | 			$this->updateManialink($player); | ||||||
| 		}, 500); | 		}, 500); | ||||||
| 	} | 	} | ||||||
|   | |||||||
| @@ -50,9 +50,9 @@ class IconManager implements CallbackListener { | |||||||
| 		$this->maniaControl = $maniaControl; | 		$this->maniaControl = $maniaControl; | ||||||
| 		$this->addDefaultIcons(); | 		$this->addDefaultIcons(); | ||||||
|  |  | ||||||
| 		// Register for callbacks | 		// Callbacks | ||||||
| 		$this->maniaControl->callbackManager->registerCallbackListener(Callbacks::AFTERINIT, $this, 'handleAfterInit'); | 		$this->maniaControl->getCallbackManager()->registerCallbackListener(Callbacks::AFTERINIT, $this, 'handleAfterInit'); | ||||||
| 		$this->maniaControl->callbackManager->registerCallbackListener(PlayerManager::CB_PLAYERCONNECT, $this, 'handlePlayerConnect'); | 		$this->maniaControl->getCallbackManager()->registerCallbackListener(PlayerManager::CB_PLAYERCONNECT, $this, 'handlePlayerConnect'); | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	/** | 	/** | ||||||
| @@ -114,7 +114,7 @@ class IconManager implements CallbackListener { | |||||||
| 		} | 		} | ||||||
|  |  | ||||||
| 		// Send manialink | 		// Send manialink | ||||||
| 		$this->maniaControl->manialinkManager->sendManialink($maniaLink, $player); | 		$this->maniaControl->getManialinkManager()->sendManialink($maniaLink, $player); | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	/** | 	/** | ||||||
|   | |||||||
| @@ -66,7 +66,7 @@ class ManialinkManager implements ManialinkPageAnswerListener, CallbackListener | |||||||
|  |  | ||||||
| 		// Callbacks | 		// Callbacks | ||||||
| 		$this->registerManialinkPageAnswerListener(self::ACTION_CLOSEWIDGET, $this, 'closeWidgetCallback'); | 		$this->registerManialinkPageAnswerListener(self::ACTION_CLOSEWIDGET, $this, 'closeWidgetCallback'); | ||||||
| 		$this->maniaControl->callbackManager->registerCallbackListener(CallbackManager::CB_MP_PLAYERMANIALINKPAGEANSWER, $this, 'handleManialinkPageAnswer'); | 		$this->maniaControl->getCallbackManager()->registerCallbackListener(CallbackManager::CB_MP_PLAYERMANIALINKPAGEANSWER, $this, 'handleManialinkPageAnswer'); | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	/** | 	/** | ||||||
| @@ -175,7 +175,7 @@ class ManialinkManager implements ManialinkPageAnswerListener, CallbackListener | |||||||
| 	public function handleManialinkPageAnswer(array $callback) { | 	public function handleManialinkPageAnswer(array $callback) { | ||||||
| 		$actionId = $callback[1][2]; | 		$actionId = $callback[1][2]; | ||||||
| 		$login    = $callback[1][1]; | 		$login    = $callback[1][1]; | ||||||
| 		$player   = $this->maniaControl->playerManager->getPlayer($login); | 		$player   = $this->maniaControl->getPlayerManager()->getPlayer($login); | ||||||
|  |  | ||||||
| 		if (array_key_exists($actionId, $this->pageAnswerListeners) && is_array($this->pageAnswerListeners[$actionId])) { | 		if (array_key_exists($actionId, $this->pageAnswerListeners) && is_array($this->pageAnswerListeners[$actionId])) { | ||||||
| 			// Inform page answer listeners | 			// Inform page answer listeners | ||||||
| @@ -210,8 +210,8 @@ class ManialinkManager implements ManialinkPageAnswerListener, CallbackListener | |||||||
| 			// TODO make check by manialinkId, getter is needed to avoid uses on non main widgets | 			// TODO make check by manialinkId, getter is needed to avoid uses on non main widgets | ||||||
| 			$this->disableAltMenu($player); | 			$this->disableAltMenu($player); | ||||||
| 			// Trigger callback | 			// Trigger callback | ||||||
| 			$player = $this->maniaControl->playerManager->getPlayer($player); | 			$player = $this->maniaControl->getPlayerManager()->getPlayer($player); | ||||||
| 			$this->maniaControl->callbackManager->triggerCallback(self::CB_MAIN_WINDOW_OPENED, $player, $widgetName); | 			$this->maniaControl->getCallbackManager()->triggerCallback(self::CB_MAIN_WINDOW_OPENED, $player, $widgetName); | ||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| @@ -233,14 +233,14 @@ class ManialinkManager implements ManialinkPageAnswerListener, CallbackListener | |||||||
|  |  | ||||||
| 		try { | 		try { | ||||||
| 			if (!$logins) { | 			if (!$logins) { | ||||||
| 				return $this->maniaControl->client->sendDisplayManialinkPage(null, $manialinkText, $timeout, $hideOnClick); | 				return $this->maniaControl->getClient()->sendDisplayManialinkPage(null, $manialinkText, $timeout, $hideOnClick); | ||||||
| 			} | 			} | ||||||
| 			if (is_string($logins)) { | 			if (is_string($logins)) { | ||||||
| 				$success = $this->maniaControl->client->sendDisplayManialinkPage($logins, $manialinkText, $timeout, $hideOnClick); | 				$success = $this->maniaControl->getClient()->sendDisplayManialinkPage($logins, $manialinkText, $timeout, $hideOnClick); | ||||||
| 				return $success; | 				return $success; | ||||||
| 			} | 			} | ||||||
| 			if ($logins instanceof Player) { | 			if ($logins instanceof Player) { | ||||||
| 				$success = $this->maniaControl->client->sendDisplayManialinkPage($logins->login, $manialinkText, $timeout, $hideOnClick); | 				$success = $this->maniaControl->getClient()->sendDisplayManialinkPage($logins->login, $manialinkText, $timeout, $hideOnClick); | ||||||
| 				return $success; | 				return $success; | ||||||
| 			} | 			} | ||||||
| 			if (is_array($logins)) { | 			if (is_array($logins)) { | ||||||
| @@ -269,7 +269,7 @@ class ManialinkManager implements ManialinkPageAnswerListener, CallbackListener | |||||||
| 	public function disableAltMenu($player) { | 	public function disableAltMenu($player) { | ||||||
| 		$login = Player::parseLogin($player); | 		$login = Player::parseLogin($player); | ||||||
| 		try { | 		try { | ||||||
| 			$success = $this->maniaControl->client->triggerModeScriptEvent('LibXmlRpc_DisableAltMenu', $login); | 			$success = $this->maniaControl->getClient()->triggerModeScriptEvent('LibXmlRpc_DisableAltMenu', $login); | ||||||
| 		} catch (GameModeException $e) { | 		} catch (GameModeException $e) { | ||||||
| 			return false; | 			return false; | ||||||
| 		} | 		} | ||||||
| @@ -298,8 +298,8 @@ class ManialinkManager implements ManialinkPageAnswerListener, CallbackListener | |||||||
| 			$this->enableAltMenu($player); | 			$this->enableAltMenu($player); | ||||||
|  |  | ||||||
| 			// Trigger callback | 			// Trigger callback | ||||||
| 			$player = $this->maniaControl->playerManager->getPlayer($player); | 			$player = $this->maniaControl->getPlayerManager()->getPlayer($player); | ||||||
| 			$this->maniaControl->callbackManager->triggerCallback(self::CB_MAIN_WINDOW_CLOSED, $player); | 			$this->maniaControl->getCallbackManager()->triggerCallback(self::CB_MAIN_WINDOW_CLOSED, $player); | ||||||
| 		} else { | 		} else { | ||||||
| 			$this->hideManialink($widgetId, $player); | 			$this->hideManialink($widgetId, $player); | ||||||
| 		} | 		} | ||||||
| @@ -331,7 +331,7 @@ class ManialinkManager implements ManialinkPageAnswerListener, CallbackListener | |||||||
| 	public function enableAltMenu($player) { | 	public function enableAltMenu($player) { | ||||||
| 		$login = Player::parseLogin($player); | 		$login = Player::parseLogin($player); | ||||||
| 		try { | 		try { | ||||||
| 			$success = $this->maniaControl->client->triggerModeScriptEvent('LibXmlRpc_EnableAltMenu', $login); | 			$success = $this->maniaControl->getClient()->triggerModeScriptEvent('LibXmlRpc_EnableAltMenu', $login); | ||||||
| 		} catch (GameModeException $e) { | 		} catch (GameModeException $e) { | ||||||
| 			return false; | 			return false; | ||||||
| 		} | 		} | ||||||
|   | |||||||
| @@ -49,17 +49,17 @@ class StyleManager { | |||||||
| 	public function __construct(ManiaControl $maniaControl) { | 	public function __construct(ManiaControl $maniaControl) { | ||||||
| 		$this->maniaControl = $maniaControl; | 		$this->maniaControl = $maniaControl; | ||||||
|  |  | ||||||
| 		// Init settings | 		// Settings | ||||||
| 		$this->maniaControl->settingManager->initSetting($this, self::SETTING_LABEL_DEFAULT_STYLE, Label_Text::STYLE_TextTitle1); | 		$this->maniaControl->getSettingManager()->initSetting($this, self::SETTING_LABEL_DEFAULT_STYLE, Label_Text::STYLE_TextTitle1); | ||||||
| 		$this->maniaControl->settingManager->initSetting($this, self::SETTING_QUAD_DEFAULT_STYLE, Quad_Bgs1InRace::STYLE); | 		$this->maniaControl->getSettingManager()->initSetting($this, self::SETTING_QUAD_DEFAULT_STYLE, Quad_Bgs1InRace::STYLE); | ||||||
| 		$this->maniaControl->settingManager->initSetting($this, self::SETTING_QUAD_DEFAULT_SUBSTYLE, Quad_Bgs1InRace::SUBSTYLE_BgTitleShadow); | 		$this->maniaControl->getSettingManager()->initSetting($this, self::SETTING_QUAD_DEFAULT_SUBSTYLE, Quad_Bgs1InRace::SUBSTYLE_BgTitleShadow); | ||||||
|  |  | ||||||
| 		// Main Widget | 		// Main Widget | ||||||
| 		$this->maniaControl->settingManager->initSetting($this, self::SETTING_MAIN_WIDGET_DEFAULT_STYLE, Quad_BgRaceScore2::STYLE); | 		$this->maniaControl->getSettingManager()->initSetting($this, self::SETTING_MAIN_WIDGET_DEFAULT_STYLE, Quad_BgRaceScore2::STYLE); | ||||||
| 		$this->maniaControl->settingManager->initSetting($this, self::SETTING_MAIN_WIDGET_DEFAULT_SUBSTYLE, Quad_BgRaceScore2::SUBSTYLE_HandleSelectable); | 		$this->maniaControl->getSettingManager()->initSetting($this, self::SETTING_MAIN_WIDGET_DEFAULT_SUBSTYLE, Quad_BgRaceScore2::SUBSTYLE_HandleSelectable); | ||||||
| 		$this->maniaControl->settingManager->initSetting($this, self::SETTING_LIST_WIDGETS_WIDTH, 150.); | 		$this->maniaControl->getSettingManager()->initSetting($this, self::SETTING_LIST_WIDGETS_WIDTH, 150.); | ||||||
| 		$this->maniaControl->settingManager->initSetting($this, self::SETTING_LIST_WIDGETS_HEIGHT, 80.); | 		$this->maniaControl->getSettingManager()->initSetting($this, self::SETTING_LIST_WIDGETS_HEIGHT, 80.); | ||||||
| 		$this->maniaControl->settingManager->initSetting($this, self::SETTING_ICON_DEFAULT_OFFSET_SM, 20.); | 		$this->maniaControl->getSettingManager()->initSetting($this, self::SETTING_ICON_DEFAULT_OFFSET_SM, 20.); | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	/** | 	/** | ||||||
| @@ -68,7 +68,7 @@ class StyleManager { | |||||||
| 	 * @return float | 	 * @return float | ||||||
| 	 */ | 	 */ | ||||||
| 	public function getDefaultIconOffsetSM() { | 	public function getDefaultIconOffsetSM() { | ||||||
| 		return $this->maniaControl->settingManager->getSettingValue($this, self::SETTING_ICON_DEFAULT_OFFSET_SM); | 		return $this->maniaControl->getSettingManager()->getSettingValue($this, self::SETTING_ICON_DEFAULT_OFFSET_SM); | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	/** | 	/** | ||||||
| @@ -77,7 +77,7 @@ class StyleManager { | |||||||
| 	 * @return string | 	 * @return string | ||||||
| 	 */ | 	 */ | ||||||
| 	public function getDefaultLabelStyle() { | 	public function getDefaultLabelStyle() { | ||||||
| 		return $this->maniaControl->settingManager->getSettingValue($this, self::SETTING_LABEL_DEFAULT_STYLE); | 		return $this->maniaControl->getSettingManager()->getSettingValue($this, self::SETTING_LABEL_DEFAULT_STYLE); | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	/** | 	/** | ||||||
| @@ -86,7 +86,7 @@ class StyleManager { | |||||||
| 	 * @return string | 	 * @return string | ||||||
| 	 */ | 	 */ | ||||||
| 	public function getDefaultQuadStyle() { | 	public function getDefaultQuadStyle() { | ||||||
| 		return $this->maniaControl->settingManager->getSettingValue($this, self::SETTING_QUAD_DEFAULT_STYLE); | 		return $this->maniaControl->getSettingManager()->getSettingValue($this, self::SETTING_QUAD_DEFAULT_STYLE); | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	/** | 	/** | ||||||
| @@ -95,7 +95,7 @@ class StyleManager { | |||||||
| 	 * @return string | 	 * @return string | ||||||
| 	 */ | 	 */ | ||||||
| 	public function getDefaultQuadSubstyle() { | 	public function getDefaultQuadSubstyle() { | ||||||
| 		return $this->maniaControl->settingManager->getSettingValue($this, self::SETTING_QUAD_DEFAULT_SUBSTYLE); | 		return $this->maniaControl->getSettingManager()->getSettingValue($this, self::SETTING_QUAD_DEFAULT_SUBSTYLE); | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	/** | 	/** | ||||||
| @@ -124,7 +124,7 @@ class StyleManager { | |||||||
| 	 * @return float | 	 * @return float | ||||||
| 	 */ | 	 */ | ||||||
| 	public function getListWidgetsWidth() { | 	public function getListWidgetsWidth() { | ||||||
| 		return $this->maniaControl->settingManager->getSettingValue($this, self::SETTING_LIST_WIDGETS_WIDTH); | 		return $this->maniaControl->getSettingManager()->getSettingValue($this, self::SETTING_LIST_WIDGETS_WIDTH); | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	/** | 	/** | ||||||
| @@ -133,7 +133,7 @@ class StyleManager { | |||||||
| 	 * @return float | 	 * @return float | ||||||
| 	 */ | 	 */ | ||||||
| 	public function getListWidgetsHeight() { | 	public function getListWidgetsHeight() { | ||||||
| 		return $this->maniaControl->settingManager->getSettingValue($this, self::SETTING_LIST_WIDGETS_HEIGHT); | 		return $this->maniaControl->getSettingManager()->getSettingValue($this, self::SETTING_LIST_WIDGETS_HEIGHT); | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	/** | 	/** | ||||||
| @@ -218,7 +218,7 @@ class StyleManager { | |||||||
| 	 * @return string | 	 * @return string | ||||||
| 	 */ | 	 */ | ||||||
| 	public function getDefaultMainWindowStyle() { | 	public function getDefaultMainWindowStyle() { | ||||||
| 		return $this->maniaControl->settingManager->getSettingValue($this, self::SETTING_MAIN_WIDGET_DEFAULT_STYLE); | 		return $this->maniaControl->getSettingManager()->getSettingValue($this, self::SETTING_MAIN_WIDGET_DEFAULT_STYLE); | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	/** | 	/** | ||||||
| @@ -227,6 +227,6 @@ class StyleManager { | |||||||
| 	 * @return string | 	 * @return string | ||||||
| 	 */ | 	 */ | ||||||
| 	public function getDefaultMainWindowSubStyle() { | 	public function getDefaultMainWindowSubStyle() { | ||||||
| 		return $this->maniaControl->settingManager->getSettingValue($this, self::SETTING_MAIN_WIDGET_DEFAULT_SUBSTYLE); | 		return $this->maniaControl->getSettingManager()->getSettingValue($this, self::SETTING_MAIN_WIDGET_DEFAULT_SUBSTYLE); | ||||||
| 	} | 	} | ||||||
| } | } | ||||||
|   | |||||||
| @@ -54,14 +54,14 @@ class DirectoryBrowser implements ManialinkPageAnswerListener { | |||||||
| 	public function __construct(ManiaControl $maniaControl) { | 	public function __construct(ManiaControl $maniaControl) { | ||||||
| 		$this->maniaControl = $maniaControl; | 		$this->maniaControl = $maniaControl; | ||||||
|  |  | ||||||
| 		// Register for ManiaLink Actions | 		// ManiaLink Actions | ||||||
| 		$this->maniaControl->manialinkManager->registerManialinkPageAnswerListener(self::ACTION_SHOW, $this, 'handleActionShow'); | 		$this->maniaControl->getManialinkManager()->registerManialinkPageAnswerListener(self::ACTION_SHOW, $this, 'handleActionShow'); | ||||||
| 		$this->maniaControl->manialinkManager->registerManialinkPageAnswerListener(self::ACTION_NAVIGATE_UP, $this, 'handleNavigateUp'); | 		$this->maniaControl->getManialinkManager()->registerManialinkPageAnswerListener(self::ACTION_NAVIGATE_UP, $this, 'handleNavigateUp'); | ||||||
| 		$this->maniaControl->manialinkManager->registerManialinkPageAnswerListener(self::ACTION_NAVIGATE_ROOT, $this, 'handleNavigateRoot'); | 		$this->maniaControl->getManialinkManager()->registerManialinkPageAnswerListener(self::ACTION_NAVIGATE_ROOT, $this, 'handleNavigateRoot'); | ||||||
| 		$this->maniaControl->manialinkManager->registerManialinkPageAnswerRegexListener($this->buildActionRegex(self::ACTION_OPEN_FOLDER), $this, 'handleOpenFolder'); | 		$this->maniaControl->getManialinkManager()->registerManialinkPageAnswerRegexListener($this->buildActionRegex(self::ACTION_OPEN_FOLDER), $this, 'handleOpenFolder'); | ||||||
| 		$this->maniaControl->manialinkManager->registerManialinkPageAnswerRegexListener($this->buildActionRegex(self::ACTION_INSPECT_FILE), $this, 'handleInspectFile'); | 		$this->maniaControl->getManialinkManager()->registerManialinkPageAnswerRegexListener($this->buildActionRegex(self::ACTION_INSPECT_FILE), $this, 'handleInspectFile'); | ||||||
| 		$this->maniaControl->manialinkManager->registerManialinkPageAnswerRegexListener($this->buildActionRegex(self::ACTION_ADD_FILE), $this, 'handleAddFile'); | 		$this->maniaControl->getManialinkManager()->registerManialinkPageAnswerRegexListener($this->buildActionRegex(self::ACTION_ADD_FILE), $this, 'handleAddFile'); | ||||||
| 		$this->maniaControl->manialinkManager->registerManialinkPageAnswerRegexListener($this->buildActionRegex(self::ACTION_ERASE_FILE), $this, 'handleEraseFile'); | 		$this->maniaControl->getManialinkManager()->registerManialinkPageAnswerRegexListener($this->buildActionRegex(self::ACTION_ERASE_FILE), $this, 'handleEraseFile'); | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	/** | 	/** | ||||||
| @@ -94,7 +94,7 @@ class DirectoryBrowser implements ManialinkPageAnswerListener { | |||||||
| 		$oldFolderPath  = $player->getCache($this, self::CACHE_FOLDER_PATH); | 		$oldFolderPath  = $player->getCache($this, self::CACHE_FOLDER_PATH); | ||||||
| 		$isInMapsFolder = false; | 		$isInMapsFolder = false; | ||||||
| 		if (!$oldFolderPath) { | 		if (!$oldFolderPath) { | ||||||
| 			$oldFolderPath  = $this->maniaControl->server->getDirectory()->getMapsFolder(); | 			$oldFolderPath  = $this->maniaControl->getServer()->getDirectory()->getMapsFolder(); | ||||||
| 			$isInMapsFolder = true; | 			$isInMapsFolder = true; | ||||||
| 		} | 		} | ||||||
| 		$folderPath = $oldFolderPath; | 		$folderPath = $oldFolderPath; | ||||||
| @@ -105,12 +105,12 @@ class DirectoryBrowser implements ManialinkPageAnswerListener { | |||||||
| 				$folderName = basename($newFolderPath); | 				$folderName = basename($newFolderPath); | ||||||
| 				switch ($folderName) { | 				switch ($folderName) { | ||||||
| 					case 'Maps': | 					case 'Maps': | ||||||
| 						$mapsDir        = dirname($this->maniaControl->server->getDirectory()->getMapsFolder()); | 						$mapsDir        = dirname($this->maniaControl->getServer()->getDirectory()->getMapsFolder()); | ||||||
| 						$folderDir      = dirname($folderPath); | 						$folderDir      = dirname($folderPath); | ||||||
| 						$isInMapsFolder = ($mapsDir === $folderDir); | 						$isInMapsFolder = ($mapsDir === $folderDir); | ||||||
| 						break; | 						break; | ||||||
| 					case 'UserData': | 					case 'UserData': | ||||||
| 						$dataDir   = dirname($this->maniaControl->server->getDirectory()->getGameDataFolder()); | 						$dataDir   = dirname($this->maniaControl->getServer()->getDirectory()->getGameDataFolder()); | ||||||
| 						$folderDir = dirname($folderPath); | 						$folderDir = dirname($folderPath); | ||||||
| 						if ($dataDir === $folderDir) { | 						if ($dataDir === $folderDir) { | ||||||
| 							// Prevent navigation out of maps directory | 							// Prevent navigation out of maps directory | ||||||
| @@ -126,11 +126,11 @@ class DirectoryBrowser implements ManialinkPageAnswerListener { | |||||||
| 		$script    = $maniaLink->getScript(); | 		$script    = $maniaLink->getScript(); | ||||||
| 		$paging    = new Paging(); | 		$paging    = new Paging(); | ||||||
| 		$script->addFeature($paging); | 		$script->addFeature($paging); | ||||||
| 		$frame = $this->maniaControl->manialinkManager->getStyleManager()->getDefaultListFrame($script, $paging); | 		$frame = $this->maniaControl->getManialinkManager()->getStyleManager()->getDefaultListFrame($script, $paging); | ||||||
| 		$maniaLink->add($frame); | 		$maniaLink->add($frame); | ||||||
|  |  | ||||||
| 		$width     = $this->maniaControl->manialinkManager->getStyleManager()->getListWidgetsWidth(); | 		$width     = $this->maniaControl->getManialinkManager()->getStyleManager()->getListWidgetsWidth(); | ||||||
| 		$height    = $this->maniaControl->manialinkManager->getStyleManager()->getListWidgetsHeight(); | 		$height    = $this->maniaControl->getManialinkManager()->getStyleManager()->getListWidgetsHeight(); | ||||||
| 		$index     = 0; | 		$index     = 0; | ||||||
| 		$posY      = $height / 2 - 10; | 		$posY      = $height / 2 - 10; | ||||||
| 		$pageFrame = null; | 		$pageFrame = null; | ||||||
| @@ -154,7 +154,7 @@ class DirectoryBrowser implements ManialinkPageAnswerListener { | |||||||
|  |  | ||||||
| 		$directoryLabel = new Label_Text(); | 		$directoryLabel = new Label_Text(); | ||||||
| 		$frame->add($directoryLabel); | 		$frame->add($directoryLabel); | ||||||
| 		$dataFolder    = $this->maniaControl->server->getDirectory()->getGameDataFolder(); | 		$dataFolder    = $this->maniaControl->getServer()->getDirectory()->getGameDataFolder(); | ||||||
| 		$directoryText = substr($folderPath, strlen($dataFolder)); | 		$directoryText = substr($folderPath, strlen($dataFolder)); | ||||||
| 		$directoryLabel->setPosition($width * -0.41, $height * 0.45) | 		$directoryLabel->setPosition($width * -0.41, $height * 0.45) | ||||||
| 		               ->setSize($width * 0.85, 4) | 		               ->setSize($width * 0.85, 4) | ||||||
| @@ -181,8 +181,8 @@ class DirectoryBrowser implements ManialinkPageAnswerListener { | |||||||
| 				           ->setText('No files found.') | 				           ->setText('No files found.') | ||||||
| 				           ->setTranslate(true); | 				           ->setTranslate(true); | ||||||
| 			} else { | 			} else { | ||||||
| 				$canAddMaps   = $this->maniaControl->authenticationManager->checkPermission($player, MapManager::SETTING_PERMISSION_ADD_MAP); | 				$canAddMaps   = $this->maniaControl->getAuthenticationManager()->checkPermission($player, MapManager::SETTING_PERMISSION_ADD_MAP); | ||||||
| 				$canEraseMaps = $this->maniaControl->authenticationManager->checkPermission($player, MapManager::SETTING_PERMISSION_ERASE_MAP); | 				$canEraseMaps = $this->maniaControl->getAuthenticationManager()->checkPermission($player, MapManager::SETTING_PERMISSION_ERASE_MAP); | ||||||
|  |  | ||||||
| 				foreach ($mapFiles as $filePath => $fileName) { | 				foreach ($mapFiles as $filePath => $fileName) { | ||||||
| 					$shortFilePath = substr($filePath, strlen($folderPath)); | 					$shortFilePath = substr($filePath, strlen($folderPath)); | ||||||
| @@ -264,7 +264,7 @@ class DirectoryBrowser implements ManialinkPageAnswerListener { | |||||||
| 			           ->setTranslate(true); | 			           ->setTranslate(true); | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
| 		$this->maniaControl->manialinkManager->displayWidget($maniaLink, $player, self::WIDGET_NAME); | 		$this->maniaControl->getManialinkManager()->displayWidget($maniaLink, $player, self::WIDGET_NAME); | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	/** | 	/** | ||||||
| @@ -369,40 +369,40 @@ class DirectoryBrowser implements ManialinkPageAnswerListener { | |||||||
| 		$folderPath = $player->getCache($this, self::CACHE_FOLDER_PATH); | 		$folderPath = $player->getCache($this, self::CACHE_FOLDER_PATH); | ||||||
| 		$filePath   = $folderPath . $fileName; | 		$filePath   = $folderPath . $fileName; | ||||||
|  |  | ||||||
| 		$mapsFolder       = $this->maniaControl->server->getDirectory()->getMapsFolder(); | 		$mapsFolder       = $this->maniaControl->getServer()->getDirectory()->getMapsFolder(); | ||||||
| 		$relativeFilePath = substr($filePath, strlen($mapsFolder)); | 		$relativeFilePath = substr($filePath, strlen($mapsFolder)); | ||||||
|  |  | ||||||
| 		// Check for valid map | 		// Check for valid map | ||||||
| 		try { | 		try { | ||||||
| 			$this->maniaControl->client->checkMapForCurrentServerParams($relativeFilePath); | 			$this->maniaControl->getClient()->checkMapForCurrentServerParams($relativeFilePath); | ||||||
| 		} catch (InvalidMapException $exception) { | 		} catch (InvalidMapException $exception) { | ||||||
| 			$this->maniaControl->chat->sendException($exception, $player); | 			$this->maniaControl->getChat()->sendException($exception, $player); | ||||||
| 			return; | 			return; | ||||||
| 		} catch (FileException $exception) { | 		} catch (FileException $exception) { | ||||||
| 			$this->maniaControl->chat->sendException($exception, $player); | 			$this->maniaControl->getChat()->sendException($exception, $player); | ||||||
| 			return; | 			return; | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
| 		// Add map to map list | 		// Add map to map list | ||||||
| 		try { | 		try { | ||||||
| 			$this->maniaControl->client->insertMap($relativeFilePath); | 			$this->maniaControl->getClient()->insertMap($relativeFilePath); | ||||||
| 		} catch (AlreadyInListException $exception) { | 		} catch (AlreadyInListException $exception) { | ||||||
| 			$this->maniaControl->chat->sendException($exception, $player); | 			$this->maniaControl->getChat()->sendException($exception, $player); | ||||||
| 			return; | 			return; | ||||||
| 		} | 		} | ||||||
| 		$map = $this->maniaControl->mapManager->fetchMapByFileName($relativeFilePath); | 		$map = $this->maniaControl->getMapManager()->fetchMapByFileName($relativeFilePath); | ||||||
| 		if (!$map) { | 		if (!$map) { | ||||||
| 			$this->maniaControl->chat->sendError('Error occurred.', $player); | 			$this->maniaControl->getChat()->sendError('Error occurred.', $player); | ||||||
| 			return; | 			return; | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
| 		// Message | 		// Message | ||||||
| 		$message = $player->getEscapedNickname() . ' added ' . $map->getEscapedName() . '!'; | 		$message = $player->getEscapedNickname() . ' added ' . $map->getEscapedName() . '!'; | ||||||
| 		$this->maniaControl->chat->sendSuccess($message); | 		$this->maniaControl->getChat()->sendSuccess($message); | ||||||
| 		$this->maniaControl->log($message, true); | 		$this->maniaControl->log($message, true); | ||||||
|  |  | ||||||
| 		// Queue requested Map | 		// Queue requested Map | ||||||
| 		$this->maniaControl->mapManager->getMapQueue()->addMapToMapQueue($player, $map); | 		$this->maniaControl->getMapManager()->getMapQueue()->addMapToMapQueue($player, $map); | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	/** | 	/** | ||||||
| @@ -417,10 +417,10 @@ class DirectoryBrowser implements ManialinkPageAnswerListener { | |||||||
| 		$folderPath = $player->getCache($this, self::CACHE_FOLDER_PATH); | 		$folderPath = $player->getCache($this, self::CACHE_FOLDER_PATH); | ||||||
| 		$filePath   = $folderPath . $fileName; | 		$filePath   = $folderPath . $fileName; | ||||||
| 		if (@unlink($filePath)) { | 		if (@unlink($filePath)) { | ||||||
| 			$this->maniaControl->chat->sendSuccess("Erased {$fileName}!"); | 			$this->maniaControl->getChat()->sendSuccess("Erased {$fileName}!"); | ||||||
| 			$this->showManiaLink($player); | 			$this->showManiaLink($player); | ||||||
| 		} else { | 		} else { | ||||||
| 			$this->maniaControl->chat->sendError("Couldn't erase {$fileName}!"); | 			$this->maniaControl->getChat()->sendError("Couldn't erase {$fileName}!"); | ||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
| } | } | ||||||
|   | |||||||
| @@ -32,15 +32,15 @@ class MapActions { | |||||||
| 	 * Skip the current Map | 	 * Skip the current Map | ||||||
| 	 */ | 	 */ | ||||||
| 	public function skipMap() { | 	public function skipMap() { | ||||||
| 		//Force a EndMap on the MapQueue to set the next Map | 		// Force an EndMap on the MapQueue to set the next Map | ||||||
| 		$this->maniaControl->mapManager->getMapQueue()->endMap(null); | 		$this->maniaControl->getMapManager()->getMapQueue()->endMap(null); | ||||||
|  |  | ||||||
| 		//ignore EndMap on MapQueue | 		// Ignore EndMap on MapQueue | ||||||
| 		$this->maniaControl->mapManager->getMapQueue()->dontQueueNextMapChange(); | 		$this->maniaControl->getMapManager()->getMapQueue()->dontQueueNextMapChange(); | ||||||
|  |  | ||||||
| 		//Switch The Map | 		// Switch The Map | ||||||
| 		try { | 		try { | ||||||
| 			$this->maniaControl->client->nextMap(); | 			$this->maniaControl->getClient()->nextMap(); | ||||||
| 		} catch (ChangeInProgressException $e) { | 		} catch (ChangeInProgressException $e) { | ||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
|   | |||||||
| @@ -48,28 +48,28 @@ class MapCommands implements CommandListener, ManialinkPageAnswerListener, Callb | |||||||
| 		$this->maniaControl = $maniaControl; | 		$this->maniaControl = $maniaControl; | ||||||
| 		$this->initActionsMenuButtons(); | 		$this->initActionsMenuButtons(); | ||||||
|  |  | ||||||
| 		// Register for admin chat commands | 		// Admin commands | ||||||
| 		$this->maniaControl->commandManager->registerCommandListener(array('nextmap', 'next', 'skip'), $this, 'command_NextMap', true, 'Skips to the next map.'); | 		$this->maniaControl->getCommandManager()->registerCommandListener(array('nextmap', 'next', 'skip'), $this, 'command_NextMap', true, 'Skips to the next map.'); | ||||||
| 		$this->maniaControl->commandManager->registerCommandListener(array('restartmap', 'resmap', 'res'), $this, 'command_RestartMap', true, 'Restarts the current map.'); | 		$this->maniaControl->getCommandManager()->registerCommandListener(array('restartmap', 'resmap', 'res'), $this, 'command_RestartMap', true, 'Restarts the current map.'); | ||||||
| 		$this->maniaControl->commandManager->registerCommandListener(array('replaymap', 'replay'), $this, 'command_ReplayMap', true, 'Replays the current map (after the end of the map).'); | 		$this->maniaControl->getCommandManager()->registerCommandListener(array('replaymap', 'replay'), $this, 'command_ReplayMap', true, 'Replays the current map (after the end of the map).'); | ||||||
| 		$this->maniaControl->commandManager->registerCommandListener(array('addmap', 'add'), $this, 'command_AddMap', true, 'Adds map from ManiaExchange.'); | 		$this->maniaControl->getCommandManager()->registerCommandListener(array('addmap', 'add'), $this, 'command_AddMap', true, 'Adds map from ManiaExchange.'); | ||||||
| 		$this->maniaControl->commandManager->registerCommandListener(array('removemap', 'removethis'), $this, 'command_RemoveMap', true, 'Removes the current map.'); | 		$this->maniaControl->getCommandManager()->registerCommandListener(array('removemap', 'removethis'), $this, 'command_RemoveMap', true, 'Removes the current map.'); | ||||||
| 		$this->maniaControl->commandManager->registerCommandListener(array('erasemap', 'erasethis'), $this, 'command_EraseMap', true, 'Erases the current map.'); | 		$this->maniaControl->getCommandManager()->registerCommandListener(array('erasemap', 'erasethis'), $this, 'command_EraseMap', true, 'Erases the current map.'); | ||||||
| 		$this->maniaControl->commandManager->registerCommandListener(array('shufflemaps', 'shuffle'), $this, 'command_ShuffleMaps', true, 'Shuffles the maplist.'); | 		$this->maniaControl->getCommandManager()->registerCommandListener(array('shufflemaps', 'shuffle'), $this, 'command_ShuffleMaps', true, 'Shuffles the maplist.'); | ||||||
| 		$this->maniaControl->commandManager->registerCommandListener(array('writemaplist', 'wml'), $this, 'command_WriteMapList', true, 'Writes the current maplist to a file.'); | 		$this->maniaControl->getCommandManager()->registerCommandListener(array('writemaplist', 'wml'), $this, 'command_WriteMapList', true, 'Writes the current maplist to a file.'); | ||||||
| 		$this->maniaControl->commandManager->registerCommandListener(array('readmaplist', 'rml'), $this, 'command_ReadMapList', true, 'Loads a maplist into the server.'); | 		$this->maniaControl->getCommandManager()->registerCommandListener(array('readmaplist', 'rml'), $this, 'command_ReadMapList', true, 'Loads a maplist into the server.'); | ||||||
|  |  | ||||||
| 		// Register for player chat commands | 		// Player commands | ||||||
| 		$this->maniaControl->commandManager->registerCommandListener('nextmap', $this, 'command_showNextMap', false, 'Shows which map is next.'); | 		$this->maniaControl->getCommandManager()->registerCommandListener('nextmap', $this, 'command_showNextMap', false, 'Shows which map is next.'); | ||||||
| 		$this->maniaControl->commandManager->registerCommandListener(array('maps', 'list'), $this, 'command_List', false, 'Shows the current maplist (or variations).'); | 		$this->maniaControl->getCommandManager()->registerCommandListener(array('maps', 'list'), $this, 'command_List', false, 'Shows the current maplist (or variations).'); | ||||||
| 		$this->maniaControl->commandManager->registerCommandListener(array('xmaps', 'xlist'), $this, 'command_xList', false, 'Shows maps from ManiaExchange.'); | 		$this->maniaControl->getCommandManager()->registerCommandListener(array('xmaps', 'xlist'), $this, 'command_xList', false, 'Shows maps from ManiaExchange.'); | ||||||
|  |  | ||||||
| 		// Menu Buttons | 		// Callbacks | ||||||
| 		$this->maniaControl->manialinkManager->registerManialinkPageAnswerListener(self::ACTION_OPEN_XLIST, $this, 'command_xList'); | 		$this->maniaControl->getCallbackManager()->registerCallbackListener(CallbackManager::CB_MP_PLAYERMANIALINKPAGEANSWER, $this, 'handleManialinkPageAnswer'); | ||||||
| 		$this->maniaControl->manialinkManager->registerManialinkPageAnswerListener(self::ACTION_OPEN_MAPLIST, $this, 'command_List'); | 		$this->maniaControl->getManialinkManager()->registerManialinkPageAnswerListener(self::ACTION_OPEN_XLIST, $this, 'command_xList'); | ||||||
| 		$this->maniaControl->manialinkManager->registerManialinkPageAnswerListener(self::ACTION_RESTART_MAP, $this, 'command_RestartMap'); | 		$this->maniaControl->getManialinkManager()->registerManialinkPageAnswerListener(self::ACTION_OPEN_MAPLIST, $this, 'command_List'); | ||||||
| 		$this->maniaControl->manialinkManager->registerManialinkPageAnswerListener(self::ACTION_SKIP_MAP, $this, 'command_NextMap'); | 		$this->maniaControl->getManialinkManager()->registerManialinkPageAnswerListener(self::ACTION_RESTART_MAP, $this, 'command_RestartMap'); | ||||||
| 		$this->maniaControl->callbackManager->registerCallbackListener(CallbackManager::CB_MP_PLAYERMANIALINKPAGEANSWER, $this, 'handleManialinkPageAnswer'); | 		$this->maniaControl->getManialinkManager()->registerManialinkPageAnswerListener(self::ACTION_SKIP_MAP, $this, 'command_NextMap'); | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	/** | 	/** | ||||||
| @@ -78,28 +78,28 @@ class MapCommands implements CommandListener, ManialinkPageAnswerListener, Callb | |||||||
| 	private function initActionsMenuButtons() { | 	private function initActionsMenuButtons() { | ||||||
| 		// Menu Open xList | 		// Menu Open xList | ||||||
| 		$itemQuad = new Quad(); | 		$itemQuad = new Quad(); | ||||||
| 		$itemQuad->setImage($this->maniaControl->manialinkManager->getIconManager()->getIcon(IconManager::MX_ICON)); | 		$itemQuad->setImage($this->maniaControl->getManialinkManager()->getIconManager()->getIcon(IconManager::MX_ICON)); | ||||||
| 		$itemQuad->setImageFocus($this->maniaControl->manialinkManager->getIconManager()->getIcon(IconManager::MX_ICON_MOVER)); | 		$itemQuad->setImageFocus($this->maniaControl->getManialinkManager()->getIconManager()->getIcon(IconManager::MX_ICON_MOVER)); | ||||||
| 		$itemQuad->setAction(self::ACTION_OPEN_XLIST); | 		$itemQuad->setAction(self::ACTION_OPEN_XLIST); | ||||||
| 		$this->maniaControl->actionsMenu->addPlayerMenuItem($itemQuad, 5, 'Open MX List'); | 		$this->maniaControl->getActionsMenu()->addPlayerMenuItem($itemQuad, 5, 'Open MX List'); | ||||||
|  |  | ||||||
| 		// Menu Open List | 		// Menu Open List | ||||||
| 		$itemQuad = new Quad_Icons64x64_1(); | 		$itemQuad = new Quad_Icons64x64_1(); | ||||||
| 		$itemQuad->setSubStyle($itemQuad::SUBSTYLE_ToolRoot); | 		$itemQuad->setSubStyle($itemQuad::SUBSTYLE_ToolRoot); | ||||||
| 		$itemQuad->setAction(self::ACTION_OPEN_MAPLIST); | 		$itemQuad->setAction(self::ACTION_OPEN_MAPLIST); | ||||||
| 		$this->maniaControl->actionsMenu->addPlayerMenuItem($itemQuad, 10, 'Open MapList'); | 		$this->maniaControl->getActionsMenu()->addPlayerMenuItem($itemQuad, 10, 'Open MapList'); | ||||||
|  |  | ||||||
| 		// Menu RestartMap | 		// Menu RestartMap | ||||||
| 		$itemQuad = new Quad_UIConstruction_Buttons(); | 		$itemQuad = new Quad_UIConstruction_Buttons(); | ||||||
| 		$itemQuad->setSubStyle($itemQuad::SUBSTYLE_Reload); | 		$itemQuad->setSubStyle($itemQuad::SUBSTYLE_Reload); | ||||||
| 		$itemQuad->setAction(self::ACTION_RESTART_MAP); | 		$itemQuad->setAction(self::ACTION_RESTART_MAP); | ||||||
| 		$this->maniaControl->actionsMenu->addAdminMenuItem($itemQuad, 10, 'Restart Map'); | 		$this->maniaControl->getActionsMenu()->addAdminMenuItem($itemQuad, 10, 'Restart Map'); | ||||||
|  |  | ||||||
| 		// Menu NextMap | 		// Menu NextMap | ||||||
| 		$itemQuad = new Quad_Icons64x64_1(); | 		$itemQuad = new Quad_Icons64x64_1(); | ||||||
| 		$itemQuad->setSubStyle($itemQuad::SUBSTYLE_ArrowFastNext); | 		$itemQuad->setSubStyle($itemQuad::SUBSTYLE_ArrowFastNext); | ||||||
| 		$itemQuad->setAction(self::ACTION_SKIP_MAP); | 		$itemQuad->setAction(self::ACTION_SKIP_MAP); | ||||||
| 		$this->maniaControl->actionsMenu->addAdminMenuItem($itemQuad, 20, 'Skip Map'); | 		$this->maniaControl->getActionsMenu()->addAdminMenuItem($itemQuad, 20, 'Skip Map'); | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	/** | 	/** | ||||||
| @@ -109,18 +109,18 @@ class MapCommands implements CommandListener, ManialinkPageAnswerListener, Callb | |||||||
| 	 * @param Player $player | 	 * @param Player $player | ||||||
| 	 */ | 	 */ | ||||||
| 	public function command_ShowNextMap(array $chatCallback, Player $player) { | 	public function command_ShowNextMap(array $chatCallback, Player $player) { | ||||||
| 		$nextQueued = $this->maniaControl->mapManager->getMapQueue()->getNextQueuedMap(); | 		$nextQueued = $this->maniaControl->getMapManager()->getMapQueue()->getNextQueuedMap(); | ||||||
| 		if ($nextQueued) { | 		if ($nextQueued) { | ||||||
| 			/** @var Player $requester */ | 			/** @var Player $requester */ | ||||||
| 			$requester = $nextQueued[0]; | 			$requester = $nextQueued[0]; | ||||||
| 			/** @var Map $map */ | 			/** @var Map $map */ | ||||||
| 			$map = $nextQueued[1]; | 			$map = $nextQueued[1]; | ||||||
| 			$this->maniaControl->chat->sendInformation("Next Map is $<{$map->name}$> from $<{$map->authorNick}$> requested by $<{$requester->nickname}$>.", $player); | 			$this->maniaControl->getChat()->sendInformation("Next Map is $<{$map->name}$> from $<{$map->authorNick}$> requested by $<{$requester->nickname}$>.", $player); | ||||||
| 		} else { | 		} else { | ||||||
| 			$mapIndex = $this->maniaControl->client->getNextMapIndex(); | 			$mapIndex = $this->maniaControl->getClient()->getNextMapIndex(); | ||||||
| 			$maps     = $this->maniaControl->mapManager->getMaps(); | 			$maps     = $this->maniaControl->getMapManager()->getMaps(); | ||||||
| 			$map      = $maps[$mapIndex]; | 			$map      = $maps[$mapIndex]; | ||||||
| 			$this->maniaControl->chat->sendInformation("Next Map is $<{$map->name}$> from $<{$map->authorNick}$>.", $player); | 			$this->maniaControl->getChat()->sendInformation("Next Map is $<{$map->name}$> from $<{$map->authorNick}$>.", $player); | ||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| @@ -131,19 +131,19 @@ class MapCommands implements CommandListener, ManialinkPageAnswerListener, Callb | |||||||
| 	 * @param Player $player | 	 * @param Player $player | ||||||
| 	 */ | 	 */ | ||||||
| 	public function command_RemoveMap(array $chatCallback, Player $player) { | 	public function command_RemoveMap(array $chatCallback, Player $player) { | ||||||
| 		if (!$this->maniaControl->authenticationManager->checkPermission($player, MapManager::SETTING_PERMISSION_REMOVE_MAP)) { | 		if (!$this->maniaControl->getAuthenticationManager()->checkPermission($player, MapManager::SETTING_PERMISSION_REMOVE_MAP)) { | ||||||
| 			$this->maniaControl->authenticationManager->sendNotAllowed($player); | 			$this->maniaControl->getAuthenticationManager()->sendNotAllowed($player); | ||||||
| 			return; | 			return; | ||||||
| 		} | 		} | ||||||
| 		// Get map | 		// Get map | ||||||
| 		$map = $this->maniaControl->mapManager->getCurrentMap(); | 		$map = $this->maniaControl->getMapManager()->getCurrentMap(); | ||||||
| 		if (!$map) { | 		if (!$map) { | ||||||
| 			$this->maniaControl->chat->sendError("Couldn't remove map.", $player); | 			$this->maniaControl->getChat()->sendError("Couldn't remove map.", $player); | ||||||
| 			return; | 			return; | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
| 		// Remove map | 		// Remove map | ||||||
| 		$this->maniaControl->mapManager->removeMap($player, $map->uid); | 		$this->maniaControl->getMapManager()->removeMap($player, $map->uid); | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	/** | 	/** | ||||||
| @@ -153,19 +153,19 @@ class MapCommands implements CommandListener, ManialinkPageAnswerListener, Callb | |||||||
| 	 * @param Player $player | 	 * @param Player $player | ||||||
| 	 */ | 	 */ | ||||||
| 	public function command_EraseMap(array $chatCallback, Player $player) { | 	public function command_EraseMap(array $chatCallback, Player $player) { | ||||||
| 		if (!$this->maniaControl->authenticationManager->checkPermission($player, MapManager::SETTING_PERMISSION_ERASE_MAP)) { | 		if (!$this->maniaControl->getAuthenticationManager()->checkPermission($player, MapManager::SETTING_PERMISSION_ERASE_MAP)) { | ||||||
| 			$this->maniaControl->authenticationManager->sendNotAllowed($player); | 			$this->maniaControl->getAuthenticationManager()->sendNotAllowed($player); | ||||||
| 			return; | 			return; | ||||||
| 		} | 		} | ||||||
| 		// Get map | 		// Get map | ||||||
| 		$map = $this->maniaControl->mapManager->getCurrentMap(); | 		$map = $this->maniaControl->getMapManager()->getCurrentMap(); | ||||||
| 		if (!$map) { | 		if (!$map) { | ||||||
| 			$this->maniaControl->chat->sendError("Couldn't erase map.", $player); | 			$this->maniaControl->getChat()->sendError("Couldn't erase map.", $player); | ||||||
| 			return; | 			return; | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
| 		// Erase map | 		// Erase map | ||||||
| 		$this->maniaControl->mapManager->removeMap($player, $map->uid, true); | 		$this->maniaControl->getMapManager()->removeMap($player, $map->uid, true); | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	/** | 	/** | ||||||
| @@ -175,13 +175,13 @@ class MapCommands implements CommandListener, ManialinkPageAnswerListener, Callb | |||||||
| 	 * @param \ManiaControl\Players\Player $player | 	 * @param \ManiaControl\Players\Player $player | ||||||
| 	 */ | 	 */ | ||||||
| 	public function command_ShuffleMaps(array $chatCallback, Player $player) { | 	public function command_ShuffleMaps(array $chatCallback, Player $player) { | ||||||
| 		if (!$this->maniaControl->authenticationManager->checkPermission($player, MapManager::SETTING_PERMISSION_SHUFFLE_MAPS)) { | 		if (!$this->maniaControl->getAuthenticationManager()->checkPermission($player, MapManager::SETTING_PERMISSION_SHUFFLE_MAPS)) { | ||||||
| 			$this->maniaControl->authenticationManager->sendNotAllowed($player); | 			$this->maniaControl->getAuthenticationManager()->sendNotAllowed($player); | ||||||
| 			return; | 			return; | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
| 		// Shuffles the maps | 		// Shuffles the maps | ||||||
| 		$this->maniaControl->mapManager->shuffleMapList($player); | 		$this->maniaControl->getMapManager()->shuffleMapList($player); | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	/** | 	/** | ||||||
| @@ -191,18 +191,18 @@ class MapCommands implements CommandListener, ManialinkPageAnswerListener, Callb | |||||||
| 	 * @param \ManiaControl\Players\Player $player | 	 * @param \ManiaControl\Players\Player $player | ||||||
| 	 */ | 	 */ | ||||||
| 	public function command_AddMap(array $chatCallback, Player $player) { | 	public function command_AddMap(array $chatCallback, Player $player) { | ||||||
| 		if (!$this->maniaControl->authenticationManager->checkPermission($player, MapManager::SETTING_PERMISSION_ADD_MAP)) { | 		if (!$this->maniaControl->getAuthenticationManager()->checkPermission($player, MapManager::SETTING_PERMISSION_ADD_MAP)) { | ||||||
| 			$this->maniaControl->authenticationManager->sendNotAllowed($player); | 			$this->maniaControl->getAuthenticationManager()->sendNotAllowed($player); | ||||||
| 			return; | 			return; | ||||||
| 		} | 		} | ||||||
| 		$params = explode(' ', $chatCallback[1][2], 2); | 		$params = explode(' ', $chatCallback[1][2], 2); | ||||||
| 		if (count($params) < 2) { | 		if (count($params) < 2) { | ||||||
| 			$this->maniaControl->chat->sendUsageInfo('Usage example: //addmap 1234', $player->login); | 			$this->maniaControl->getChat()->sendUsageInfo('Usage example: //addmap 1234', $player); | ||||||
| 			return; | 			return; | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
| 		// add Map from Mania Exchange | 		// add Map from Mania Exchange | ||||||
| 		$this->maniaControl->mapManager->addMapFromMx($params[1], $player->login); | 		$this->maniaControl->getMapManager()->addMapFromMx($params[1], $player->login); | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	/** | 	/** | ||||||
| @@ -212,15 +212,15 @@ class MapCommands implements CommandListener, ManialinkPageAnswerListener, Callb | |||||||
| 	 * @param \ManiaControl\Players\Player $player | 	 * @param \ManiaControl\Players\Player $player | ||||||
| 	 */ | 	 */ | ||||||
| 	public function command_NextMap(array $chat, Player $player) { | 	public function command_NextMap(array $chat, Player $player) { | ||||||
| 		if (!$this->maniaControl->authenticationManager->checkPermission($player, MapManager::SETTING_PERMISSION_SKIP_MAP)) { | 		if (!$this->maniaControl->getAuthenticationManager()->checkPermission($player, MapManager::SETTING_PERMISSION_SKIP_MAP)) { | ||||||
| 			$this->maniaControl->authenticationManager->sendNotAllowed($player); | 			$this->maniaControl->getAuthenticationManager()->sendNotAllowed($player); | ||||||
| 			return; | 			return; | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
| 		$this->maniaControl->mapManager->getMapActions()->skipMap(); | 		$this->maniaControl->getMapManager()->getMapActions()->skipMap(); | ||||||
|  |  | ||||||
| 		$message = '$<' . $player->nickname . '$> skipped the current Map!'; | 		$message = $player->getEscapedNickname() . ' skipped the current Map!'; | ||||||
| 		$this->maniaControl->chat->sendSuccess($message); | 		$this->maniaControl->getChat()->sendSuccess($message); | ||||||
| 		$this->maniaControl->log($message, true); | 		$this->maniaControl->log($message, true); | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| @@ -231,16 +231,16 @@ class MapCommands implements CommandListener, ManialinkPageAnswerListener, Callb | |||||||
| 	 * @param \ManiaControl\Players\Player $player | 	 * @param \ManiaControl\Players\Player $player | ||||||
| 	 */ | 	 */ | ||||||
| 	public function command_RestartMap(array $chat, Player $player) { | 	public function command_RestartMap(array $chat, Player $player) { | ||||||
| 		if (!$this->maniaControl->authenticationManager->checkPermission($player, MapManager::SETTING_PERMISSION_RESTART_MAP)) { | 		if (!$this->maniaControl->getAuthenticationManager()->checkPermission($player, MapManager::SETTING_PERMISSION_RESTART_MAP)) { | ||||||
| 			$this->maniaControl->authenticationManager->sendNotAllowed($player); | 			$this->maniaControl->getAuthenticationManager()->sendNotAllowed($player); | ||||||
| 			return; | 			return; | ||||||
| 		} | 		} | ||||||
| 		$message = '$<' . $player->nickname . '$> restarted the current Map!'; | 		$message = $player->getEscapedNickname() . ' restarted the current Map!'; | ||||||
| 		$this->maniaControl->chat->sendSuccess($message); | 		$this->maniaControl->getChat()->sendSuccess($message); | ||||||
| 		$this->maniaControl->log($message, true); | 		$this->maniaControl->log($message, true); | ||||||
|  |  | ||||||
| 		try { | 		try { | ||||||
| 			$this->maniaControl->client->restartMap(); | 			$this->maniaControl->getClient()->restartMap(); | ||||||
| 		} catch (ChangeInProgressException $e) { | 		} catch (ChangeInProgressException $e) { | ||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
| @@ -253,15 +253,15 @@ class MapCommands implements CommandListener, ManialinkPageAnswerListener, Callb | |||||||
| 	 * @param \ManiaControl\Players\Player $player | 	 * @param \ManiaControl\Players\Player $player | ||||||
| 	 */ | 	 */ | ||||||
| 	public function command_ReplayMap(array $chat, Player $player) { | 	public function command_ReplayMap(array $chat, Player $player) { | ||||||
| 		if (!$this->maniaControl->authenticationManager->checkPermission($player, MapManager::SETTING_PERMISSION_RESTART_MAP)) { | 		if (!$this->maniaControl->getAuthenticationManager()->checkPermission($player, MapManager::SETTING_PERMISSION_RESTART_MAP)) { | ||||||
| 			$this->maniaControl->authenticationManager->sendNotAllowed($player); | 			$this->maniaControl->getAuthenticationManager()->sendNotAllowed($player); | ||||||
| 			return; | 			return; | ||||||
| 		} | 		} | ||||||
| 		$message = '$<' . $player->nickname . '$> replays the current Map!'; | 		$message = $player->getEscapedNickname() . ' replays the current Map!'; | ||||||
| 		$this->maniaControl->chat->sendSuccess($message); | 		$this->maniaControl->getChat()->sendSuccess($message); | ||||||
| 		$this->maniaControl->log($message, true); | 		$this->maniaControl->log($message, true); | ||||||
|  |  | ||||||
| 		$this->maniaControl->mapManager->getMapQueue()->addFirstMapToMapQueue($player, $this->maniaControl->mapManager->getCurrentMap()); | 		$this->maniaControl->getMapManager()->getMapQueue()->addFirstMapToMapQueue($player, $this->maniaControl->getMapManager()->getCurrentMap()); | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	/** | 	/** | ||||||
| @@ -271,8 +271,8 @@ class MapCommands implements CommandListener, ManialinkPageAnswerListener, Callb | |||||||
| 	 * @param \ManiaControl\Players\Player $player | 	 * @param \ManiaControl\Players\Player $player | ||||||
| 	 */ | 	 */ | ||||||
| 	public function command_WriteMapList(array $chat, Player $player) { | 	public function command_WriteMapList(array $chat, Player $player) { | ||||||
| 		if (!$this->maniaControl->authenticationManager->checkRight($player, AuthenticationManager::AUTH_LEVEL_SUPERADMIN)) { | 		if (!$this->maniaControl->getAuthenticationManager()->checkRight($player, AuthenticationManager::AUTH_LEVEL_SUPERADMIN)) { | ||||||
| 			$this->maniaControl->authenticationManager->sendNotAllowed($player); | 			$this->maniaControl->getAuthenticationManager()->sendNotAllowed($player); | ||||||
| 			return; | 			return; | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
| @@ -289,13 +289,13 @@ class MapCommands implements CommandListener, ManialinkPageAnswerListener, Callb | |||||||
|  |  | ||||||
| 		$maplist = 'MatchSettings' . DIRECTORY_SEPARATOR . $maplist; | 		$maplist = 'MatchSettings' . DIRECTORY_SEPARATOR . $maplist; | ||||||
| 		try { | 		try { | ||||||
| 			$this->maniaControl->client->saveMatchSettings($maplist); | 			$this->maniaControl->getClient()->saveMatchSettings($maplist); | ||||||
|  |  | ||||||
| 			$message = 'Maplist $<$fff' . $maplist . '$> written.'; | 			$message = 'Maplist $<$fff' . $maplist . '$> written.'; | ||||||
| 			$this->maniaControl->chat->sendSuccess($message, $player); | 			$this->maniaControl->getChat()->sendSuccess($message, $player); | ||||||
| 			$this->maniaControl->log($message, true); | 			$this->maniaControl->log($message, true); | ||||||
| 		} catch (FaultException $e) { | 		} catch (FaultException $e) { | ||||||
| 			$this->maniaControl->chat->sendError('Cannot write maplist $<$fff' . $maplist . '$>!', $player); | 			$this->maniaControl->getChat()->sendError('Cannot write maplist $<$fff' . $maplist . '$>!', $player); | ||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| @@ -306,8 +306,8 @@ class MapCommands implements CommandListener, ManialinkPageAnswerListener, Callb | |||||||
| 	 * @param \ManiaControl\Players\Player $player | 	 * @param \ManiaControl\Players\Player $player | ||||||
| 	 */ | 	 */ | ||||||
| 	public function command_ReadMapList(array $chat, Player $player) { | 	public function command_ReadMapList(array $chat, Player $player) { | ||||||
| 		if (!$this->maniaControl->authenticationManager->checkRight($player, AuthenticationManager::AUTH_LEVEL_SUPERADMIN)) { | 		if (!$this->maniaControl->getAuthenticationManager()->checkRight($player, AuthenticationManager::AUTH_LEVEL_SUPERADMIN)) { | ||||||
| 			$this->maniaControl->authenticationManager->sendNotAllowed($player); | 			$this->maniaControl->getAuthenticationManager()->sendNotAllowed($player); | ||||||
| 			return; | 			return; | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
| @@ -324,14 +324,14 @@ class MapCommands implements CommandListener, ManialinkPageAnswerListener, Callb | |||||||
|  |  | ||||||
| 		$maplist = 'MatchSettings' . DIRECTORY_SEPARATOR . $maplist; | 		$maplist = 'MatchSettings' . DIRECTORY_SEPARATOR . $maplist; | ||||||
| 		try { | 		try { | ||||||
| 			$this->maniaControl->client->loadMatchSettings($maplist); | 			$this->maniaControl->getClient()->loadMatchSettings($maplist); | ||||||
|  |  | ||||||
| 			$message = 'Maplist $<$fff' . $maplist . '$> loaded.'; | 			$message = 'Maplist $<$fff' . $maplist . '$> loaded.'; | ||||||
| 			$this->maniaControl->mapManager->restructureMapList(); | 			$this->maniaControl->getMapManager()->restructureMapList(); | ||||||
| 			$this->maniaControl->chat->sendSuccess($message, $player); | 			$this->maniaControl->getChat()->sendSuccess($message, $player); | ||||||
| 			$this->maniaControl->log($message, true); | 			$this->maniaControl->log($message, true); | ||||||
| 		} catch (FaultException $e) { | 		} catch (FaultException $e) { | ||||||
| 			$this->maniaControl->chat->sendError('Cannot load maplist $<$fff' . $maplist . '$>!', $player); | 			$this->maniaControl->getChat()->sendError('Cannot load maplist $<$fff' . $maplist . '$>!', $player); | ||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| @@ -344,11 +344,11 @@ class MapCommands implements CommandListener, ManialinkPageAnswerListener, Callb | |||||||
| 		$actionId = $callback[1][2]; | 		$actionId = $callback[1][2]; | ||||||
|  |  | ||||||
| 		$login  = $callback[1][1]; | 		$login  = $callback[1][1]; | ||||||
| 		$player = $this->maniaControl->playerManager->getPlayer($login); | 		$player = $this->maniaControl->getPlayerManager()->getPlayer($login); | ||||||
|  |  | ||||||
| 		if (strstr($actionId, self::ACTION_SHOW_AUTHOR)) { | 		if (strstr($actionId, self::ACTION_SHOW_AUTHOR)) { | ||||||
| 			$login = str_replace(self::ACTION_SHOW_AUTHOR, '', $actionId); | 			$login = str_replace(self::ACTION_SHOW_AUTHOR, '', $actionId); | ||||||
| 			$this->maniaControl->mapManager->getMapList()->playerCloseWidget($player); | 			$this->maniaControl->getMapManager()->getMapList()->playerCloseWidget($player); | ||||||
| 			$this->showMapListAuthor($login, $player); | 			$this->showMapListAuthor($login, $player); | ||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
| @@ -360,7 +360,7 @@ class MapCommands implements CommandListener, ManialinkPageAnswerListener, Callb | |||||||
| 	 * @param Player $player | 	 * @param Player $player | ||||||
| 	 */ | 	 */ | ||||||
| 	private function showMapListAuthor($author, Player $player) { | 	private function showMapListAuthor($author, Player $player) { | ||||||
| 		$maps    = $this->maniaControl->mapManager->getMaps(); | 		$maps    = $this->maniaControl->getMapManager()->getMaps(); | ||||||
| 		$mapList = array(); | 		$mapList = array(); | ||||||
| 		/** @var Map $map */ | 		/** @var Map $map */ | ||||||
| 		foreach ($maps as $map) { | 		foreach ($maps as $map) { | ||||||
| @@ -370,11 +370,11 @@ class MapCommands implements CommandListener, ManialinkPageAnswerListener, Callb | |||||||
| 		} | 		} | ||||||
|  |  | ||||||
| 		if (empty($mapList)) { | 		if (empty($mapList)) { | ||||||
| 			$this->maniaControl->chat->sendError('There are no maps to show!', $player->login); | 			$this->maniaControl->getChat()->sendError('There are no maps to show!', $player->login); | ||||||
| 			return; | 			return; | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
| 		$this->maniaControl->mapManager->getMapList()->showMapList($player, $mapList); | 		$this->maniaControl->getMapManager()->getMapList()->showMapList($player, $mapList); | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	/** | 	/** | ||||||
| @@ -385,7 +385,7 @@ class MapCommands implements CommandListener, ManialinkPageAnswerListener, Callb | |||||||
| 	 */ | 	 */ | ||||||
| 	public function command_List(array $chatCallback, Player $player) { | 	public function command_List(array $chatCallback, Player $player) { | ||||||
| 		$chatCommands = explode(' ', $chatCallback[1][2]); | 		$chatCommands = explode(' ', $chatCallback[1][2]); | ||||||
| 		$this->maniaControl->mapManager->getMapList()->playerCloseWidget($player); | 		$this->maniaControl->getMapManager()->getMapList()->playerCloseWidget($player); | ||||||
|  |  | ||||||
| 		if (isset($chatCommands[1])) { | 		if (isset($chatCommands[1])) { | ||||||
| 			$listParam = strtolower($chatCommands[1]); | 			$listParam = strtolower($chatCommands[1]); | ||||||
| @@ -406,15 +406,15 @@ class MapCommands implements CommandListener, ManialinkPageAnswerListener, Callb | |||||||
| 					if (isset($chatCommands[2])) { | 					if (isset($chatCommands[2])) { | ||||||
| 						$this->showMaplistAuthor($chatCommands[2], $player); | 						$this->showMaplistAuthor($chatCommands[2], $player); | ||||||
| 					} else { | 					} else { | ||||||
| 						$this->maniaControl->chat->sendError('Missing Author Login!', $player->login); | 						$this->maniaControl->getChat()->sendError('Missing Author Login!', $player); | ||||||
| 					} | 					} | ||||||
| 					break; | 					break; | ||||||
| 				default: | 				default: | ||||||
| 					$this->maniaControl->mapManager->getMapList()->showMapList($player); | 					$this->maniaControl->getMapManager()->getMapList()->showMapList($player); | ||||||
| 					break; | 					break; | ||||||
| 			} | 			} | ||||||
| 		} else { | 		} else { | ||||||
| 			$this->maniaControl->mapManager->getMapList()->showMapList($player); | 			$this->maniaControl->getMapManager()->getMapList()->showMapList($player); | ||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| @@ -426,13 +426,13 @@ class MapCommands implements CommandListener, ManialinkPageAnswerListener, Callb | |||||||
| 	 */ | 	 */ | ||||||
| 	private function showMapListKarma($best, Player $player) { | 	private function showMapListKarma($best, Player $player) { | ||||||
| 		/** @var \MCTeam\KarmaPlugin $karmaPlugin */ | 		/** @var \MCTeam\KarmaPlugin $karmaPlugin */ | ||||||
| 		$karmaPlugin = $this->maniaControl->pluginManager->getPlugin(MapList::DEFAULT_KARMA_PLUGIN); | 		$karmaPlugin = $this->maniaControl->getPluginManager()->getPlugin(MapList::DEFAULT_KARMA_PLUGIN); | ||||||
| 		if ($karmaPlugin) { | 		if ($karmaPlugin) { | ||||||
| 			$maps    = $this->maniaControl->mapManager->getMaps(); | 			$maps    = $this->maniaControl->getMapManager()->getMaps(); | ||||||
| 			$mapList = array(); | 			$mapList = array(); | ||||||
| 			foreach ($maps as $map) { | 			foreach ($maps as $map) { | ||||||
| 				if ($map instanceof Map) { | 				if ($map instanceof Map) { | ||||||
| 					if ($this->maniaControl->settingManager->getSettingValue($karmaPlugin, $karmaPlugin::SETTING_NEWKARMA) === true) { | 					if ($this->maniaControl->getSettingManager()->getSettingValue($karmaPlugin, $karmaPlugin::SETTING_NEWKARMA) === true) { | ||||||
| 						$karma      = $karmaPlugin->getMapKarma($map); | 						$karma      = $karmaPlugin->getMapKarma($map); | ||||||
| 						$map->karma = round($karma * 100.); | 						$map->karma = round($karma * 100.); | ||||||
| 					} else { | 					} else { | ||||||
| @@ -463,9 +463,9 @@ class MapCommands implements CommandListener, ManialinkPageAnswerListener, Callb | |||||||
| 				$mapList = array_reverse($mapList); | 				$mapList = array_reverse($mapList); | ||||||
| 			} | 			} | ||||||
|  |  | ||||||
| 			$this->maniaControl->mapManager->getMapList()->showMapList($player, $mapList); | 			$this->maniaControl->getMapManager()->getMapList()->showMapList($player, $mapList); | ||||||
| 		} else { | 		} else { | ||||||
| 			$this->maniaControl->chat->sendError('KarmaPlugin is not enabled!', $player->login); | 			$this->maniaControl->getChat()->sendError('KarmaPlugin is not enabled!', $player->login); | ||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| @@ -476,7 +476,7 @@ class MapCommands implements CommandListener, ManialinkPageAnswerListener, Callb | |||||||
| 	 * @param Player $player | 	 * @param Player $player | ||||||
| 	 */ | 	 */ | ||||||
| 	private function showMapListDate($newest, Player $player) { | 	private function showMapListDate($newest, Player $player) { | ||||||
| 		$maps = $this->maniaControl->mapManager->getMaps(); | 		$maps = $this->maniaControl->getMapManager()->getMaps(); | ||||||
|  |  | ||||||
| 		usort($maps, function (Map $mapA, Map $mapB) { | 		usort($maps, function (Map $mapA, Map $mapB) { | ||||||
| 			return ($mapA->index - $mapB->index); | 			return ($mapA->index - $mapB->index); | ||||||
| @@ -485,7 +485,7 @@ class MapCommands implements CommandListener, ManialinkPageAnswerListener, Callb | |||||||
| 			$maps = array_reverse($maps); | 			$maps = array_reverse($maps); | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
| 		$this->maniaControl->mapManager->getMapList()->showMapList($player, $maps); | 		$this->maniaControl->getMapManager()->getMapList()->showMapList($player, $maps); | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	/** | 	/** | ||||||
| @@ -495,6 +495,6 @@ class MapCommands implements CommandListener, ManialinkPageAnswerListener, Callb | |||||||
| 	 * @param Player $player | 	 * @param Player $player | ||||||
| 	 */ | 	 */ | ||||||
| 	public function command_xList(array $chatCallback, Player $player) { | 	public function command_xList(array $chatCallback, Player $player) { | ||||||
| 		$this->maniaControl->mapManager->getMXList()->showList($chatCallback, $player); | 		$this->maniaControl->getMapManager()->getMXList()->showList($chatCallback, $player); | ||||||
| 	} | 	} | ||||||
| } | } | ||||||
|   | |||||||
| @@ -70,17 +70,17 @@ class MapList implements ManialinkPageAnswerListener, CallbackListener { | |||||||
| 	public function __construct(ManiaControl $maniaControl) { | 	public function __construct(ManiaControl $maniaControl) { | ||||||
| 		$this->maniaControl = $maniaControl; | 		$this->maniaControl = $maniaControl; | ||||||
|  |  | ||||||
| 		// Register for Callbacks | 		// Callbacks | ||||||
| 		$this->maniaControl->callbackManager->registerCallbackListener(ManialinkManager::CB_MAIN_WINDOW_CLOSED, $this, 'closeWidget'); | 		$this->maniaControl->getCallbackManager()->registerCallbackListener(ManialinkManager::CB_MAIN_WINDOW_CLOSED, $this, 'closeWidget'); | ||||||
| 		$this->maniaControl->callbackManager->registerCallbackListener(ManialinkManager::CB_MAIN_WINDOW_OPENED, $this, 'handleWidgetOpened'); | 		$this->maniaControl->getCallbackManager()->registerCallbackListener(ManialinkManager::CB_MAIN_WINDOW_OPENED, $this, 'handleWidgetOpened'); | ||||||
| 		$this->maniaControl->callbackManager->registerCallbackListener(CallbackManager::CB_MP_PLAYERMANIALINKPAGEANSWER, $this, 'handleManialinkPageAnswer'); | 		$this->maniaControl->getCallbackManager()->registerCallbackListener(CallbackManager::CB_MP_PLAYERMANIALINKPAGEANSWER, $this, 'handleManialinkPageAnswer'); | ||||||
| 		$this->maniaControl->callbackManager->registerCallbackListener(MapQueue::CB_MAPQUEUE_CHANGED, $this, 'updateWidget'); | 		$this->maniaControl->getCallbackManager()->registerCallbackListener(MapQueue::CB_MAPQUEUE_CHANGED, $this, 'updateWidget'); | ||||||
| 		$this->maniaControl->callbackManager->registerCallbackListener(MapManager::CB_MAPS_UPDATED, $this, 'updateWidget'); | 		$this->maniaControl->getCallbackManager()->registerCallbackListener(MapManager::CB_MAPS_UPDATED, $this, 'updateWidget'); | ||||||
| 		$this->maniaControl->callbackManager->registerCallbackListener(MapManager::CB_KARMA_UPDATED, $this, 'updateWidget'); | 		$this->maniaControl->getCallbackManager()->registerCallbackListener(MapManager::CB_KARMA_UPDATED, $this, 'updateWidget'); | ||||||
| 		$this->maniaControl->callbackManager->registerCallbackListener(Callbacks::BEGINMAP, $this, 'updateWidget'); | 		$this->maniaControl->getCallbackManager()->registerCallbackListener(Callbacks::BEGINMAP, $this, 'updateWidget'); | ||||||
|  |  | ||||||
| 		$this->maniaControl->manialinkManager->registerManialinkPageAnswerListener(self::ACTION_CHECK_UPDATE, $this, 'checkUpdates'); | 		$this->maniaControl->getManialinkManager()->registerManialinkPageAnswerListener(self::ACTION_CHECK_UPDATE, $this, 'checkUpdates'); | ||||||
| 		$this->maniaControl->manialinkManager->registerManialinkPageAnswerListener(self::ACTION_CLEAR_MAPQUEUE, $this, 'clearMapQueue'); | 		$this->maniaControl->getManialinkManager()->registerManialinkPageAnswerListener(self::ACTION_CLEAR_MAPQUEUE, $this, 'clearMapQueue'); | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	/** | 	/** | ||||||
| @@ -91,7 +91,7 @@ class MapList implements ManialinkPageAnswerListener, CallbackListener { | |||||||
| 	 */ | 	 */ | ||||||
| 	public function clearMapQueue(array $chatCallback, Player $player) { | 	public function clearMapQueue(array $chatCallback, Player $player) { | ||||||
| 		// Clears the Map Queue | 		// Clears the Map Queue | ||||||
| 		$this->maniaControl->mapManager->getMapQueue() | 		$this->maniaControl->getMapManager()->getMapQueue() | ||||||
| 		                               ->clearMapQueue($player); | 		                               ->clearMapQueue($player); | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| @@ -103,7 +103,7 @@ class MapList implements ManialinkPageAnswerListener, CallbackListener { | |||||||
| 	 */ | 	 */ | ||||||
| 	public function checkUpdates(array $chatCallback, Player $player) { | 	public function checkUpdates(array $chatCallback, Player $player) { | ||||||
| 		// Update Mx Infos | 		// Update Mx Infos | ||||||
| 		$this->maniaControl->mapManager->getMXManager()->fetchManiaExchangeMapInformation(); | 		$this->maniaControl->getMapManager()->getMXManager()->fetchManiaExchangeMapInformation(); | ||||||
|  |  | ||||||
| 		// Reshow the Maplist | 		// Reshow the Maplist | ||||||
| 		$this->showMapList($player); | 		$this->showMapList($player); | ||||||
| @@ -117,16 +117,16 @@ class MapList implements ManialinkPageAnswerListener, CallbackListener { | |||||||
| 	 * @param int    $pageIndex | 	 * @param int    $pageIndex | ||||||
| 	 */ | 	 */ | ||||||
| 	public function showMapList(Player $player, $mapList = null, $pageIndex = -1) { | 	public function showMapList(Player $player, $mapList = null, $pageIndex = -1) { | ||||||
| 		$width  = $this->maniaControl->manialinkManager->getStyleManager() | 		$width  = $this->maniaControl->getManialinkManager()->getStyleManager() | ||||||
| 		                                               ->getListWidgetsWidth(); | 		                                               ->getListWidgetsWidth(); | ||||||
| 		$height = $this->maniaControl->manialinkManager->getStyleManager() | 		$height = $this->maniaControl->getManialinkManager()->getStyleManager() | ||||||
| 		                                               ->getListWidgetsHeight(); | 		                                               ->getListWidgetsHeight(); | ||||||
|  |  | ||||||
| 		if ($pageIndex < 0) { | 		if ($pageIndex < 0) { | ||||||
| 			$pageIndex = (int)$player->getCache($this, self::CACHE_CURRENT_PAGE); | 			$pageIndex = (int)$player->getCache($this, self::CACHE_CURRENT_PAGE); | ||||||
| 		} | 		} | ||||||
| 		$player->setCache($this, self::CACHE_CURRENT_PAGE, $pageIndex); | 		$player->setCache($this, self::CACHE_CURRENT_PAGE, $pageIndex); | ||||||
| 		$queueBuffer = $this->maniaControl->mapManager->getMapQueue() | 		$queueBuffer = $this->maniaControl->getMapManager()->getMapQueue() | ||||||
| 		                                              ->getQueueBuffer(); | 		                                              ->getQueueBuffer(); | ||||||
|  |  | ||||||
| 		$chunkIndex     = $this->getChunkIndexFromPageNumber($pageIndex); | 		$chunkIndex     = $this->getChunkIndexFromPageNumber($pageIndex); | ||||||
| @@ -134,11 +134,11 @@ class MapList implements ManialinkPageAnswerListener, CallbackListener { | |||||||
|  |  | ||||||
| 		// Get Maps | 		// Get Maps | ||||||
| 		if (!is_array($mapList)) { | 		if (!is_array($mapList)) { | ||||||
| 			$mapList = $this->maniaControl->mapManager->getMaps(); | 			$mapList = $this->maniaControl->getMapManager()->getMaps(); | ||||||
| 		} | 		} | ||||||
| 		$mapList = array_slice($mapList, $mapsBeginIndex, self::MAX_PAGES_PER_CHUNK * self::MAX_MAPS_PER_PAGE); | 		$mapList = array_slice($mapList, $mapsBeginIndex, self::MAX_PAGES_PER_CHUNK * self::MAX_MAPS_PER_PAGE); | ||||||
|  |  | ||||||
| 		$totalMapsCount = $this->maniaControl->mapManager->getMapsCount(); | 		$totalMapsCount = $this->maniaControl->getMapManager()->getMapsCount(); | ||||||
| 		$pagesCount     = ceil($totalMapsCount / self::MAX_MAPS_PER_PAGE); | 		$pagesCount     = ceil($totalMapsCount / self::MAX_MAPS_PER_PAGE); | ||||||
|  |  | ||||||
| 		// Create ManiaLink | 		// Create ManiaLink | ||||||
| @@ -151,12 +151,12 @@ class MapList implements ManialinkPageAnswerListener, CallbackListener { | |||||||
| 		$paging->setChunkActions(self::ACTION_PAGING_CHUNKS); | 		$paging->setChunkActions(self::ACTION_PAGING_CHUNKS); | ||||||
|  |  | ||||||
| 		// Main frame | 		// Main frame | ||||||
| 		$frame = $this->maniaControl->manialinkManager->getStyleManager() | 		$frame = $this->maniaControl->getManialinkManager()->getStyleManager() | ||||||
| 		                                              ->getDefaultListFrame($script, $paging); | 		                                              ->getDefaultListFrame($script, $paging); | ||||||
| 		$maniaLink->add($frame); | 		$maniaLink->add($frame); | ||||||
|  |  | ||||||
| 		// Admin Buttons | 		// Admin Buttons | ||||||
| 		if ($this->maniaControl->authenticationManager->checkPermission($player, MapQueue::SETTING_PERMISSION_CLEAR_MAPQUEUE)) { | 		if ($this->maniaControl->getAuthenticationManager()->checkPermission($player, MapQueue::SETTING_PERMISSION_CLEAR_MAPQUEUE)) { | ||||||
| 			// Clear Map-Queue | 			// Clear Map-Queue | ||||||
| 			$label = new Label_Button(); | 			$label = new Label_Button(); | ||||||
| 			$frame->add($label); | 			$frame->add($label); | ||||||
| @@ -174,7 +174,7 @@ class MapList implements ManialinkPageAnswerListener, CallbackListener { | |||||||
| 			$quad->setAction(self::ACTION_CLEAR_MAPQUEUE); | 			$quad->setAction(self::ACTION_CLEAR_MAPQUEUE); | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
| 		if ($this->maniaControl->authenticationManager->checkPermission($player, MapManager::SETTING_PERMISSION_CHECK_UPDATE)) { | 		if ($this->maniaControl->getAuthenticationManager()->checkPermission($player, MapManager::SETTING_PERMISSION_CHECK_UPDATE)) { | ||||||
| 			// Check Update | 			// Check Update | ||||||
| 			$label = new Label_Button(); | 			$label = new Label_Button(); | ||||||
| 			$frame->add($label); | 			$frame->add($label); | ||||||
| @@ -194,16 +194,16 @@ class MapList implements ManialinkPageAnswerListener, CallbackListener { | |||||||
| 			$mxQuad = new Quad(); | 			$mxQuad = new Quad(); | ||||||
| 			$frame->add($mxQuad); | 			$frame->add($mxQuad); | ||||||
| 			$mxQuad->setSize(3, 3); | 			$mxQuad->setSize(3, 3); | ||||||
| 			$mxQuad->setImage($this->maniaControl->manialinkManager->getIconManager() | 			$mxQuad->setImage($this->maniaControl->getManialinkManager()->getIconManager() | ||||||
| 			                                                       ->getIcon(IconManager::MX_ICON_GREEN)); | 			                                                       ->getIcon(IconManager::MX_ICON_GREEN)); | ||||||
| 			$mxQuad->setImageFocus($this->maniaControl->manialinkManager->getIconManager() | 			$mxQuad->setImageFocus($this->maniaControl->getManialinkManager()->getIconManager() | ||||||
| 			                                                            ->getIcon(IconManager::MX_ICON_GREEN_MOVER)); | 			                                                            ->getIcon(IconManager::MX_ICON_GREEN_MOVER)); | ||||||
| 			$mxQuad->setPosition($width / 2 - 67, -$height / 2 + 9); | 			$mxQuad->setPosition($width / 2 - 67, -$height / 2 + 9); | ||||||
| 			$mxQuad->setZ(0.01); | 			$mxQuad->setZ(0.01); | ||||||
| 			$mxQuad->setAction(self::ACTION_CHECK_UPDATE); | 			$mxQuad->setAction(self::ACTION_CHECK_UPDATE); | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
| 		if ($this->maniaControl->authenticationManager->checkPermission($player, MapManager::SETTING_PERMISSION_ADD_MAP)) { | 		if ($this->maniaControl->getAuthenticationManager()->checkPermission($player, MapManager::SETTING_PERMISSION_ADD_MAP)) { | ||||||
| 			// Directory browser | 			// Directory browser | ||||||
| 			$browserButton = new Label_Button(); | 			$browserButton = new Label_Button(); | ||||||
| 			$frame->add($browserButton); | 			$frame->add($browserButton); | ||||||
| @@ -225,17 +225,17 @@ class MapList implements ManialinkPageAnswerListener, CallbackListener { | |||||||
| 		$headFrame->setY($height / 2 - 5); | 		$headFrame->setY($height / 2 - 5); | ||||||
| 		$posX  = -$width / 2; | 		$posX  = -$width / 2; | ||||||
| 		$array = array('Id' => $posX + 5, 'Mx Id' => $posX + 10, 'Map Name' => $posX + 20, 'Author' => $posX + 68, 'Karma' => $posX + 115, 'Actions' => $width / 2 - 16); | 		$array = array('Id' => $posX + 5, 'Mx Id' => $posX + 10, 'Map Name' => $posX + 20, 'Author' => $posX + 68, 'Karma' => $posX + 115, 'Actions' => $width / 2 - 16); | ||||||
| 		$this->maniaControl->manialinkManager->labelLine($headFrame, $array); | 		$this->maniaControl->getManialinkManager()->labelLine($headFrame, $array); | ||||||
|  |  | ||||||
| 		// Predefine description Label | 		// Predefine description Label | ||||||
| 		$descriptionLabel = $this->maniaControl->manialinkManager->getStyleManager() | 		$descriptionLabel = $this->maniaControl->getManialinkManager()->getStyleManager() | ||||||
| 		                                                         ->getDefaultDescriptionLabel(); | 		                                                         ->getDefaultDescriptionLabel(); | ||||||
| 		$frame->add($descriptionLabel); | 		$frame->add($descriptionLabel); | ||||||
|  |  | ||||||
| 		$queuedMaps = $this->maniaControl->mapManager->getMapQueue() | 		$queuedMaps = $this->maniaControl->getMapManager()->getMapQueue() | ||||||
| 		                                             ->getQueuedMapsRanking(); | 		                                             ->getQueuedMapsRanking(); | ||||||
| 		/** @var KarmaPlugin $karmaPlugin */ | 		/** @var KarmaPlugin $karmaPlugin */ | ||||||
| 		$karmaPlugin = $this->maniaControl->pluginManager->getPlugin(self::DEFAULT_KARMA_PLUGIN); | 		$karmaPlugin = $this->maniaControl->getPluginManager()->getPlugin(self::DEFAULT_KARMA_PLUGIN); | ||||||
|  |  | ||||||
| 		$pageNumber = 1 + $chunkIndex * self::MAX_PAGES_PER_CHUNK; | 		$pageNumber = 1 + $chunkIndex * self::MAX_PAGES_PER_CHUNK; | ||||||
| 		$paging->setStartPageNumber($pageIndex + 1); | 		$paging->setStartPageNumber($pageIndex + 1); | ||||||
| @@ -245,14 +245,14 @@ class MapList implements ManialinkPageAnswerListener, CallbackListener { | |||||||
| 		$posY      = $height / 2 - 10; | 		$posY      = $height / 2 - 10; | ||||||
| 		$pageFrame = null; | 		$pageFrame = null; | ||||||
|  |  | ||||||
| 		$currentMap       = $this->maniaControl->mapManager->getCurrentMap(); | 		$currentMap       = $this->maniaControl->getMapManager()->getCurrentMap(); | ||||||
| 		$mxIcon           = $this->maniaControl->manialinkManager->getIconManager() | 		$mxIcon           = $this->maniaControl->getManialinkManager()->getIconManager() | ||||||
| 		                                                         ->getIcon(IconManager::MX_ICON); | 		                                                         ->getIcon(IconManager::MX_ICON); | ||||||
| 		$mxIconHover      = $this->maniaControl->manialinkManager->getIconManager() | 		$mxIconHover      = $this->maniaControl->getManialinkManager()->getIconManager() | ||||||
| 		                                                         ->getIcon(IconManager::MX_ICON_MOVER); | 		                                                         ->getIcon(IconManager::MX_ICON_MOVER); | ||||||
| 		$mxIconGreen      = $this->maniaControl->manialinkManager->getIconManager() | 		$mxIconGreen      = $this->maniaControl->getManialinkManager()->getIconManager() | ||||||
| 		                                                         ->getIcon(IconManager::MX_ICON_GREEN); | 		                                                         ->getIcon(IconManager::MX_ICON_GREEN); | ||||||
| 		$mxIconGreenHover = $this->maniaControl->manialinkManager->getIconManager() | 		$mxIconGreenHover = $this->maniaControl->getManialinkManager()->getIconManager() | ||||||
| 		                                                         ->getIcon(IconManager::MX_ICON_GREEN_MOVER); | 		                                                         ->getIcon(IconManager::MX_ICON_GREEN_MOVER); | ||||||
|  |  | ||||||
| 		foreach ($mapList as $map) { | 		foreach ($mapList as $map) { | ||||||
| @@ -300,7 +300,7 @@ class MapList implements ManialinkPageAnswerListener, CallbackListener { | |||||||
| 				$mxQuad->setX($posX + 65); | 				$mxQuad->setX($posX + 65); | ||||||
| 				$mxQuad->setUrl($map->mx->pageurl); | 				$mxQuad->setUrl($map->mx->pageurl); | ||||||
| 				$mxQuad->setZ(0.01); | 				$mxQuad->setZ(0.01); | ||||||
| 				$description = 'View $<' . $map->name . '$> on Mania-Exchange'; | 				$description = 'View ' . $map->getEscapedName() . ' on Mania-Exchange'; | ||||||
| 				$mxQuad->addTooltipLabelFeature($descriptionLabel, $description); | 				$mxQuad->addTooltipLabelFeature($descriptionLabel, $description); | ||||||
|  |  | ||||||
| 				if ($map->updateAvailable()) { | 				if ($map->updateAvailable()) { | ||||||
| @@ -312,11 +312,11 @@ class MapList implements ManialinkPageAnswerListener, CallbackListener { | |||||||
| 					$mxQuad->setX($posX + 62); | 					$mxQuad->setX($posX + 62); | ||||||
| 					$mxQuad->setUrl($map->mx->pageurl); | 					$mxQuad->setUrl($map->mx->pageurl); | ||||||
| 					$mxQuad->setZ(0.01); | 					$mxQuad->setZ(0.01); | ||||||
| 					$description = 'Update for $<' . $map->name . '$> available on Mania-Exchange!'; | 					$description = 'Update for ' . $map->getEscapedName() . ' available on Mania-Exchange!'; | ||||||
| 					$mxQuad->addTooltipLabelFeature($descriptionLabel, $description); | 					$mxQuad->addTooltipLabelFeature($descriptionLabel, $description); | ||||||
|  |  | ||||||
| 					// Update Button | 					// Update Button | ||||||
| 					if ($this->maniaControl->authenticationManager->checkPermission($player, MapManager::SETTING_PERMISSION_ADD_MAP)) { | 					if ($this->maniaControl->getAuthenticationManager()->checkPermission($player, MapManager::SETTING_PERMISSION_ADD_MAP)) { | ||||||
| 						$mxQuad->setAction(self::ACTION_UPDATE_MAP . '.' . $map->uid); | 						$mxQuad->setAction(self::ACTION_UPDATE_MAP . '.' . $map->uid); | ||||||
| 					} | 					} | ||||||
| 				} | 				} | ||||||
| @@ -324,7 +324,7 @@ class MapList implements ManialinkPageAnswerListener, CallbackListener { | |||||||
|  |  | ||||||
| 			// Display Maps | 			// Display Maps | ||||||
| 			$array  = array($mapListId => $posX + 5, $mxId => $posX + 10, Formatter::stripDirtyCodes($map->name) => $posX + 20, $map->authorNick => $posX + 68); | 			$array  = array($mapListId => $posX + 5, $mxId => $posX + 10, Formatter::stripDirtyCodes($map->name) => $posX + 20, $map->authorNick => $posX + 68); | ||||||
| 			$labels = $this->maniaControl->manialinkManager->labelLine($mapFrame, $array); | 			$labels = $this->maniaControl->getManialinkManager()->labelLine($mapFrame, $array); | ||||||
| 			if (isset($labels[3])) { | 			if (isset($labels[3])) { | ||||||
| 				/** @var Label $label */ | 				/** @var Label $label */ | ||||||
| 				$label       = $labels[3]; | 				$label       = $labels[3]; | ||||||
| @@ -346,14 +346,14 @@ class MapList implements ManialinkPageAnswerListener, CallbackListener { | |||||||
| 				$label->setTextColor('fff'); | 				$label->setTextColor('fff'); | ||||||
|  |  | ||||||
| 				// Checks if the Player who opened the Widget has queued the map | 				// Checks if the Player who opened the Widget has queued the map | ||||||
| 				$queuer = $this->maniaControl->mapManager->getMapQueue() | 				$queuer = $this->maniaControl->getMapManager()->getMapQueue() | ||||||
| 				                                         ->getQueuer($map->uid); | 				                                         ->getQueuer($map->uid); | ||||||
| 				if ($queuer->login == $player->login) { | 				if ($queuer->login == $player->login) { | ||||||
| 					$description = 'Remove $<' . $map->name . '$> from the Map Queue'; | 					$description = 'Remove ' . $map->getEscapedName() . ' from the Map Queue'; | ||||||
| 					$label->addTooltipLabelFeature($descriptionLabel, $description); | 					$label->addTooltipLabelFeature($descriptionLabel, $description); | ||||||
| 					$label->setAction(self::ACTION_UNQUEUE_MAP . '.' . $map->uid); | 					$label->setAction(self::ACTION_UNQUEUE_MAP . '.' . $map->uid); | ||||||
| 				} else { | 				} else { | ||||||
| 					$description = '$<' . $map->name . '$> is on Map-Queue Position: ' . $queuedMaps[$map->uid]; | 					$description = $map->getEscapedName() . ' is on Map-Queue Position: ' . $queuedMaps[$map->uid]; | ||||||
| 					$label->addTooltipLabelFeature($descriptionLabel, $description); | 					$label->addTooltipLabelFeature($descriptionLabel, $description); | ||||||
| 				} | 				} | ||||||
| 			} else { | 			} else { | ||||||
| @@ -366,21 +366,21 @@ class MapList implements ManialinkPageAnswerListener, CallbackListener { | |||||||
| 				$queueLabel->setText('+'); | 				$queueLabel->setText('+'); | ||||||
|  |  | ||||||
| 				if (in_array($map->uid, $queueBuffer)) { | 				if (in_array($map->uid, $queueBuffer)) { | ||||||
| 					if ($this->maniaControl->authenticationManager->checkPermission($player, MapQueue::SETTING_PERMISSION_CLEAR_MAPQUEUE)) { | 					if ($this->maniaControl->getAuthenticationManager()->checkPermission($player, MapQueue::SETTING_PERMISSION_CLEAR_MAPQUEUE)) { | ||||||
| 						$queueLabel->setAction(self::ACTION_QUEUED_MAP . '.' . $map->uid); | 						$queueLabel->setAction(self::ACTION_QUEUED_MAP . '.' . $map->uid); | ||||||
| 					} | 					} | ||||||
| 					$queueLabel->setTextColor('f00'); | 					$queueLabel->setTextColor('f00'); | ||||||
| 					$description = '$<' . $map->name . '$> has recently been played!'; | 					$description = $map->getEscapedName() . ' has recently been played!'; | ||||||
| 					$queueLabel->addTooltipLabelFeature($descriptionLabel, $description); | 					$queueLabel->addTooltipLabelFeature($descriptionLabel, $description); | ||||||
| 				} else { | 				} else { | ||||||
| 					$queueLabel->setTextColor('09f'); | 					$queueLabel->setTextColor('09f'); | ||||||
| 					$queueLabel->setAction(self::ACTION_QUEUED_MAP . '.' . $map->uid); | 					$queueLabel->setAction(self::ACTION_QUEUED_MAP . '.' . $map->uid); | ||||||
| 					$description = 'Add $<' . $map->name . '$> to the Map Queue'; | 					$description = 'Add ' . $map->getEscapedName() . ' to the Map Queue'; | ||||||
| 					$queueLabel->addTooltipLabelFeature($descriptionLabel, $description); | 					$queueLabel->addTooltipLabelFeature($descriptionLabel, $description); | ||||||
| 				} | 				} | ||||||
| 			} | 			} | ||||||
|  |  | ||||||
| 			if ($this->maniaControl->authenticationManager->checkPermission($player, MapManager::SETTING_PERMISSION_REMOVE_MAP)) { | 			if ($this->maniaControl->getAuthenticationManager()->checkPermission($player, MapManager::SETTING_PERMISSION_REMOVE_MAP)) { | ||||||
| 				// remove map button | 				// remove map button | ||||||
| 				$removeButton = new Label_Button(); | 				$removeButton = new Label_Button(); | ||||||
| 				$mapFrame->add($removeButton); | 				$mapFrame->add($removeButton); | ||||||
| @@ -393,11 +393,11 @@ class MapList implements ManialinkPageAnswerListener, CallbackListener { | |||||||
|  |  | ||||||
| 				$confirmFrame = $this->buildConfirmFrame($maniaLink, $posY, $map->uid, true); | 				$confirmFrame = $this->buildConfirmFrame($maniaLink, $posY, $map->uid, true); | ||||||
| 				$removeButton->addToggleFeature($confirmFrame); | 				$removeButton->addToggleFeature($confirmFrame); | ||||||
| 				$description = 'Remove Map: $<' . $map->name . '$>'; | 				$description = 'Remove Map: ' . $map->getEscapedName(); | ||||||
| 				$removeButton->addTooltipLabelFeature($descriptionLabel, $description); | 				$removeButton->addTooltipLabelFeature($descriptionLabel, $description); | ||||||
| 			} | 			} | ||||||
|  |  | ||||||
| 			if ($this->maniaControl->authenticationManager->checkPermission($player, MapManager::SETTING_PERMISSION_ADD_MAP)) { | 			if ($this->maniaControl->getAuthenticationManager()->checkPermission($player, MapManager::SETTING_PERMISSION_ADD_MAP)) { | ||||||
| 				// Switch to button | 				// Switch to button | ||||||
| 				$switchLabel = new Label_Button(); | 				$switchLabel = new Label_Button(); | ||||||
| 				$mapFrame->add($switchLabel); | 				$mapFrame->add($switchLabel); | ||||||
| @@ -411,11 +411,11 @@ class MapList implements ManialinkPageAnswerListener, CallbackListener { | |||||||
| 				$confirmFrame = $this->buildConfirmFrame($maniaLink, $posY, $map->uid); | 				$confirmFrame = $this->buildConfirmFrame($maniaLink, $posY, $map->uid); | ||||||
| 				$switchLabel->addToggleFeature($confirmFrame); | 				$switchLabel->addToggleFeature($confirmFrame); | ||||||
|  |  | ||||||
| 				$description = 'Switch Directly to Map: $<' . $map->name . '$>'; | 				$description = 'Switch Directly to Map: ' . $map->getEscapedName(); | ||||||
| 				$switchLabel->addTooltipLabelFeature($descriptionLabel, $description); | 				$switchLabel->addTooltipLabelFeature($descriptionLabel, $description); | ||||||
| 			} | 			} | ||||||
| 			if ($this->maniaControl->pluginManager->isPluginActive(self::DEFAULT_CUSTOM_VOTE_PLUGIN)) { | 			if ($this->maniaControl->getPluginManager()->isPluginActive(self::DEFAULT_CUSTOM_VOTE_PLUGIN)) { | ||||||
| 				if ($this->maniaControl->authenticationManager->checkPermission($player, MapManager::SETTING_PERMISSION_ADD_MAP)) { | 				if ($this->maniaControl->getAuthenticationManager()->checkPermission($player, MapManager::SETTING_PERMISSION_ADD_MAP)) { | ||||||
| 					// Switch Map Voting for Admins | 					// Switch Map Voting for Admins | ||||||
| 					$switchQuad = new Quad_UIConstruction_Buttons(); | 					$switchQuad = new Quad_UIConstruction_Buttons(); | ||||||
| 					$mapFrame->add($switchQuad); | 					$mapFrame->add($switchQuad); | ||||||
| @@ -447,7 +447,7 @@ class MapList implements ManialinkPageAnswerListener, CallbackListener { | |||||||
| 				$karma = $karmaPlugin->getMapKarma($map); | 				$karma = $karmaPlugin->getMapKarma($map); | ||||||
| 				$votes = $karmaPlugin->getMapVotes($map); | 				$votes = $karmaPlugin->getMapVotes($map); | ||||||
| 				if (is_numeric($karma)) { | 				if (is_numeric($karma)) { | ||||||
| 					if ($this->maniaControl->settingManager->getSettingValue($karmaPlugin, $karmaPlugin::SETTING_NEWKARMA)) { | 					if ($this->maniaControl->getSettingManager()->getSettingValue($karmaPlugin, $karmaPlugin::SETTING_NEWKARMA)) { | ||||||
| 						$karmaText = '  ' . round($karma * 100.) . '% (' . $votes['count'] . ')'; | 						$karmaText = '  ' . round($karma * 100.) . '% (' . $votes['count'] . ')'; | ||||||
| 					} else { | 					} else { | ||||||
| 						$min  = 0; | 						$min  = 0; | ||||||
| @@ -494,7 +494,7 @@ class MapList implements ManialinkPageAnswerListener, CallbackListener { | |||||||
| 			$index++; | 			$index++; | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
| 		$this->maniaControl->manialinkManager->displayWidget($maniaLink, $player, self::WIDGET_NAME); | 		$this->maniaControl->getManialinkManager()->displayWidget($maniaLink, $player, self::WIDGET_NAME); | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	/** | 	/** | ||||||
| @@ -504,7 +504,7 @@ class MapList implements ManialinkPageAnswerListener, CallbackListener { | |||||||
| 	 * @return int | 	 * @return int | ||||||
| 	 */ | 	 */ | ||||||
| 	private function getChunkIndexFromPageNumber($pageIndex) { | 	private function getChunkIndexFromPageNumber($pageIndex) { | ||||||
| 		$mapsCount  = $this->maniaControl->mapManager->getMapsCount(); | 		$mapsCount  = $this->maniaControl->getMapManager()->getMapsCount(); | ||||||
| 		$pagesCount = ceil($mapsCount / self::MAX_MAPS_PER_PAGE); | 		$pagesCount = ceil($mapsCount / self::MAX_MAPS_PER_PAGE); | ||||||
| 		if ($pageIndex > $pagesCount - 1) { | 		if ($pageIndex > $pagesCount - 1) { | ||||||
| 			$pageIndex = $pagesCount - 1; | 			$pageIndex = $pagesCount - 1; | ||||||
| @@ -535,11 +535,11 @@ class MapList implements ManialinkPageAnswerListener, CallbackListener { | |||||||
| 		// TODO: get rid of the confirm frame to decrease xml size & network usage | 		// TODO: get rid of the confirm frame to decrease xml size & network usage | ||||||
| 		// SUGGESTION: just send them as own manialink again on clicking? | 		// SUGGESTION: just send them as own manialink again on clicking? | ||||||
|  |  | ||||||
| 		$width        = $this->maniaControl->manialinkManager->getStyleManager() | 		$width        = $this->maniaControl->getManialinkManager()->getStyleManager() | ||||||
| 		                                                     ->getListWidgetsWidth(); | 		                                                     ->getListWidgetsWidth(); | ||||||
| 		$quadStyle    = $this->maniaControl->manialinkManager->getStyleManager() | 		$quadStyle    = $this->maniaControl->getManialinkManager()->getStyleManager() | ||||||
| 		                                                     ->getDefaultMainWindowStyle(); | 		                                                     ->getDefaultMainWindowStyle(); | ||||||
| 		$quadSubstyle = $this->maniaControl->manialinkManager->getStyleManager() | 		$quadSubstyle = $this->maniaControl->getManialinkManager()->getStyleManager() | ||||||
| 		                                                     ->getDefaultMainWindowSubStyle(); | 		                                                     ->getDefaultMainWindowSubStyle(); | ||||||
|  |  | ||||||
| 		$confirmFrame = new Frame(); | 		$confirmFrame = new Frame(); | ||||||
| @@ -620,57 +620,57 @@ class MapList implements ManialinkPageAnswerListener, CallbackListener { | |||||||
|  |  | ||||||
| 		$action = $actionArray[0] . '.' . $actionArray[1]; | 		$action = $actionArray[0] . '.' . $actionArray[1]; | ||||||
| 		$login  = $callback[1][1]; | 		$login  = $callback[1][1]; | ||||||
| 		$player = $this->maniaControl->playerManager->getPlayer($login); | 		$player = $this->maniaControl->getPlayerManager()->getPlayer($login); | ||||||
| 		$mapUid = $actionArray[2]; | 		$mapUid = $actionArray[2]; | ||||||
|  |  | ||||||
| 		switch ($action) { | 		switch ($action) { | ||||||
| 			case self::ACTION_UPDATE_MAP: | 			case self::ACTION_UPDATE_MAP: | ||||||
| 				$this->maniaControl->mapManager->updateMap($player, $mapUid); | 				$this->maniaControl->getMapManager()->updateMap($player, $mapUid); | ||||||
| 				$this->showMapList($player); | 				$this->showMapList($player); | ||||||
| 				break; | 				break; | ||||||
| 			case self::ACTION_REMOVE_MAP: | 			case self::ACTION_REMOVE_MAP: | ||||||
| 				$this->maniaControl->mapManager->removeMap($player, $mapUid); | 				$this->maniaControl->getMapManager()->removeMap($player, $mapUid); | ||||||
| 				break; | 				break; | ||||||
| 			case self::ACTION_SWITCH_MAP: | 			case self::ACTION_SWITCH_MAP: | ||||||
| 				// Don't queue on Map-Change | 				// Don't queue on Map-Change | ||||||
| 				$this->maniaControl->mapManager->getMapQueue()->dontQueueNextMapChange(); | 				$this->maniaControl->getMapManager()->getMapQueue()->dontQueueNextMapChange(); | ||||||
| 				try { | 				try { | ||||||
| 					$this->maniaControl->client->jumpToMapIdent($mapUid); | 					$this->maniaControl->getClient()->jumpToMapIdent($mapUid); | ||||||
| 				} catch (NextMapException $exception) { | 				} catch (NextMapException $exception) { | ||||||
| 					$this->maniaControl->chat->sendError('Error on Jumping to Map Ident: ' . $exception->getMessage(), $player); | 					$this->maniaControl->getChat()->sendError('Error on Jumping to Map Ident: ' . $exception->getMessage(), $player); | ||||||
| 					break; | 					break; | ||||||
| 				} catch (NotInListException $exception) { | 				} catch (NotInListException $exception) { | ||||||
| 					// TODO: "Map not found." -> how is that possible? | 					// TODO: "Map not found." -> how is that possible? | ||||||
| 					$this->maniaControl->chat->sendError('Error on Jumping to Map Ident: ' . $exception->getMessage(), $player); | 					$this->maniaControl->getChat()->sendError('Error on Jumping to Map Ident: ' . $exception->getMessage(), $player); | ||||||
| 					break; | 					break; | ||||||
| 				} | 				} | ||||||
|  |  | ||||||
| 				$map = $this->maniaControl->mapManager->getMapByUid($mapUid); | 				$map = $this->maniaControl->getMapManager()->getMapByUid($mapUid); | ||||||
|  |  | ||||||
| 				$message = $player->getEscapedNickname() . ' skipped to Map $z' . $map->getEscapedName() . '!'; | 				$message = $player->getEscapedNickname() . ' skipped to Map $z' . $map->getEscapedName() . '!'; | ||||||
| 				$this->maniaControl->chat->sendSuccess($message); | 				$this->maniaControl->getChat()->sendSuccess($message); | ||||||
| 				$this->maniaControl->log($message, true); | 				$this->maniaControl->log($message, true); | ||||||
|  |  | ||||||
| 				$this->playerCloseWidget($player); | 				$this->playerCloseWidget($player); | ||||||
| 				break; | 				break; | ||||||
| 			case self::ACTION_START_SWITCH_VOTE: | 			case self::ACTION_START_SWITCH_VOTE: | ||||||
| 				/** @var CustomVotesPlugin $votesPlugin */ | 				/** @var CustomVotesPlugin $votesPlugin */ | ||||||
| 				$votesPlugin = $this->maniaControl->pluginManager->getPlugin(self::DEFAULT_CUSTOM_VOTE_PLUGIN); | 				$votesPlugin = $this->maniaControl->getPluginManager()->getPlugin(self::DEFAULT_CUSTOM_VOTE_PLUGIN); | ||||||
| 				$map         = $this->maniaControl->mapManager->getMapByUid($mapUid); | 				$map         = $this->maniaControl->getMapManager()->getMapByUid($mapUid); | ||||||
|  |  | ||||||
| 				$message = $player->getEscapedNickname() . '$s started a vote to switch to ' . $map->getEscapedName() . '!'; | 				$message = $player->getEscapedNickname() . '$s started a vote to switch to ' . $map->getEscapedName() . '!'; | ||||||
|  |  | ||||||
| 				$votesPlugin->defineVote('switchmap', "Goto " . $map->name, true, $message) | 				$votesPlugin->defineVote('switchmap', 'Goto ' . $map->name, true, $message) | ||||||
| 				            ->setStopCallback(Callbacks::ENDMAP); | 				            ->setStopCallback(Callbacks::ENDMAP); | ||||||
|  |  | ||||||
| 				$votesPlugin->startVote($player, 'switchmap', function ($result) use (&$votesPlugin, &$map) { | 				$votesPlugin->startVote($player, 'switchmap', function ($result) use (&$votesPlugin, &$map) { | ||||||
| 					$votesPlugin->undefineVote('switchmap'); | 					$votesPlugin->undefineVote('switchmap'); | ||||||
|  |  | ||||||
| 					//Don't queue on Map-Change | 					//Don't queue on Map-Change | ||||||
| 					$this->maniaControl->mapManager->getMapQueue()->dontQueueNextMapChange(); | 					$this->maniaControl->getMapManager()->getMapQueue()->dontQueueNextMapChange(); | ||||||
|  |  | ||||||
| 					try { | 					try { | ||||||
| 						$this->maniaControl->client->JumpToMapIdent($map->uid); | 						$this->maniaControl->getClient()->JumpToMapIdent($map->uid); | ||||||
| 					} catch (NextMapException $exception) { | 					} catch (NextMapException $exception) { | ||||||
| 						return; | 						return; | ||||||
| 					} catch (NotInListException $exception) { | 					} catch (NotInListException $exception) { | ||||||
| @@ -680,16 +680,16 @@ class MapList implements ManialinkPageAnswerListener, CallbackListener { | |||||||
| 						return; | 						return; | ||||||
| 					} | 					} | ||||||
|  |  | ||||||
| 					$this->maniaControl->chat->sendInformation('$sVote Successful -> Map switched!'); | 					$this->maniaControl->getChat()->sendInformation('$sVote Successful -> Map switched!'); | ||||||
| 				}); | 				}); | ||||||
| 				break; | 				break; | ||||||
| 			case self::ACTION_QUEUED_MAP: | 			case self::ACTION_QUEUED_MAP: | ||||||
| 				$this->maniaControl->mapManager->getMapQueue() | 				$this->maniaControl->getMapManager()->getMapQueue() | ||||||
| 				                               ->addMapToMapQueue($callback[1][1], $mapUid); | 				                               ->addMapToMapQueue($callback[1][1], $mapUid); | ||||||
| 				$this->showMapList($player); | 				$this->showMapList($player); | ||||||
| 				break; | 				break; | ||||||
| 			case self::ACTION_UNQUEUE_MAP: | 			case self::ACTION_UNQUEUE_MAP: | ||||||
| 				$this->maniaControl->mapManager->getMapQueue() | 				$this->maniaControl->getMapManager()->getMapQueue() | ||||||
| 				                               ->removeFromMapQueue($player, $mapUid); | 				                               ->removeFromMapQueue($player, $mapUid); | ||||||
| 				$this->showMapList($player); | 				$this->showMapList($player); | ||||||
| 				break; | 				break; | ||||||
| @@ -710,14 +710,14 @@ class MapList implements ManialinkPageAnswerListener, CallbackListener { | |||||||
| 	 */ | 	 */ | ||||||
| 	public function playerCloseWidget(Player $player) { | 	public function playerCloseWidget(Player $player) { | ||||||
| 		$player->destroyCache($this, self::CACHE_CURRENT_PAGE); | 		$player->destroyCache($this, self::CACHE_CURRENT_PAGE); | ||||||
| 		$this->maniaControl->manialinkManager->closeWidget($player); | 		$this->maniaControl->getManialinkManager()->closeWidget($player); | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	/** | 	/** | ||||||
| 	 * Reopen the widget on Map Begin, MapListChanged, etc. | 	 * Reopen the widget on Map Begin, MapListChanged, etc. | ||||||
| 	 */ | 	 */ | ||||||
| 	public function updateWidget() { | 	public function updateWidget() { | ||||||
| 		$players = $this->maniaControl->playerManager->getPlayers(); | 		$players = $this->maniaControl->getPlayerManager()->getPlayers(); | ||||||
| 		foreach ($players as $player) { | 		foreach ($players as $player) { | ||||||
| 			$currentPage = $player->getCache($this, self::CACHE_CURRENT_PAGE); | 			$currentPage = $player->getCache($this, self::CACHE_CURRENT_PAGE); | ||||||
| 			if ($currentPage !== null) { | 			if ($currentPage !== null) { | ||||||
|   | |||||||
| @@ -103,23 +103,23 @@ class MapManager implements CallbackListener { | |||||||
| 		$this->mapActions       = new MapActions($maniaControl); | 		$this->mapActions       = new MapActions($maniaControl); | ||||||
|  |  | ||||||
| 		// Callbacks | 		// Callbacks | ||||||
| 		$this->maniaControl->callbackManager->registerCallbackListener(Callbacks::ONINIT, $this, 'handleOnInit'); | 		$this->maniaControl->getCallbackManager()->registerCallbackListener(Callbacks::ONINIT, $this, 'handleOnInit'); | ||||||
| 		$this->maniaControl->callbackManager->registerCallbackListener(Callbacks::AFTERINIT, $this, 'handleAfterInit'); | 		$this->maniaControl->getCallbackManager()->registerCallbackListener(Callbacks::AFTERINIT, $this, 'handleAfterInit'); | ||||||
| 		$this->maniaControl->callbackManager->registerCallbackListener(CallbackManager::CB_MP_MAPLISTMODIFIED, $this, 'mapsModified'); | 		$this->maniaControl->getCallbackManager()->registerCallbackListener(CallbackManager::CB_MP_MAPLISTMODIFIED, $this, 'mapsModified'); | ||||||
|  |  | ||||||
| 		// Permissions | 		// Permissions | ||||||
| 		$this->maniaControl->authenticationManager->definePermissionLevel(self::SETTING_PERMISSION_ADD_MAP, AuthenticationManager::AUTH_LEVEL_ADMIN); | 		$this->maniaControl->getAuthenticationManager()->definePermissionLevel(self::SETTING_PERMISSION_ADD_MAP, AuthenticationManager::AUTH_LEVEL_ADMIN); | ||||||
| 		$this->maniaControl->authenticationManager->definePermissionLevel(self::SETTING_PERMISSION_REMOVE_MAP, AuthenticationManager::AUTH_LEVEL_ADMIN); | 		$this->maniaControl->getAuthenticationManager()->definePermissionLevel(self::SETTING_PERMISSION_REMOVE_MAP, AuthenticationManager::AUTH_LEVEL_ADMIN); | ||||||
| 		$this->maniaControl->authenticationManager->definePermissionLevel(self::SETTING_PERMISSION_ERASE_MAP, AuthenticationManager::AUTH_LEVEL_SUPERADMIN); | 		$this->maniaControl->getAuthenticationManager()->definePermissionLevel(self::SETTING_PERMISSION_ERASE_MAP, AuthenticationManager::AUTH_LEVEL_SUPERADMIN); | ||||||
| 		$this->maniaControl->authenticationManager->definePermissionLevel(self::SETTING_PERMISSION_SHUFFLE_MAPS, AuthenticationManager::AUTH_LEVEL_ADMIN); | 		$this->maniaControl->getAuthenticationManager()->definePermissionLevel(self::SETTING_PERMISSION_SHUFFLE_MAPS, AuthenticationManager::AUTH_LEVEL_ADMIN); | ||||||
| 		$this->maniaControl->authenticationManager->definePermissionLevel(self::SETTING_PERMISSION_CHECK_UPDATE, AuthenticationManager::AUTH_LEVEL_MODERATOR); | 		$this->maniaControl->getAuthenticationManager()->definePermissionLevel(self::SETTING_PERMISSION_CHECK_UPDATE, AuthenticationManager::AUTH_LEVEL_MODERATOR); | ||||||
| 		$this->maniaControl->authenticationManager->definePermissionLevel(self::SETTING_PERMISSION_SKIP_MAP, AuthenticationManager::AUTH_LEVEL_MODERATOR); | 		$this->maniaControl->getAuthenticationManager()->definePermissionLevel(self::SETTING_PERMISSION_SKIP_MAP, AuthenticationManager::AUTH_LEVEL_MODERATOR); | ||||||
| 		$this->maniaControl->authenticationManager->definePermissionLevel(self::SETTING_PERMISSION_RESTART_MAP, AuthenticationManager::AUTH_LEVEL_MODERATOR); | 		$this->maniaControl->getAuthenticationManager()->definePermissionLevel(self::SETTING_PERMISSION_RESTART_MAP, AuthenticationManager::AUTH_LEVEL_MODERATOR); | ||||||
|  |  | ||||||
| 		// Settings | 		// Settings | ||||||
| 		$this->maniaControl->settingManager->initSetting($this, self::SETTING_AUTOSAVE_MAPLIST, true); | 		$this->maniaControl->getSettingManager()->initSetting($this, self::SETTING_AUTOSAVE_MAPLIST, true); | ||||||
| 		$this->maniaControl->settingManager->initSetting($this, self::SETTING_MAPLIST_FILE, "MatchSettings/tracklist.txt"); | 		$this->maniaControl->getSettingManager()->initSetting($this, self::SETTING_MAPLIST_FILE, "MatchSettings/tracklist.txt"); | ||||||
| 		$this->maniaControl->settingManager->initSetting($this, self::SETTING_WRITE_OWN_MAPLIST_FILE, false); | 		$this->maniaControl->getSettingManager()->initSetting($this, self::SETTING_WRITE_OWN_MAPLIST_FILE, false); | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	/** | 	/** | ||||||
| @@ -128,7 +128,7 @@ class MapManager implements CallbackListener { | |||||||
| 	 * @return bool | 	 * @return bool | ||||||
| 	 */ | 	 */ | ||||||
| 	private function initTables() { | 	private function initTables() { | ||||||
| 		$mysqli = $this->maniaControl->database->mysqli; | 		$mysqli = $this->maniaControl->getDatabase()->getMysqli(); | ||||||
| 		$query  = "CREATE TABLE IF NOT EXISTS `" . self::TABLE_MAPS . "` ( | 		$query  = "CREATE TABLE IF NOT EXISTS `" . self::TABLE_MAPS . "` ( | ||||||
| 				`index` int(11) NOT NULL AUTO_INCREMENT, | 				`index` int(11) NOT NULL AUTO_INCREMENT, | ||||||
| 				`mxid` int(11), | 				`mxid` int(11), | ||||||
| @@ -224,7 +224,7 @@ class MapManager implements CallbackListener { | |||||||
|  |  | ||||||
| 		if (!isset($uid) || !isset($this->maps[$uid])) { | 		if (!isset($uid) || !isset($this->maps[$uid])) { | ||||||
| 			trigger_error("Error while updating Map, unknown UID: " . $uid); | 			trigger_error("Error while updating Map, unknown UID: " . $uid); | ||||||
| 			$this->maniaControl->chat->sendError("Error while updating Map.", $admin->login); | 			$this->maniaControl->getChat()->sendError("Error while updating Map.", $admin); | ||||||
| 			return; | 			return; | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
| @@ -243,7 +243,7 @@ class MapManager implements CallbackListener { | |||||||
| 	 * @return bool | 	 * @return bool | ||||||
| 	 */ | 	 */ | ||||||
| 	private function updateMapTimestamp($uid) { | 	private function updateMapTimestamp($uid) { | ||||||
| 		$mysqli       = $this->maniaControl->database->mysqli; | 		$mysqli       = $this->maniaControl->getDatabase()->getMysqli(); | ||||||
| 		$mapQuery     = "UPDATE `" . self::TABLE_MAPS . "` SET | 		$mapQuery     = "UPDATE `" . self::TABLE_MAPS . "` SET | ||||||
| 				mxid = 0, | 				mxid = 0, | ||||||
| 				changed = NOW() | 				changed = NOW() | ||||||
| @@ -274,7 +274,7 @@ class MapManager implements CallbackListener { | |||||||
| 	 */ | 	 */ | ||||||
| 	public function removeMap(Player $admin, $uid, $eraseFile = false, $message = true) { | 	public function removeMap(Player $admin, $uid, $eraseFile = false, $message = true) { | ||||||
| 		if (!isset($this->maps[$uid])) { | 		if (!isset($this->maps[$uid])) { | ||||||
| 			$this->maniaControl->chat->sendError("Map does not exist!", $admin); | 			$this->maniaControl->getChat()->sendError('Map does not exist!', $admin); | ||||||
| 			return; | 			return; | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
| @@ -290,7 +290,7 @@ class MapManager implements CallbackListener { | |||||||
|  |  | ||||||
| 		// Remove map | 		// Remove map | ||||||
| 		try { | 		try { | ||||||
| 			$this->maniaControl->client->removeMap($map->fileName); | 			$this->maniaControl->getClient()->removeMap($map->fileName); | ||||||
| 		} catch (NotInListException $e) { | 		} catch (NotInListException $e) { | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
| @@ -298,15 +298,15 @@ class MapManager implements CallbackListener { | |||||||
|  |  | ||||||
| 		if ($eraseFile) { | 		if ($eraseFile) { | ||||||
| 			// Check if ManiaControl can even write to the maps dir | 			// Check if ManiaControl can even write to the maps dir | ||||||
| 			$mapDir = $this->maniaControl->client->getMapsDirectory(); | 			$mapDir = $this->maniaControl->getClient()->getMapsDirectory(); | ||||||
| 			if ($this->maniaControl->server->checkAccess($mapDir)) { | 			if ($this->maniaControl->getServer()->checkAccess($mapDir)) { | ||||||
| 				// Delete map file | 				// Delete map file | ||||||
| 				if (!@unlink($mapDir . $map->fileName)) { | 				if (!@unlink($mapDir . $map->fileName)) { | ||||||
| 					$this->maniaControl->chat->sendError("Couldn't erase the map file.", $admin); | 					$this->maniaControl->getChat()->sendError("Couldn't erase the map file.", $admin); | ||||||
| 					$eraseFile = false; | 					$eraseFile = false; | ||||||
| 				} | 				} | ||||||
| 			} else { | 			} else { | ||||||
| 				$this->maniaControl->chat->sendError("Couldn't erase the map file (no access).", $admin); | 				$this->maniaControl->getChat()->sendError("Couldn't erase the map file (no access).", $admin); | ||||||
| 				$eraseFile = false; | 				$eraseFile = false; | ||||||
| 			} | 			} | ||||||
| 		} | 		} | ||||||
| @@ -315,7 +315,7 @@ class MapManager implements CallbackListener { | |||||||
| 		if ($message) { | 		if ($message) { | ||||||
| 			$action  = ($eraseFile ? 'erased' : 'removed'); | 			$action  = ($eraseFile ? 'erased' : 'removed'); | ||||||
| 			$message = $admin->getEscapedNickname() . ' ' . $action . ' ' . $map->getEscapedName() . '!'; | 			$message = $admin->getEscapedNickname() . ' ' . $action . ' ' . $map->getEscapedName() . '!'; | ||||||
| 			$this->maniaControl->chat->sendSuccess($message); | 			$this->maniaControl->getChat()->sendSuccess($message); | ||||||
| 			$this->maniaControl->log($message, true); | 			$this->maniaControl->log($message, true); | ||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
| @@ -330,22 +330,22 @@ class MapManager implements CallbackListener { | |||||||
| 	public function addMapFromMx($mapId, $login, $update = false) { | 	public function addMapFromMx($mapId, $login, $update = false) { | ||||||
| 		if (is_numeric($mapId)) { | 		if (is_numeric($mapId)) { | ||||||
| 			// Check if map exists | 			// Check if map exists | ||||||
| 			$this->maniaControl->mapManager->getMXManager()->fetchMapInfo($mapId, function (MXMapInfo $mapInfo = null) use ( | 			$this->maniaControl->getMapManager()->getMXManager()->fetchMapInfo($mapId, function (MXMapInfo $mapInfo = null) use ( | ||||||
| 				&$login, &$update | 				&$login, &$update | ||||||
| 			) { | 			) { | ||||||
| 				if (!$mapInfo || !isset($mapInfo->uploaded)) { | 				if (!$mapInfo || !isset($mapInfo->uploaded)) { | ||||||
| 					// Invalid id | 					// Invalid id | ||||||
| 					$this->maniaControl->chat->sendError('Invalid MX-Id!', $login); | 					$this->maniaControl->getChat()->sendError('Invalid MX-Id!', $login); | ||||||
| 					return; | 					return; | ||||||
| 				} | 				} | ||||||
|  |  | ||||||
| 				// Download the file | 				// Download the file | ||||||
| 				$this->maniaControl->fileReader->loadFile($mapInfo->downloadurl, function ($file, $error) use ( | 				$this->maniaControl->getFileReader()->loadFile($mapInfo->downloadurl, function ($file, $error) use ( | ||||||
| 					&$login, &$mapInfo, &$update | 					&$login, &$mapInfo, &$update | ||||||
| 				) { | 				) { | ||||||
| 					if (!$file || $error) { | 					if (!$file || $error) { | ||||||
| 						// Download error | 						// Download error | ||||||
| 						$this->maniaControl->chat->sendError("Download failed: '{$error}'!", $login); | 						$this->maniaControl->getChat()->sendError("Download failed: '{$error}'!", $login); | ||||||
| 						return; | 						return; | ||||||
| 					} | 					} | ||||||
| 					$this->processMapFile($file, $mapInfo, $login, $update); | 					$this->processMapFile($file, $mapInfo, $login, $update); | ||||||
| @@ -366,7 +366,7 @@ class MapManager implements CallbackListener { | |||||||
| 	private function processMapFile($file, MXMapInfo $mapInfo, $login, $update) { | 	private function processMapFile($file, MXMapInfo $mapInfo, $login, $update) { | ||||||
| 		// Check if map is already on the server | 		// Check if map is already on the server | ||||||
| 		if ($this->getMapByUid($mapInfo->uid)) { | 		if ($this->getMapByUid($mapInfo->uid)) { | ||||||
| 			$this->maniaControl->chat->sendError('Map is already on the server!', $login); | 			$this->maniaControl->getChat()->sendError('Map is already on the server!', $login); | ||||||
| 			return; | 			return; | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
| @@ -374,34 +374,34 @@ class MapManager implements CallbackListener { | |||||||
| 		$fileName = $mapInfo->id . '_' . $mapInfo->name . '.Map.Gbx'; | 		$fileName = $mapInfo->id . '_' . $mapInfo->name . '.Map.Gbx'; | ||||||
| 		$fileName = FileUtil::getClearedFileName($fileName); | 		$fileName = FileUtil::getClearedFileName($fileName); | ||||||
|  |  | ||||||
| 		$downloadFolderName  = $this->maniaControl->settingManager->getSettingValue($this, 'MapDownloadDirectory', 'MX'); | 		$downloadFolderName  = $this->maniaControl->getSettingManager()->getSettingValue($this, 'MapDownloadDirectory', 'MX'); | ||||||
| 		$relativeMapFileName = $downloadFolderName . DIRECTORY_SEPARATOR . $fileName; | 		$relativeMapFileName = $downloadFolderName . DIRECTORY_SEPARATOR . $fileName; | ||||||
| 		$mapDir              = $this->maniaControl->server->getDirectory() | 		$mapDir              = $this->maniaControl->getServer()->getDirectory() | ||||||
| 		                                                  ->getMapsFolder(); | 		                                                  ->getMapsFolder(); | ||||||
| 		$downloadDirectory   = $mapDir . $downloadFolderName . DIRECTORY_SEPARATOR; | 		$downloadDirectory   = $mapDir . $downloadFolderName . DIRECTORY_SEPARATOR; | ||||||
| 		$fullMapFileName     = $downloadDirectory . $fileName; | 		$fullMapFileName     = $downloadDirectory . $fileName; | ||||||
|  |  | ||||||
| 		// Check if it can get written locally | 		// Check if it can get written locally | ||||||
| 		if ($this->maniaControl->server->checkAccess($mapDir)) { | 		if ($this->maniaControl->getServer()->checkAccess($mapDir)) { | ||||||
| 			// Create download directory if necessary | 			// Create download directory if necessary | ||||||
| 			if (!is_dir($downloadDirectory) && !mkdir($downloadDirectory) || !is_writable($downloadDirectory)) { | 			if (!is_dir($downloadDirectory) && !mkdir($downloadDirectory) || !is_writable($downloadDirectory)) { | ||||||
| 				trigger_error("ManiaControl doesn't have to rights to save maps in '{$downloadDirectory}'."); | 				trigger_error("ManiaControl doesn't have to rights to save maps in '{$downloadDirectory}'."); | ||||||
| 				$this->maniaControl->chat->sendError("ManiaControl doesn't have the rights to save maps.", $login); | 				$this->maniaControl->getChat()->sendError("ManiaControl doesn't have the rights to save maps.", $login); | ||||||
| 				return; | 				return; | ||||||
| 			} | 			} | ||||||
|  |  | ||||||
| 			if (!file_put_contents($fullMapFileName, $file)) { | 			if (!file_put_contents($fullMapFileName, $file)) { | ||||||
| 				// Save error | 				// Save error | ||||||
| 				$this->maniaControl->chat->sendError('Saving map failed!', $login); | 				$this->maniaControl->getChat()->sendError('Saving map failed!', $login); | ||||||
| 				return; | 				return; | ||||||
| 			} | 			} | ||||||
| 		} else { | 		} else { | ||||||
| 			// Write map via write file method | 			// Write map via write file method | ||||||
| 			try { | 			try { | ||||||
| 				$this->maniaControl->client->writeFile($relativeMapFileName, $file); | 				$this->maniaControl->getClient()->writeFile($relativeMapFileName, $file); | ||||||
| 			} catch (InvalidArgumentException $e) { | 			} catch (InvalidArgumentException $e) { | ||||||
| 				if ($e->getMessage() === 'data are too big') { | 				if ($e->getMessage() === 'data are too big') { | ||||||
| 					$this->maniaControl->chat->sendError("Map is too big for a remote save.", $login); | 					$this->maniaControl->getChat()->sendError("Map is too big for a remote save.", $login); | ||||||
| 					return; | 					return; | ||||||
| 				} | 				} | ||||||
| 				throw $e; | 				throw $e; | ||||||
| @@ -410,49 +410,49 @@ class MapManager implements CallbackListener { | |||||||
|  |  | ||||||
| 		// Check for valid map | 		// Check for valid map | ||||||
| 		try { | 		try { | ||||||
| 			$this->maniaControl->client->checkMapForCurrentServerParams($relativeMapFileName); | 			$this->maniaControl->getClient()->checkMapForCurrentServerParams($relativeMapFileName); | ||||||
| 		} catch (InvalidMapException $exception) { | 		} catch (InvalidMapException $exception) { | ||||||
| 			$this->maniaControl->chat->sendException($exception, $login); | 			$this->maniaControl->getChat()->sendException($exception, $login); | ||||||
| 			return; | 			return; | ||||||
| 		} catch (FileException $exception) { | 		} catch (FileException $exception) { | ||||||
| 			$this->maniaControl->chat->sendException($exception, $login); | 			$this->maniaControl->getChat()->sendException($exception, $login); | ||||||
| 			return; | 			return; | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
| 		// Add map to map list | 		// Add map to map list | ||||||
| 		try { | 		try { | ||||||
| 			$this->maniaControl->client->insertMap($relativeMapFileName); | 			$this->maniaControl->getClient()->insertMap($relativeMapFileName); | ||||||
| 		} catch (AlreadyInListException $exception) { | 		} catch (AlreadyInListException $exception) { | ||||||
| 			$this->maniaControl->chat->sendException($exception, $login); | 			$this->maniaControl->getChat()->sendException($exception, $login); | ||||||
| 			return; | 			return; | ||||||
| 		} | 		} | ||||||
| 		$this->updateFullMapList(); | 		$this->updateFullMapList(); | ||||||
|  |  | ||||||
| 		// Update Mx MapInfo | 		// Update Mx MapInfo | ||||||
| 		$this->maniaControl->mapManager->getMXManager()->updateMapObjectsWithManiaExchangeIds(array($mapInfo)); | 		$this->maniaControl->getMapManager()->getMXManager()->updateMapObjectsWithManiaExchangeIds(array($mapInfo)); | ||||||
|  |  | ||||||
| 		// Update last updated time | 		// Update last updated time | ||||||
| 		$map = $this->getMapByUid($mapInfo->uid); | 		$map = $this->getMapByUid($mapInfo->uid); | ||||||
| 		if (!$map) { | 		if (!$map) { | ||||||
| 			// TODO: improve this - error reports about not existing maps | 			// TODO: improve this - error reports about not existing maps | ||||||
| 			$this->maniaControl->errorHandler->triggerDebugNotice('Map not in List after Insert!'); | 			$this->maniaControl->getErrorHandler()->triggerDebugNotice('Map not in List after Insert!'); | ||||||
| 			$this->maniaControl->chat->sendError('Server Error!', $login); | 			$this->maniaControl->getChat()->sendError('Server Error!', $login); | ||||||
| 			return; | 			return; | ||||||
| 		} | 		} | ||||||
| 		$map->lastUpdate = time(); | 		$map->lastUpdate = time(); | ||||||
|  |  | ||||||
| 		$player = $this->maniaControl->playerManager->getPlayer($login); | 		$player = $this->maniaControl->getPlayerManager()->getPlayer($login); | ||||||
|  |  | ||||||
| 		if (!$update) { | 		if (!$update) { | ||||||
| 			// Message | 			// Message | ||||||
| 			$message = '$<' . $player->nickname . '$> added $<' . $mapInfo->name . '$>!'; | 			$message = $player->getEscapedNickname() . ' added $<' . $mapInfo->name . '$>!'; | ||||||
| 			$this->maniaControl->chat->sendSuccess($message); | 			$this->maniaControl->getChat()->sendSuccess($message); | ||||||
| 			$this->maniaControl->log($message, true); | 			$this->maniaControl->log($message, true); | ||||||
| 			// Queue requested Map | 			// Queue requested Map | ||||||
| 			$this->maniaControl->mapManager->getMapQueue()->addMapToMapQueue($login, $mapInfo->uid); | 			$this->maniaControl->getMapManager()->getMapQueue()->addMapToMapQueue($login, $mapInfo->uid); | ||||||
| 		} else { | 		} else { | ||||||
| 			$message = '$<' . $player->nickname . '$> updated $<' . $mapInfo->name . '$>!'; | 			$message = $player->getEscapedNickname() . ' updated $<' . $mapInfo->name . '$>!'; | ||||||
| 			$this->maniaControl->chat->sendSuccess($message); | 			$this->maniaControl->getChat()->sendSuccess($message); | ||||||
| 			$this->maniaControl->log($message, true); | 			$this->maniaControl->log($message, true); | ||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
| @@ -478,8 +478,8 @@ class MapManager implements CallbackListener { | |||||||
|  |  | ||||||
| 		try { | 		try { | ||||||
| 			$offset = 0; | 			$offset = 0; | ||||||
| 			while ($this->maniaControl->client) { | 			while ($this->maniaControl->getClient()) { | ||||||
| 				$maps = $this->maniaControl->client->getMapList(150, $offset); | 				$maps = $this->maniaControl->getClient()->getMapList(150, $offset); | ||||||
|  |  | ||||||
| 				foreach ($maps as $rpcMap) { | 				foreach ($maps as $rpcMap) { | ||||||
| 					if (array_key_exists($rpcMap->uId, $this->maps)) { | 					if (array_key_exists($rpcMap->uId, $this->maps)) { | ||||||
| @@ -501,18 +501,19 @@ class MapManager implements CallbackListener { | |||||||
| 		$this->maps = $tempList; | 		$this->maps = $tempList; | ||||||
|  |  | ||||||
| 		// Trigger own callback | 		// Trigger own callback | ||||||
| 		$this->maniaControl->callbackManager->triggerCallback(self::CB_MAPS_UPDATED); | 		$this->maniaControl->getCallbackManager()->triggerCallback(self::CB_MAPS_UPDATED); | ||||||
|  |  | ||||||
| 		// Write MapList | 		// Write MapList | ||||||
| 		if ($this->maniaControl->settingManager->getSettingValue($this, self::SETTING_AUTOSAVE_MAPLIST)) { | 		if ($this->maniaControl->getSettingManager()->getSettingValue($this, self::SETTING_AUTOSAVE_MAPLIST)) { | ||||||
| 			if ($this->maniaControl->settingManager->getSettingValue($this, self::SETTING_WRITE_OWN_MAPLIST_FILE)) { | 			if ($this->maniaControl->getSettingManager()->getSettingValue($this, self::SETTING_WRITE_OWN_MAPLIST_FILE)) { | ||||||
| 				$matchSettingsFileName = "MatchSettings/{$this->maniaControl->server->login}.txt"; | 				$serverLogin = $this->maniaControl->getServer()->login; | ||||||
|  | 				$matchSettingsFileName = "MatchSettings/{$serverLogin}.txt"; | ||||||
| 			} else { | 			} else { | ||||||
| 				$matchSettingsFileName = $this->maniaControl->settingManager->getSettingValue($this, self::SETTING_MAPLIST_FILE); | 				$matchSettingsFileName = $this->maniaControl->getSettingManager()->getSettingValue($this, self::SETTING_MAPLIST_FILE); | ||||||
| 			} | 			} | ||||||
|  |  | ||||||
| 			try { | 			try { | ||||||
| 				$this->maniaControl->client->saveMatchSettings($matchSettingsFileName); | 				$this->maniaControl->getClient()->saveMatchSettings($matchSettingsFileName); | ||||||
| 			} catch (FileException $e) { | 			} catch (FileException $e) { | ||||||
| 				$this->maniaControl->log("Unable to write the playlist file, please checkout your MX-Folders File permissions!"); | 				$this->maniaControl->log("Unable to write the playlist file, please checkout your MX-Folders File permissions!"); | ||||||
| 			} | 			} | ||||||
| @@ -539,7 +540,7 @@ class MapManager implements CallbackListener { | |||||||
| 	 */ | 	 */ | ||||||
| 	private function saveMap(Map &$map) { | 	private function saveMap(Map &$map) { | ||||||
| 		//TODO saveMaps for whole maplist at once (usage of prepared statements) | 		//TODO saveMaps for whole maplist at once (usage of prepared statements) | ||||||
| 		$mysqli   = $this->maniaControl->database->mysqli; | 		$mysqli   = $this->maniaControl->getDatabase()->getMysqli(); | ||||||
| 		$mapQuery = "INSERT INTO `" . self::TABLE_MAPS . "` ( | 		$mapQuery = "INSERT INTO `" . self::TABLE_MAPS . "` ( | ||||||
| 				`uid`, | 				`uid`, | ||||||
| 				`name`, | 				`name`, | ||||||
| @@ -592,10 +593,10 @@ class MapManager implements CallbackListener { | |||||||
| 		} | 		} | ||||||
|  |  | ||||||
| 		try { | 		try { | ||||||
| 			$this->maniaControl->client->chooseNextMapList($mapArray); | 			$this->maniaControl->getClient()->chooseNextMapList($mapArray); | ||||||
| 		} catch (Exception $e) { | 		} catch (Exception $e) { | ||||||
| 			//TODO temp added 19.04.2014 | 			//TODO temp added 19.04.2014 | ||||||
| 			$this->maniaControl->errorHandler->triggerDebugNotice("Exception line 331 MapManager" . $e->getMessage()); | 			$this->maniaControl->getErrorHandler()->triggerDebugNotice("Exception line 331 MapManager" . $e->getMessage()); | ||||||
| 			trigger_error("Couldn't shuffle mapList. " . $e->getMessage()); | 			trigger_error("Couldn't shuffle mapList. " . $e->getMessage()); | ||||||
| 			return false; | 			return false; | ||||||
| 		} | 		} | ||||||
| @@ -603,8 +604,8 @@ class MapManager implements CallbackListener { | |||||||
| 		$this->fetchCurrentMap(); | 		$this->fetchCurrentMap(); | ||||||
|  |  | ||||||
| 		if ($admin) { | 		if ($admin) { | ||||||
| 			$message = '$<' . $admin->nickname . '$> shuffled the Maplist!'; | 			$message = $admin->getEscapedNickname() . ' shuffled the Maplist!'; | ||||||
| 			$this->maniaControl->chat->sendSuccess($message); | 			$this->maniaControl->getChat()->sendSuccess($message); | ||||||
| 			$this->maniaControl->log($message, true); | 			$this->maniaControl->log($message, true); | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
| @@ -620,7 +621,7 @@ class MapManager implements CallbackListener { | |||||||
| 	 */ | 	 */ | ||||||
| 	private function fetchCurrentMap() { | 	private function fetchCurrentMap() { | ||||||
| 		try { | 		try { | ||||||
| 			$rpcMap = $this->maniaControl->client->getCurrentMapInfo(); | 			$rpcMap = $this->maniaControl->getClient()->getCurrentMapInfo(); | ||||||
| 		} catch (UnavailableFeatureException $exception) { | 		} catch (UnavailableFeatureException $exception) { | ||||||
| 			return null; | 			return null; | ||||||
| 		} | 		} | ||||||
| @@ -665,7 +666,7 @@ class MapManager implements CallbackListener { | |||||||
| 		array_shift($mapArray); | 		array_shift($mapArray); | ||||||
|  |  | ||||||
| 		try { | 		try { | ||||||
| 			$this->maniaControl->client->chooseNextMapList($mapArray); | 			$this->maniaControl->getClient()->chooseNextMapList($mapArray); | ||||||
| 		} catch (Exception $e) { | 		} catch (Exception $e) { | ||||||
| 			trigger_error("Error while restructuring the Maplist. " . $e->getMessage()); | 			trigger_error("Error while restructuring the Maplist. " . $e->getMessage()); | ||||||
| 			return false; | 			return false; | ||||||
| @@ -764,7 +765,7 @@ class MapManager implements CallbackListener { | |||||||
| 			// Map already exists, only update index | 			// Map already exists, only update index | ||||||
| 			$this->currentMap = $this->maps[$uid]; | 			$this->currentMap = $this->maps[$uid]; | ||||||
| 			if (!$this->currentMap->nbCheckpoints || !$this->currentMap->nbLaps) { | 			if (!$this->currentMap->nbCheckpoints || !$this->currentMap->nbLaps) { | ||||||
| 				$rpcMap                          = $this->maniaControl->client->getCurrentMapInfo(); | 				$rpcMap                          = $this->maniaControl->getClient()->getCurrentMapInfo(); | ||||||
| 				$this->currentMap->nbLaps        = $rpcMap->nbLaps; | 				$this->currentMap->nbLaps        = $rpcMap->nbLaps; | ||||||
| 				$this->currentMap->nbCheckpoints = $rpcMap->nbCheckpoints; | 				$this->currentMap->nbCheckpoints = $rpcMap->nbCheckpoints; | ||||||
| 			} | 			} | ||||||
| @@ -777,7 +778,7 @@ class MapManager implements CallbackListener { | |||||||
| 		$this->getMXManager()->fetchManiaExchangeMapInformation($this->currentMap); | 		$this->getMXManager()->fetchManiaExchangeMapInformation($this->currentMap); | ||||||
|  |  | ||||||
| 		// Trigger own BeginMap callback | 		// Trigger own BeginMap callback | ||||||
| 		$this->maniaControl->callbackManager->triggerCallback(Callbacks::BEGINMAP, $this->currentMap); | 		$this->maniaControl->getCallbackManager()->triggerCallback(Callbacks::BEGINMAP, $this->currentMap); | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	/** | 	/** | ||||||
| @@ -791,7 +792,7 @@ class MapManager implements CallbackListener { | |||||||
| 		$this->mapBegan = false; | 		$this->mapBegan = false; | ||||||
|  |  | ||||||
| 		// Trigger own EndMap callback | 		// Trigger own EndMap callback | ||||||
| 		$this->maniaControl->callbackManager->triggerCallback(Callbacks::ENDMAP, $this->currentMap); | 		$this->maniaControl->getCallbackManager()->triggerCallback(Callbacks::ENDMAP, $this->currentMap); | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	/** | 	/** | ||||||
| @@ -801,7 +802,7 @@ class MapManager implements CallbackListener { | |||||||
| 	 * @return Map | 	 * @return Map | ||||||
| 	 */ | 	 */ | ||||||
| 	public function fetchMapByFileName($relativeFileName) { | 	public function fetchMapByFileName($relativeFileName) { | ||||||
| 		$mapInfo = $this->maniaControl->client->getMapInfo($relativeFileName); | 		$mapInfo = $this->maniaControl->getClient()->getMapInfo($relativeFileName); | ||||||
| 		if (!$mapInfo) { | 		if (!$mapInfo) { | ||||||
| 			return null; | 			return null; | ||||||
| 		} | 		} | ||||||
|   | |||||||
| @@ -53,24 +53,26 @@ class MapQueue implements CallbackListener, CommandListener { | |||||||
| 	public function __construct(ManiaControl $maniaControl) { | 	public function __construct(ManiaControl $maniaControl) { | ||||||
| 		$this->maniaControl = $maniaControl; | 		$this->maniaControl = $maniaControl; | ||||||
|  |  | ||||||
| 		$this->maniaControl->callbackManager->registerCallbackListener(Callbacks::ENDMAP, $this, 'endMap'); | 		// Callbacks | ||||||
| 		$this->maniaControl->callbackManager->registerCallbackListener(Callbacks::BEGINMAP, $this, 'beginMap'); | 		$this->maniaControl->getCallbackManager()->registerCallbackListener(Callbacks::ENDMAP, $this, 'endMap'); | ||||||
| 		$this->maniaControl->callbackManager->registerCallbackListener(Callbacks::AFTERINIT, $this, 'handleAfterInit'); | 		$this->maniaControl->getCallbackManager()->registerCallbackListener(Callbacks::BEGINMAP, $this, 'beginMap'); | ||||||
|  | 		$this->maniaControl->getCallbackManager()->registerCallbackListener(Callbacks::AFTERINIT, $this, 'handleAfterInit'); | ||||||
|  |  | ||||||
| 		// Init settings | 		// Settings | ||||||
| 		$this->maniaControl->settingManager->initSetting($this, self::SETTING_SKIP_MAP_ON_LEAVE, true); | 		$this->maniaControl->getSettingManager()->initSetting($this, self::SETTING_SKIP_MAP_ON_LEAVE, true); | ||||||
| 		$this->maniaControl->settingManager->initSetting($this, self::SETTING_SKIP_MAPQUEUE_ADMIN, false); | 		$this->maniaControl->getSettingManager()->initSetting($this, self::SETTING_SKIP_MAPQUEUE_ADMIN, false); | ||||||
| 		$this->maniaControl->settingManager->initSetting($this, self::SETTING_MAPLIMIT_PLAYER, 1); | 		$this->maniaControl->getSettingManager()->initSetting($this, self::SETTING_MAPLIMIT_PLAYER, 1); | ||||||
| 		$this->maniaControl->settingManager->initSetting($this, self::SETTING_MAPLIMIT_ADMIN, -1); | 		$this->maniaControl->getSettingManager()->initSetting($this, self::SETTING_MAPLIMIT_ADMIN, -1); | ||||||
| 		$this->maniaControl->settingManager->initSetting($this, self::SETTING_BUFFERSIZE, 10); | 		$this->maniaControl->getSettingManager()->initSetting($this, self::SETTING_BUFFERSIZE, 10); | ||||||
|  |  | ||||||
| 		$this->maniaControl->authenticationManager->definePermissionLevel(self::SETTING_PERMISSION_CLEAR_MAPQUEUE, AuthenticationManager::AUTH_LEVEL_MODERATOR); | 		// Permissions | ||||||
| 		$this->maniaControl->authenticationManager->definePermissionLevel(self::SETTING_PERMISSION_QUEUE_BUFFER, AuthenticationManager::AUTH_LEVEL_ADMIN); | 		$this->maniaControl->getAuthenticationManager()->definePermissionLevel(self::SETTING_PERMISSION_CLEAR_MAPQUEUE, AuthenticationManager::AUTH_LEVEL_MODERATOR); | ||||||
|  | 		$this->maniaControl->getAuthenticationManager()->definePermissionLevel(self::SETTING_PERMISSION_QUEUE_BUFFER, AuthenticationManager::AUTH_LEVEL_ADMIN); | ||||||
|  |  | ||||||
| 		//Register Admin Commands | 		// Admin Commands | ||||||
| 		$this->maniaControl->commandManager->registerCommandListener(self::ADMIN_COMMAND_CLEAR_JUKEBOX, $this, 'command_ClearMapQueue', true, 'Clears the Map-Queue.'); | 		$this->maniaControl->getCommandManager()->registerCommandListener(self::ADMIN_COMMAND_CLEAR_JUKEBOX, $this, 'command_ClearMapQueue', true, 'Clears the Map-Queue.'); | ||||||
| 		$this->maniaControl->commandManager->registerCommandListener(self::ADMIN_COMMAND_CLEAR_MAPQUEUE, $this, 'command_ClearMapQueue', true, 'Clears the Map-Queue.'); | 		$this->maniaControl->getCommandManager()->registerCommandListener(self::ADMIN_COMMAND_CLEAR_MAPQUEUE, $this, 'command_ClearMapQueue', true, 'Clears the Map-Queue.'); | ||||||
| 		$this->maniaControl->commandManager->registerCommandListener(array('jb', 'jukebox', 'mapqueue'), $this, 'command_MapQueue', false, 'Shows current maps in Map-Queue.'); | 		$this->maniaControl->getCommandManager()->registerCommandListener(array('jb', 'jukebox', 'mapqueue'), $this, 'command_MapQueue', false, 'Shows current maps in Map-Queue.'); | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	/** | 	/** | ||||||
| @@ -84,7 +86,7 @@ class MapQueue implements CallbackListener, CommandListener { | |||||||
| 	 * Add current map to buffer on startup | 	 * Add current map to buffer on startup | ||||||
| 	 */ | 	 */ | ||||||
| 	public function handleAfterInit() { | 	public function handleAfterInit() { | ||||||
| 		$currentMap     = $this->maniaControl->mapManager->getCurrentMap(); | 		$currentMap     = $this->maniaControl->getMapManager()->getCurrentMap(); | ||||||
| 		$this->buffer[] = $currentMap->uid; | 		$this->buffer[] = $currentMap->uid; | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| @@ -104,26 +106,26 @@ class MapQueue implements CallbackListener, CommandListener { | |||||||
| 	 * @param Player $admin | 	 * @param Player $admin | ||||||
| 	 */ | 	 */ | ||||||
| 	public function clearMapQueue(Player $admin) { | 	public function clearMapQueue(Player $admin) { | ||||||
| 		if (!$this->maniaControl->authenticationManager->checkPermission($admin, self::SETTING_PERMISSION_CLEAR_MAPQUEUE)) { | 		if (!$this->maniaControl->getAuthenticationManager()->checkPermission($admin, self::SETTING_PERMISSION_CLEAR_MAPQUEUE)) { | ||||||
| 			$this->maniaControl->authenticationManager->sendNotAllowed($admin); | 			$this->maniaControl->getAuthenticationManager()->sendNotAllowed($admin); | ||||||
| 			return; | 			return; | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
| 		if (empty($this->queuedMaps)) { | 		if (empty($this->queuedMaps)) { | ||||||
| 			$this->maniaControl->chat->sendError('$fa0There are no maps in the jukebox!', $admin->login); | 			$this->maniaControl->getChat()->sendError('$fa0There are no maps in the jukebox!', $admin->login); | ||||||
| 			return; | 			return; | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
| 		$title = $this->maniaControl->authenticationManager->getAuthLevelName($admin->authLevel); | 		$title = $this->maniaControl->getAuthenticationManager()->getAuthLevelName($admin->authLevel); | ||||||
|  |  | ||||||
| 		//Destroy map - queue list | 		//Destroy map - queue list | ||||||
| 		$this->queuedMaps = array(); | 		$this->queuedMaps = array(); | ||||||
|  |  | ||||||
| 		$this->maniaControl->chat->sendInformation('$fa0' . $title . ' $<$fff' . $admin->nickname . '$> cleared the Queued-Map list!'); | 		$this->maniaControl->getChat()->sendInformation('$fa0' . $title . ' $<$fff' . $admin->nickname . '$> cleared the Queued-Map list!'); | ||||||
| 		$this->maniaControl->log($title . ' ' . Formatter::stripCodes($admin->nickname) . ' cleared the Queued-Map list!'); | 		$this->maniaControl->log($title . ' ' . Formatter::stripCodes($admin->nickname) . ' cleared the Queued-Map list!'); | ||||||
|  |  | ||||||
| 		// Trigger callback | 		// Trigger callback | ||||||
| 		$this->maniaControl->callbackManager->triggerCallback(self::CB_MAPQUEUE_CHANGED, array('clear')); | 		$this->maniaControl->getCallbackManager()->triggerCallback(self::CB_MAPQUEUE_CHANGED, array('clear')); | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	/** | 	/** | ||||||
| @@ -163,7 +165,7 @@ class MapQueue implements CallbackListener, CommandListener { | |||||||
| 	 */ | 	 */ | ||||||
| 	public function showMapQueue(Player $player) { | 	public function showMapQueue(Player $player) { | ||||||
| 		if (empty($this->queuedMaps)) { | 		if (empty($this->queuedMaps)) { | ||||||
| 			$this->maniaControl->chat->sendError('$fa0There are no maps in the jukebox!', $player->login); | 			$this->maniaControl->getChat()->sendError('$fa0There are no maps in the jukebox!', $player->login); | ||||||
| 			return; | 			return; | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
| @@ -174,7 +176,7 @@ class MapQueue implements CallbackListener, CommandListener { | |||||||
| 			$index++; | 			$index++; | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
| 		$this->maniaControl->chat->sendInformation($message, $player->login); | 		$this->maniaControl->getChat()->sendInformation($message, $player); | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	/** | 	/** | ||||||
| @@ -184,7 +186,7 @@ class MapQueue implements CallbackListener, CommandListener { | |||||||
| 	 */ | 	 */ | ||||||
| 	public function showMapQueueManialink(Player $player) { | 	public function showMapQueueManialink(Player $player) { | ||||||
| 		if (empty($this->queuedMaps)) { | 		if (empty($this->queuedMaps)) { | ||||||
| 			$this->maniaControl->chat->sendError('There are no Maps in the Jukebox!', $player); | 			$this->maniaControl->getChat()->sendError('There are no Maps in the Jukebox!', $player); | ||||||
| 			return; | 			return; | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
| @@ -193,7 +195,7 @@ class MapQueue implements CallbackListener, CommandListener { | |||||||
| 			array_push($maps, $queuedMap[1]); | 			array_push($maps, $queuedMap[1]); | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
| 		$this->maniaControl->mapManager->getMapList()->showMapList($player, $maps); | 		$this->maniaControl->getMapManager()->getMapList()->showMapList($player, $maps); | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	/** | 	/** | ||||||
| @@ -228,13 +230,13 @@ class MapQueue implements CallbackListener, CommandListener { | |||||||
| 	 * @param string $uid | 	 * @param string $uid | ||||||
| 	 */ | 	 */ | ||||||
| 	public function addMapToMapQueue($login, $uid) { | 	public function addMapToMapQueue($login, $uid) { | ||||||
| 		$player = $this->maniaControl->playerManager->getPlayer($login); | 		$player = $this->maniaControl->getPlayerManager()->getPlayer($login); | ||||||
| 		if (!$player) { | 		if (!$player) { | ||||||
| 			return; | 			return; | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
| 		//Check if player is allowed to add (another) map | 		//Check if player is allowed to add (another) map | ||||||
| 		$isModerator = $this->maniaControl->authenticationManager->checkRight($player, AuthenticationManager::AUTH_LEVEL_MODERATOR); | 		$isModerator = $this->maniaControl->getAuthenticationManager()->checkRight($player, AuthenticationManager::AUTH_LEVEL_MODERATOR); | ||||||
|  |  | ||||||
| 		$mapsForPlayer = 0; | 		$mapsForPlayer = 0; | ||||||
| 		foreach ($this->queuedMaps as $queuedMap) { | 		foreach ($this->queuedMaps as $queuedMap) { | ||||||
| @@ -244,15 +246,15 @@ class MapQueue implements CallbackListener, CommandListener { | |||||||
| 		} | 		} | ||||||
|  |  | ||||||
| 		if ($isModerator) { | 		if ($isModerator) { | ||||||
| 			$maxAdmin = $this->maniaControl->settingManager->getSettingValue($this, self::SETTING_MAPLIMIT_ADMIN); | 			$maxAdmin = $this->maniaControl->getSettingManager()->getSettingValue($this, self::SETTING_MAPLIMIT_ADMIN); | ||||||
| 			if ($maxAdmin >= 0 && $mapsForPlayer >= $maxAdmin) { | 			if ($maxAdmin >= 0 && $mapsForPlayer >= $maxAdmin) { | ||||||
| 				$this->maniaControl->chat->sendError('You already have $<$fff' . $maxAdmin . '$> map(s) in the Map-Queue!', $login); | 				$this->maniaControl->getChat()->sendError('You already have $<$fff' . $maxAdmin . '$> map(s) in the Map-Queue!', $login); | ||||||
| 				return; | 				return; | ||||||
| 			} | 			} | ||||||
| 		} else { | 		} else { | ||||||
| 			$maxPlayer = $this->maniaControl->settingManager->getSettingValue($this, self::SETTING_MAPLIMIT_PLAYER); | 			$maxPlayer = $this->maniaControl->getSettingManager()->getSettingValue($this, self::SETTING_MAPLIMIT_PLAYER); | ||||||
| 			if ($maxPlayer >= 0 && $mapsForPlayer >= $maxPlayer) { | 			if ($maxPlayer >= 0 && $mapsForPlayer >= $maxPlayer) { | ||||||
| 				$this->maniaControl->chat->sendError('You already have $<$fff' . $maxPlayer . '$> map(s) in the Map-Queue!', $login); | 				$this->maniaControl->getChat()->sendError('You already have $<$fff' . $maxPlayer . '$> map(s) in the Map-Queue!', $login); | ||||||
| 				return; | 				return; | ||||||
| 			} | 			} | ||||||
| 		} | 		} | ||||||
| @@ -264,29 +266,29 @@ class MapQueue implements CallbackListener, CommandListener { | |||||||
| 			$uid = $map->uid; | 			$uid = $map->uid; | ||||||
| 		} | 		} | ||||||
| 		if (array_key_exists($uid, $this->queuedMaps)) { | 		if (array_key_exists($uid, $this->queuedMaps)) { | ||||||
| 			$this->maniaControl->chat->sendError('That map is already in the Map-Queue!', $login); | 			$this->maniaControl->getChat()->sendError('That map is already in the Map-Queue!', $login); | ||||||
| 			return; | 			return; | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
| 		//TODO recently maps not able to add to queue-amps setting, and management | 		//TODO recently maps not able to add to queue-amps setting, and management | ||||||
| 		// Check if map is in the buffer | 		// Check if map is in the buffer | ||||||
| 		if (in_array($uid, $this->buffer)) { | 		if (in_array($uid, $this->buffer)) { | ||||||
| 			$this->maniaControl->chat->sendError('That map has recently been played!', $login); | 			$this->maniaControl->getChat()->sendError('That map has recently been played!', $login); | ||||||
| 			if (!$this->maniaControl->authenticationManager->checkPermission($player, self::SETTING_PERMISSION_CLEAR_MAPQUEUE)) { | 			if (!$this->maniaControl->getAuthenticationManager()->checkPermission($player, self::SETTING_PERMISSION_CLEAR_MAPQUEUE)) { | ||||||
| 				return; | 				return; | ||||||
| 			} | 			} | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
| 		if (!$map) { | 		if (!$map) { | ||||||
| 			$map = $this->maniaControl->mapManager->getMapByUid($uid); | 			$map = $this->maniaControl->getMapManager()->getMapByUid($uid); | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
| 		$this->queuedMaps[$uid] = array($player, $map); | 		$this->queuedMaps[$uid] = array($player, $map); | ||||||
|  |  | ||||||
| 		$this->maniaControl->chat->sendInformation('$fa0$<$fff' . $map->name . '$> has been added to the Map-Queue by $<$fff' . $player->nickname . '$>.'); | 		$this->maniaControl->getChat()->sendInformation('$fa0$<$fff' . $map->name . '$> has been added to the Map-Queue by $<$fff' . $player->nickname . '$>.'); | ||||||
|  |  | ||||||
| 		// Trigger callback | 		// Trigger callback | ||||||
| 		$this->maniaControl->callbackManager->triggerCallback(self::CB_MAPQUEUE_CHANGED, array('add', $this->queuedMaps[$uid])); | 		$this->maniaControl->getCallbackManager()->triggerCallback(self::CB_MAPQUEUE_CHANGED, array('add', $this->queuedMaps[$uid])); | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	/** | 	/** | ||||||
| @@ -303,10 +305,10 @@ class MapQueue implements CallbackListener, CommandListener { | |||||||
| 		$map = $this->queuedMaps[$uid][1]; | 		$map = $this->queuedMaps[$uid][1]; | ||||||
| 		unset($this->queuedMaps[$uid]); | 		unset($this->queuedMaps[$uid]); | ||||||
|  |  | ||||||
| 		$this->maniaControl->chat->sendInformation('$fa0$<$fff' . $map->name . '$> is removed from the Map-Queue by $<$fff' . $player->nickname . '$>.'); | 		$this->maniaControl->getChat()->sendInformation('$fa0$<$fff' . $map->name . '$> is removed from the Map-Queue by $<$fff' . $player->nickname . '$>.'); | ||||||
|  |  | ||||||
| 		// Trigger callback | 		// Trigger callback | ||||||
| 		$this->maniaControl->callbackManager->triggerCallback(self::CB_MAPQUEUE_CHANGED, array('remove', $map)); | 		$this->maniaControl->getCallbackManager()->triggerCallback(self::CB_MAPQUEUE_CHANGED, array('remove', $map)); | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	/** | 	/** | ||||||
| @@ -322,7 +324,7 @@ class MapQueue implements CallbackListener, CommandListener { | |||||||
| 		} | 		} | ||||||
|  |  | ||||||
| 		$this->nextMap = null; | 		$this->nextMap = null; | ||||||
| 		if ($this->maniaControl->settingManager->getSettingValue($this, self::SETTING_SKIP_MAP_ON_LEAVE)) { | 		if ($this->maniaControl->getSettingManager()->getSettingValue($this, self::SETTING_SKIP_MAP_ON_LEAVE)) { | ||||||
| 			// Skip Map if requester has left | 			// Skip Map if requester has left | ||||||
| 			foreach ($this->queuedMaps as $queuedMap) { | 			foreach ($this->queuedMaps as $queuedMap) { | ||||||
| 				$player = $queuedMap[0]; | 				$player = $queuedMap[0]; | ||||||
| @@ -333,11 +335,11 @@ class MapQueue implements CallbackListener, CommandListener { | |||||||
| 				} | 				} | ||||||
|  |  | ||||||
| 				//found player, so play this map | 				//found player, so play this map | ||||||
| 				if ($this->maniaControl->playerManager->getPlayer($player->login)) { | 				if ($this->maniaControl->getPlayerManager()->getPlayer($player->login)) { | ||||||
| 					break; | 					break; | ||||||
| 				} | 				} | ||||||
|  |  | ||||||
| 				if (!$this->maniaControl->settingManager->getSettingValue($this, self::SETTING_SKIP_MAPQUEUE_ADMIN)) { | 				if (!$this->maniaControl->getSettingManager()->getSettingValue($this, self::SETTING_SKIP_MAPQUEUE_ADMIN)) { | ||||||
| 					//Check if the queuer is a admin | 					//Check if the queuer is a admin | ||||||
| 					if ($player->authLevel > 0) { | 					if ($player->authLevel > 0) { | ||||||
| 						break; | 						break; | ||||||
| @@ -345,12 +347,12 @@ class MapQueue implements CallbackListener, CommandListener { | |||||||
| 				} | 				} | ||||||
|  |  | ||||||
| 				// Trigger callback | 				// Trigger callback | ||||||
| 				$this->maniaControl->callbackManager->triggerCallback(self::CB_MAPQUEUE_CHANGED, array('skip', $queuedMap[0])); | 				$this->maniaControl->getCallbackManager()->triggerCallback(self::CB_MAPQUEUE_CHANGED, array('skip', $queuedMap[0])); | ||||||
|  |  | ||||||
| 				//Player not found, so remove the map from the mapqueue | 				//Player not found, so remove the map from the mapqueue | ||||||
| 				array_shift($this->queuedMaps); | 				array_shift($this->queuedMaps); | ||||||
|  |  | ||||||
| 				$this->maniaControl->chat->sendInformation('$fa0$<$fff' . $queuedMap[0]->name . '$> is skipped because $<' . $player->nickname . '$> left the game!'); | 				$this->maniaControl->getChat()->sendInformation('$fa0$<$fff' . $queuedMap[0]->name . '$> is skipped because $<' . $player->nickname . '$> left the game!'); | ||||||
| 			} | 			} | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
| @@ -362,10 +364,10 @@ class MapQueue implements CallbackListener, CommandListener { | |||||||
| 		} | 		} | ||||||
| 		$map = $this->nextMap[1]; | 		$map = $this->nextMap[1]; | ||||||
| 		/** @var Map $map */ | 		/** @var Map $map */ | ||||||
| 		$this->maniaControl->chat->sendInformation('$fa0Next map will be $<$fff' . $map->name . '$> as requested by $<' . $this->nextMap[0]->nickname . '$>.'); | 		$this->maniaControl->getChat()->sendInformation('$fa0Next map will be $<$fff' . $map->name . '$> as requested by $<' . $this->nextMap[0]->nickname . '$>.'); | ||||||
|  |  | ||||||
| 		try { | 		try { | ||||||
| 			$this->maniaControl->client->setNextMapIdent($map->uid); | 			$this->maniaControl->getClient()->setNextMapIdent($map->uid); | ||||||
| 		} catch (NextMapException $e) { | 		} catch (NextMapException $e) { | ||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
| @@ -380,7 +382,7 @@ class MapQueue implements CallbackListener, CommandListener { | |||||||
| 			return; | 			return; | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
| 		if (count($this->buffer) >= $this->maniaControl->settingManager->getSettingValue($this, self::SETTING_BUFFERSIZE)) { | 		if (count($this->buffer) >= $this->maniaControl->getSettingManager()->getSettingValue($this, self::SETTING_BUFFERSIZE)) { | ||||||
| 			array_shift($this->buffer); | 			array_shift($this->buffer); | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
|   | |||||||
| @@ -313,7 +313,7 @@ class Player { | |||||||
| 	 * @return mixed | 	 * @return mixed | ||||||
| 	 */ | 	 */ | ||||||
| 	public function getPlayerData($object, $dataName, $serverIndex = -1) { | 	public function getPlayerData($object, $dataName, $serverIndex = -1) { | ||||||
| 		return $this->maniaControl->playerManager->playerDataManager->getPlayerData($object, $dataName, $this, $serverIndex); | 		return $this->maniaControl->getPlayerManager()->getPlayerDataManager()->getPlayerData($object, $dataName, $this, $serverIndex); | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	/** | 	/** | ||||||
| @@ -326,7 +326,7 @@ class Player { | |||||||
| 	 * @return bool | 	 * @return bool | ||||||
| 	 */ | 	 */ | ||||||
| 	public function setPlayerData($object, $dataName, $value, $serverIndex = -1) { | 	public function setPlayerData($object, $dataName, $value, $serverIndex = -1) { | ||||||
| 		return $this->maniaControl->playerManager->playerDataManager->setPlayerData($object, $dataName, $this, $value, $serverIndex); | 		return $this->maniaControl->getPlayerManager()->getPlayerDataManager()->setPlayerData($object, $dataName, $this, $value, $serverIndex); | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	/** | 	/** | ||||||
|   | |||||||
| @@ -54,21 +54,21 @@ class PlayerActions { | |||||||
| 	private $maniaControl = null; | 	private $maniaControl = null; | ||||||
|  |  | ||||||
| 	/** | 	/** | ||||||
| 	 * Create a PlayerActions Instance | 	 * Construct a new PlayerActions instance | ||||||
| 	 * | 	 * | ||||||
| 	 * @param ManiaControl $maniaControl | 	 * @param ManiaControl $maniaControl | ||||||
| 	 */ | 	 */ | ||||||
| 	public function __construct(ManiaControl $maniaControl) { | 	public function __construct(ManiaControl $maniaControl) { | ||||||
| 		$this->maniaControl = $maniaControl; | 		$this->maniaControl = $maniaControl; | ||||||
|  |  | ||||||
| 		//Define Rights | 		// Permissions | ||||||
| 		$this->maniaControl->authenticationManager->definePermissionLevel(self::SETTING_PERMISSION_BAN_PLAYER, AuthenticationManager::AUTH_LEVEL_ADMIN); | 		$this->maniaControl->getAuthenticationManager()->definePermissionLevel(self::SETTING_PERMISSION_BAN_PLAYER, AuthenticationManager::AUTH_LEVEL_ADMIN); | ||||||
| 		$this->maniaControl->authenticationManager->definePermissionLevel(self::SETTING_PERMISSION_KICK_PLAYER, AuthenticationManager::AUTH_LEVEL_MODERATOR); | 		$this->maniaControl->getAuthenticationManager()->definePermissionLevel(self::SETTING_PERMISSION_KICK_PLAYER, AuthenticationManager::AUTH_LEVEL_MODERATOR); | ||||||
| 		$this->maniaControl->authenticationManager->definePermissionLevel(self::SETTING_PERMISSION_WARN_PLAYER, AuthenticationManager::AUTH_LEVEL_MODERATOR); | 		$this->maniaControl->getAuthenticationManager()->definePermissionLevel(self::SETTING_PERMISSION_WARN_PLAYER, AuthenticationManager::AUTH_LEVEL_MODERATOR); | ||||||
| 		$this->maniaControl->authenticationManager->definePermissionLevel(self::SETTING_PERMISSION_MUTE_PLAYER, AuthenticationManager::AUTH_LEVEL_MODERATOR); | 		$this->maniaControl->getAuthenticationManager()->definePermissionLevel(self::SETTING_PERMISSION_MUTE_PLAYER, AuthenticationManager::AUTH_LEVEL_MODERATOR); | ||||||
| 		$this->maniaControl->authenticationManager->definePermissionLevel(self::SETTING_PERMISSION_FORCE_PLAYER_PLAY, AuthenticationManager::AUTH_LEVEL_MODERATOR); | 		$this->maniaControl->getAuthenticationManager()->definePermissionLevel(self::SETTING_PERMISSION_FORCE_PLAYER_PLAY, AuthenticationManager::AUTH_LEVEL_MODERATOR); | ||||||
| 		$this->maniaControl->authenticationManager->definePermissionLevel(self::SETTING_PERMISSION_FORCE_PLAYER_TEAM, AuthenticationManager::AUTH_LEVEL_MODERATOR); | 		$this->maniaControl->getAuthenticationManager()->definePermissionLevel(self::SETTING_PERMISSION_FORCE_PLAYER_TEAM, AuthenticationManager::AUTH_LEVEL_MODERATOR); | ||||||
| 		$this->maniaControl->authenticationManager->definePermissionLevel(self::SETTING_PERMISSION_FORCE_PLAYER_SPEC, AuthenticationManager::AUTH_LEVEL_MODERATOR); | 		$this->maniaControl->getAuthenticationManager()->definePermissionLevel(self::SETTING_PERMISSION_FORCE_PLAYER_SPEC, AuthenticationManager::AUTH_LEVEL_MODERATOR); | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	/** | 	/** | ||||||
| @@ -79,12 +79,12 @@ class PlayerActions { | |||||||
| 	 * @param int    $teamId | 	 * @param int    $teamId | ||||||
| 	 */ | 	 */ | ||||||
| 	public function forcePlayerToTeam($adminLogin, $targetLogin, $teamId) { | 	public function forcePlayerToTeam($adminLogin, $targetLogin, $teamId) { | ||||||
| 		$admin = $this->maniaControl->playerManager->getPlayer($adminLogin); | 		$admin = $this->maniaControl->getPlayerManager()->getPlayer($adminLogin); | ||||||
| 		if (!$this->maniaControl->authenticationManager->checkPermission($admin, self::SETTING_PERMISSION_FORCE_PLAYER_TEAM)) { | 		if (!$this->maniaControl->getAuthenticationManager()->checkPermission($admin, self::SETTING_PERMISSION_FORCE_PLAYER_TEAM)) { | ||||||
| 			$this->maniaControl->authenticationManager->sendNotAllowed($admin); | 			$this->maniaControl->getAuthenticationManager()->sendNotAllowed($admin); | ||||||
| 			return; | 			return; | ||||||
| 		} | 		} | ||||||
| 		$target = $this->maniaControl->playerManager->getPlayer($targetLogin); | 		$target = $this->maniaControl->getPlayerManager()->getPlayer($targetLogin); | ||||||
| 		if (!$target || !$admin) { | 		if (!$target || !$admin) { | ||||||
| 			return; | 			return; | ||||||
| 		} | 		} | ||||||
| @@ -95,12 +95,12 @@ class PlayerActions { | |||||||
| 					return; | 					return; | ||||||
| 				} | 				} | ||||||
| 			} catch (FaultException $exception) { | 			} catch (FaultException $exception) { | ||||||
| 				$this->maniaControl->chat->sendException($exception, $admin); | 				$this->maniaControl->getChat()->sendException($exception, $admin); | ||||||
| 			} | 			} | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
| 		try { | 		try { | ||||||
| 			$this->maniaControl->client->forcePlayerTeam($target->login, $teamId); | 			$this->maniaControl->getClient()->forcePlayerTeam($target->login, $teamId); | ||||||
| 		} catch (FaultException $exception) { | 		} catch (FaultException $exception) { | ||||||
| 			// TODO: replace by more specific exception "there are too many ..." | 			// TODO: replace by more specific exception "there are too many ..." | ||||||
| 			$this->forcePlayerToPlay($adminLogin, $targetLogin); | 			$this->forcePlayerToPlay($adminLogin, $targetLogin); | ||||||
| @@ -108,16 +108,16 @@ class PlayerActions { | |||||||
| 		} | 		} | ||||||
|  |  | ||||||
| 		$chatMessage = false; | 		$chatMessage = false; | ||||||
| 		$title       = $this->maniaControl->authenticationManager->getAuthLevelName($admin->authLevel); | 		$title       = $this->maniaControl->getAuthenticationManager()->getAuthLevelName($admin->authLevel); | ||||||
| 		if ($teamId === self::TEAM_BLUE) { | 		if ($teamId === self::TEAM_BLUE) { | ||||||
| 			$chatMessage = $title . ' $<' . $admin->nickname . '$> forced $<' . $target->nickname . '$> into the Blue-Team!'; | 			$chatMessage = $title . ' ' . $admin->getEscapedNickname() . ' forced ' . $target->getEscapedNickname(). ' into the Blue-Team!'; | ||||||
| 		} else if ($teamId === self::TEAM_RED) { | 		} else if ($teamId === self::TEAM_RED) { | ||||||
| 			$chatMessage = $title . ' $<' . $admin->nickname . '$> forced $<' . $target->nickname . '$> into the Red-Team!'; | 			$chatMessage = $title . ' ' . $admin->getEscapedNickname(). ' forced ' . $target->getEscapedNickname(). ' into the Red-Team!'; | ||||||
| 		} | 		} | ||||||
| 		if (!$chatMessage) { | 		if (!$chatMessage) { | ||||||
| 			return; | 			return; | ||||||
| 		} | 		} | ||||||
| 		$this->maniaControl->chat->sendInformation($chatMessage); | 		$this->maniaControl->getChat()->sendInformation($chatMessage); | ||||||
| 		$this->maniaControl->log($chatMessage, true); | 		$this->maniaControl->log($chatMessage, true); | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| @@ -131,38 +131,36 @@ class PlayerActions { | |||||||
| 	 * @return bool | 	 * @return bool | ||||||
| 	 */ | 	 */ | ||||||
| 	public function forcePlayerToPlay($adminLogin, $targetLogin, $userIsAbleToSelect = true, $displayAnnouncement = true) { | 	public function forcePlayerToPlay($adminLogin, $targetLogin, $userIsAbleToSelect = true, $displayAnnouncement = true) { | ||||||
| 		$admin = $this->maniaControl->playerManager->getPlayer($adminLogin); | 		$admin = $this->maniaControl->getPlayerManager()->getPlayer($adminLogin); | ||||||
| 		if (!$this->maniaControl->authenticationManager->checkPermission($admin, self::SETTING_PERMISSION_FORCE_PLAYER_PLAY)) { | 		if (!$this->maniaControl->getAuthenticationManager()->checkPermission($admin, self::SETTING_PERMISSION_FORCE_PLAYER_PLAY)) { | ||||||
| 			$this->maniaControl->authenticationManager->sendNotAllowed($admin); | 			$this->maniaControl->getAuthenticationManager()->sendNotAllowed($admin); | ||||||
| 			return false; | 			return false; | ||||||
| 		} | 		} | ||||||
| 		$target = $this->maniaControl->playerManager->getPlayer($targetLogin); | 		$target = $this->maniaControl->getPlayerManager()->getPlayer($targetLogin); | ||||||
| 		if (!$target) { | 		if (!$target) { | ||||||
| 			return false; | 			return false; | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
| 		try { | 		try { | ||||||
| 			$this->maniaControl->client->forceSpectator($target->login, self::SPECTATOR_PLAYER); | 			$this->maniaControl->getClient()->forceSpectator($target->login, self::SPECTATOR_PLAYER); | ||||||
| 		} catch (FaultException $exception) { | 		} catch (ServerOptionsException $exception) { | ||||||
| 			// TODO: replace by more specific exception "there are too many ..." | 			$this->maniaControl->getChat()->sendException($exception, $admin); | ||||||
| 			$this->maniaControl->chat->sendException($exception, $admin); |  | ||||||
| 			return false; | 			return false; | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
| 		if ($userIsAbleToSelect) { | 		if ($userIsAbleToSelect) { | ||||||
| 			try { | 			try { | ||||||
| 				$this->maniaControl->client->forceSpectator($target->login, self::SPECTATOR_USER_SELECTABLE); | 				$this->maniaControl->getClient()->forceSpectator($target->login, self::SPECTATOR_USER_SELECTABLE); | ||||||
| 			} catch (FaultException $exception) { | 			} catch (ServerOptionsException $exception) { | ||||||
| 				// TODO: replace by more specific exception "there are too many ..." | 				$this->maniaControl->getChat()->sendException($exception, $admin); | ||||||
| 				$this->maniaControl->chat->sendException($exception, $admin); |  | ||||||
| 				return false; | 				return false; | ||||||
| 			} | 			} | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
| 		// Announce force | 		// Announce force | ||||||
| 		if ($displayAnnouncement) { | 		if ($displayAnnouncement) { | ||||||
| 			$chatMessage = '$<' . $admin->nickname . '$> forced $<' . $target->nickname . '$> to Play!'; | 			$chatMessage = $admin->getEscapedNickname() . ' forced ' . $target->getEscapedNickname(). ' to Play!'; | ||||||
| 			$this->maniaControl->chat->sendInformation($chatMessage); | 			$this->maniaControl->getChat()->sendInformation($chatMessage); | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
| 		return true; | 		return true; | ||||||
| @@ -178,33 +176,33 @@ class PlayerActions { | |||||||
| 	 */ | 	 */ | ||||||
| 	public function forcePlayerToSpectator($adminLogin, $targetLogin, $spectatorState = self::SPECTATOR_BUT_KEEP_SELECTABLE, | 	public function forcePlayerToSpectator($adminLogin, $targetLogin, $spectatorState = self::SPECTATOR_BUT_KEEP_SELECTABLE, | ||||||
| 	                                       $releaseSlot = true) { | 	                                       $releaseSlot = true) { | ||||||
| 		$admin = $this->maniaControl->playerManager->getPlayer($adminLogin); | 		$admin = $this->maniaControl->getPlayerManager()->getPlayer($adminLogin); | ||||||
| 		if (!$this->maniaControl->authenticationManager->checkPermission($admin, self::SETTING_PERMISSION_FORCE_PLAYER_SPEC)) { | 		if (!$this->maniaControl->getAuthenticationManager()->checkPermission($admin, self::SETTING_PERMISSION_FORCE_PLAYER_SPEC)) { | ||||||
| 			$this->maniaControl->authenticationManager->sendNotAllowed($admin); | 			$this->maniaControl->getAuthenticationManager()->sendNotAllowed($admin); | ||||||
| 			return; | 			return; | ||||||
| 		} | 		} | ||||||
| 		$target = $this->maniaControl->playerManager->getPlayer($targetLogin); | 		$target = $this->maniaControl->getPlayerManager()->getPlayer($targetLogin); | ||||||
|  |  | ||||||
| 		if (!$admin || !$target || $target->isSpectator) { | 		if (!$admin || !$target || $target->isSpectator) { | ||||||
| 			return; | 			return; | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
| 		try { | 		try { | ||||||
| 			$this->maniaControl->client->forceSpectator($target->login, $spectatorState); | 			$this->maniaControl->getClient()->forceSpectator($target->login, $spectatorState); | ||||||
| 		} catch (ServerOptionsException $exception) { | 		} catch (ServerOptionsException $exception) { | ||||||
| 			$this->maniaControl->chat->sendException($exception, $admin->login); | 			$this->maniaControl->getChat()->sendException($exception, $admin->login); | ||||||
| 			return; | 			return; | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
| 		$title       = $this->maniaControl->authenticationManager->getAuthLevelName($admin->authLevel); | 		$title       = $this->maniaControl->getAuthenticationManager()->getAuthLevelName($admin->authLevel); | ||||||
| 		$chatMessage = $title . ' $<' . $admin->nickname . '$> forced $<' . $target->nickname . '$> to Spectator!'; | 		$chatMessage = $title . ' ' . $admin->getEscapedNickname(). ' forced ' . $target->getEscapedNickname(). ' to Spectator!'; | ||||||
| 		$this->maniaControl->chat->sendInformation($chatMessage); | 		$this->maniaControl->getChat()->sendInformation($chatMessage); | ||||||
| 		$this->maniaControl->log($chatMessage, true); | 		$this->maniaControl->log($chatMessage, true); | ||||||
|  |  | ||||||
| 		if ($releaseSlot) { | 		if ($releaseSlot) { | ||||||
| 			// Free player slot | 			// Free player slot | ||||||
| 			try { | 			try { | ||||||
| 				$this->maniaControl->client->spectatorReleasePlayerSlot($target->login); | 				$this->maniaControl->getClient()->spectatorReleasePlayerSlot($target->login); | ||||||
| 			} catch (PlayerStateException $e) { | 			} catch (PlayerStateException $e) { | ||||||
| 			} catch (UnknownPlayerException $e) { | 			} catch (UnknownPlayerException $e) { | ||||||
| 			} | 			} | ||||||
| @@ -218,28 +216,28 @@ class PlayerActions { | |||||||
| 	 * @param string $targetLogin | 	 * @param string $targetLogin | ||||||
| 	 */ | 	 */ | ||||||
| 	public function unMutePlayer($adminLogin, $targetLogin) { | 	public function unMutePlayer($adminLogin, $targetLogin) { | ||||||
| 		$admin = $this->maniaControl->playerManager->getPlayer($adminLogin); | 		$admin = $this->maniaControl->getPlayerManager()->getPlayer($adminLogin); | ||||||
| 		if (!$this->maniaControl->authenticationManager->checkPermission($admin, self::SETTING_PERMISSION_MUTE_PLAYER)) { | 		if (!$this->maniaControl->getAuthenticationManager()->checkPermission($admin, self::SETTING_PERMISSION_MUTE_PLAYER)) { | ||||||
| 			$this->maniaControl->authenticationManager->sendNotAllowed($admin); | 			$this->maniaControl->getAuthenticationManager()->sendNotAllowed($admin); | ||||||
| 			return; | 			return; | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
| 		$target = $this->maniaControl->playerManager->getPlayer($targetLogin); | 		$target = $this->maniaControl->getPlayerManager()->getPlayer($targetLogin); | ||||||
|  |  | ||||||
| 		if (!$target) { | 		if (!$target) { | ||||||
| 			return; | 			return; | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
| 		try { | 		try { | ||||||
| 			$this->maniaControl->client->unIgnore($targetLogin); | 			$this->maniaControl->getClient()->unIgnore($targetLogin); | ||||||
| 		} catch (NotInListException $e) { | 		} catch (NotInListException $e) { | ||||||
| 			$this->maniaControl->chat->sendError("Player is not ignored!"); | 			$this->maniaControl->getChat()->sendError('Player is not ignored!'); | ||||||
| 			return; | 			return; | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
| 		$title       = $this->maniaControl->authenticationManager->getAuthLevelName($admin->authLevel); | 		$title       = $this->maniaControl->getAuthenticationManager()->getAuthLevelName($admin->authLevel); | ||||||
| 		$chatMessage = $title . ' $<' . $admin->nickname . '$> un-muted $<' . $target->nickname . '$>!'; | 		$chatMessage = $title . ' ' . $admin->getEscapedNickname() . ' un-muted ' . $target->getEscapedNickname(). '!'; | ||||||
| 		$this->maniaControl->chat->sendInformation($chatMessage); | 		$this->maniaControl->getChat()->sendInformation($chatMessage); | ||||||
| 		$this->maniaControl->log($chatMessage, true); | 		$this->maniaControl->log($chatMessage, true); | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| @@ -250,28 +248,28 @@ class PlayerActions { | |||||||
| 	 * @param string $targetLogin | 	 * @param string $targetLogin | ||||||
| 	 */ | 	 */ | ||||||
| 	public function mutePlayer($adminLogin, $targetLogin) { | 	public function mutePlayer($adminLogin, $targetLogin) { | ||||||
| 		$admin = $this->maniaControl->playerManager->getPlayer($adminLogin); | 		$admin = $this->maniaControl->getPlayerManager()->getPlayer($adminLogin); | ||||||
| 		if (!$this->maniaControl->authenticationManager->checkPermission($admin, self::SETTING_PERMISSION_MUTE_PLAYER)) { | 		if (!$this->maniaControl->getAuthenticationManager()->checkPermission($admin, self::SETTING_PERMISSION_MUTE_PLAYER)) { | ||||||
| 			$this->maniaControl->authenticationManager->sendNotAllowed($admin); | 			$this->maniaControl->getAuthenticationManager()->sendNotAllowed($admin); | ||||||
| 			return; | 			return; | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
| 		$target = $this->maniaControl->playerManager->getPlayer($targetLogin); | 		$target = $this->maniaControl->getPlayerManager()->getPlayer($targetLogin); | ||||||
|  |  | ||||||
| 		if (!$target) { | 		if (!$target) { | ||||||
| 			return; | 			return; | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
| 		try { | 		try { | ||||||
| 			$this->maniaControl->client->ignore($targetLogin); | 			$this->maniaControl->getClient()->ignore($targetLogin); | ||||||
| 		} catch (AlreadyInListException $e) { | 		} catch (AlreadyInListException $e) { | ||||||
| 			$this->maniaControl->chat->sendError("Player already ignored!"); | 			$this->maniaControl->getChat()->sendError("Player already ignored!"); | ||||||
| 			return; | 			return; | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
| 		$title       = $this->maniaControl->authenticationManager->getAuthLevelName($admin->authLevel); | 		$title       = $this->maniaControl->getAuthenticationManager()->getAuthLevelName($admin->authLevel); | ||||||
| 		$chatMessage = $title . ' $<' . $admin->nickname . '$> muted $<' . $target->nickname . '$>!'; | 		$chatMessage = $title . ' ' . $admin->getEscapedNickname(). ' muted ' . $target->getEscapedNickname(). '!'; | ||||||
| 		$this->maniaControl->chat->sendInformation($chatMessage); | 		$this->maniaControl->getChat()->sendInformation($chatMessage); | ||||||
| 		$this->maniaControl->log($chatMessage, true); | 		$this->maniaControl->log($chatMessage, true); | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| @@ -282,13 +280,13 @@ class PlayerActions { | |||||||
| 	 * @param string $targetLogin | 	 * @param string $targetLogin | ||||||
| 	 */ | 	 */ | ||||||
| 	public function warnPlayer($adminLogin, $targetLogin) { | 	public function warnPlayer($adminLogin, $targetLogin) { | ||||||
| 		$admin = $this->maniaControl->playerManager->getPlayer($adminLogin); | 		$admin = $this->maniaControl->getPlayerManager()->getPlayer($adminLogin); | ||||||
| 		if (!$this->maniaControl->authenticationManager->checkPermission($admin, self::SETTING_PERMISSION_WARN_PLAYER)) { | 		if (!$this->maniaControl->getAuthenticationManager()->checkPermission($admin, self::SETTING_PERMISSION_WARN_PLAYER)) { | ||||||
| 			$this->maniaControl->authenticationManager->sendNotAllowed($admin); | 			$this->maniaControl->getAuthenticationManager()->sendNotAllowed($admin); | ||||||
| 			return; | 			return; | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
| 		$target = $this->maniaControl->playerManager->getPlayer($targetLogin); | 		$target = $this->maniaControl->getPlayerManager()->getPlayer($targetLogin); | ||||||
|  |  | ||||||
| 		if (!$target) { | 		if (!$target) { | ||||||
| 			return; | 			return; | ||||||
| @@ -303,8 +301,8 @@ class PlayerActions { | |||||||
| 		// Build Manialink | 		// Build Manialink | ||||||
| 		$width        = 80; | 		$width        = 80; | ||||||
| 		$height       = 50; | 		$height       = 50; | ||||||
| 		$quadStyle    = $this->maniaControl->manialinkManager->getStyleManager()->getDefaultMainWindowStyle(); | 		$quadStyle    = $this->maniaControl->getManialinkManager()->getStyleManager()->getDefaultMainWindowStyle(); | ||||||
| 		$quadSubstyle = $this->maniaControl->manialinkManager->getStyleManager()->getDefaultMainWindowSubStyle(); | 		$quadSubstyle = $this->maniaControl->getManialinkManager()->getStyleManager()->getDefaultMainWindowSubStyle(); | ||||||
|  |  | ||||||
| 		$maniaLink = new ManiaLink(ManialinkManager::MAIN_MLID); | 		$maniaLink = new ManiaLink(ManialinkManager::MAIN_MLID); | ||||||
| 		$frame     = new Frame(); | 		$frame     = new Frame(); | ||||||
| @@ -348,12 +346,12 @@ class PlayerActions { | |||||||
| 		} | 		} | ||||||
|  |  | ||||||
| 		// Display manialink | 		// Display manialink | ||||||
| 		$this->maniaControl->manialinkManager->displayWidget($maniaLink, $target); | 		$this->maniaControl->getManialinkManager()->displayWidget($maniaLink, $target); | ||||||
|  |  | ||||||
| 		// Announce warning | 		// Announce warning | ||||||
| 		$title       = $this->maniaControl->authenticationManager->getAuthLevelName($admin->authLevel); | 		$title       = $this->maniaControl->getAuthenticationManager()->getAuthLevelName($admin->authLevel); | ||||||
| 		$chatMessage = $title . ' $<' . $admin->nickname . '$> warned $<' . $target->nickname . '$>!'; | 		$chatMessage = $title . ' ' . $admin->getEscapedNickname(). ' warned ' . $target->getEscapedNickname(). '!'; | ||||||
| 		$this->maniaControl->chat->sendInformation($chatMessage); | 		$this->maniaControl->getChat()->sendInformation($chatMessage); | ||||||
| 		$this->maniaControl->log($chatMessage, true); | 		$this->maniaControl->log($chatMessage, true); | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| @@ -365,31 +363,31 @@ class PlayerActions { | |||||||
| 	 * @param string $message | 	 * @param string $message | ||||||
| 	 */ | 	 */ | ||||||
| 	public function kickPlayer($adminLogin, $targetLogin, $message = '') { | 	public function kickPlayer($adminLogin, $targetLogin, $message = '') { | ||||||
| 		$admin = $this->maniaControl->playerManager->getPlayer($adminLogin); | 		$admin = $this->maniaControl->getPlayerManager()->getPlayer($adminLogin); | ||||||
| 		if (!$this->maniaControl->authenticationManager->checkPermission($admin, self::SETTING_PERMISSION_KICK_PLAYER)) { | 		if (!$this->maniaControl->getAuthenticationManager()->checkPermission($admin, self::SETTING_PERMISSION_KICK_PLAYER)) { | ||||||
| 			$this->maniaControl->authenticationManager->sendNotAllowed($admin); | 			$this->maniaControl->getAuthenticationManager()->sendNotAllowed($admin); | ||||||
| 			return; | 			return; | ||||||
| 		} | 		} | ||||||
| 		$target = $this->maniaControl->playerManager->getPlayer($targetLogin); | 		$target = $this->maniaControl->getPlayerManager()->getPlayer($targetLogin); | ||||||
| 		if (!$target) { | 		if (!$target) { | ||||||
| 			return; | 			return; | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
| 		try { | 		try { | ||||||
| 			if ($target->isFakePlayer()) { | 			if ($target->isFakePlayer()) { | ||||||
| 				$this->maniaControl->client->disconnectFakePlayer($target->login); | 				$this->maniaControl->getClient()->disconnectFakePlayer($target->login); | ||||||
| 			} else { | 			} else { | ||||||
| 				$this->maniaControl->client->kick($target->login, $message); | 				$this->maniaControl->getClient()->kick($target->login, $message); | ||||||
| 			} | 			} | ||||||
| 		} catch (UnknownPlayerException $e) { | 		} catch (UnknownPlayerException $e) { | ||||||
| 			$this->maniaControl->chat->sendException($e, $admin->login); | 			$this->maniaControl->getChat()->sendException($e, $admin); | ||||||
| 			return; | 			return; | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
| 		// Announce kick | 		// Announce kick | ||||||
| 		$title       = $this->maniaControl->authenticationManager->getAuthLevelName($admin->authLevel); | 		$title       = $this->maniaControl->getAuthenticationManager()->getAuthLevelName($admin->authLevel); | ||||||
| 		$chatMessage = $title . ' ' . $admin->getEscapedNickname() . ' kicked ' . $target->getEscapedNickname() . '!'; | 		$chatMessage = $title . ' ' . $admin->getEscapedNickname() . ' kicked ' . $target->getEscapedNickname() . '!'; | ||||||
| 		$this->maniaControl->chat->sendInformation($chatMessage); | 		$this->maniaControl->getChat()->sendInformation($chatMessage); | ||||||
| 		$this->maniaControl->log(Formatter::stripCodes($chatMessage)); | 		$this->maniaControl->log(Formatter::stripCodes($chatMessage)); | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| @@ -401,27 +399,27 @@ class PlayerActions { | |||||||
| 	 * @param string $message | 	 * @param string $message | ||||||
| 	 */ | 	 */ | ||||||
| 	public function banPlayer($adminLogin, $targetLogin, $message = '') { | 	public function banPlayer($adminLogin, $targetLogin, $message = '') { | ||||||
| 		$admin = $this->maniaControl->playerManager->getPlayer($adminLogin); | 		$admin = $this->maniaControl->getPlayerManager()->getPlayer($adminLogin); | ||||||
| 		if (!$this->maniaControl->authenticationManager->checkPermission($admin, self::SETTING_PERMISSION_BAN_PLAYER)) { | 		if (!$this->maniaControl->getAuthenticationManager()->checkPermission($admin, self::SETTING_PERMISSION_BAN_PLAYER)) { | ||||||
| 			$this->maniaControl->authenticationManager->sendNotAllowed($admin); | 			$this->maniaControl->getAuthenticationManager()->sendNotAllowed($admin); | ||||||
| 			return; | 			return; | ||||||
| 		} | 		} | ||||||
| 		$target = $this->maniaControl->playerManager->getPlayer($targetLogin); | 		$target = $this->maniaControl->getPlayerManager()->getPlayer($targetLogin); | ||||||
| 		if (!$target) { | 		if (!$target) { | ||||||
| 			return; | 			return; | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
| 		if ($target->isFakePlayer()) { | 		if ($target->isFakePlayer()) { | ||||||
| 			$this->maniaControl->chat->sendError('It is not possible to Ban a bot', $admin->login); | 			$this->maniaControl->getChat()->sendError('It is not possible to Ban a bot', $admin); | ||||||
| 			return; | 			return; | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
| 		$this->maniaControl->client->ban($target->login, $message); | 		$this->maniaControl->getClient()->ban($target->login, $message); | ||||||
|  |  | ||||||
| 		// Announce ban | 		// Announce ban | ||||||
| 		$title       = $this->maniaControl->authenticationManager->getAuthLevelName($admin->authLevel); | 		$title       = $this->maniaControl->getAuthenticationManager()->getAuthLevelName($admin->authLevel); | ||||||
| 		$chatMessage = $title . ' $<' . $admin->nickname . '$> banned $<' . $target->nickname . '$>!'; | 		$chatMessage = $title . ' ' . $admin->getEscapedNickname(). ' banned ' . $target->getEscapedNickname(). '!'; | ||||||
| 		$this->maniaControl->chat->sendInformation($chatMessage); | 		$this->maniaControl->getChat()->sendInformation($chatMessage); | ||||||
| 		$this->maniaControl->log($chatMessage, true); | 		$this->maniaControl->log($chatMessage, true); | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| @@ -433,33 +431,33 @@ class PlayerActions { | |||||||
| 	 * @param int    $authLevel | 	 * @param int    $authLevel | ||||||
| 	 */ | 	 */ | ||||||
| 	public function grandAuthLevel($adminLogin, $targetLogin, $authLevel) { | 	public function grandAuthLevel($adminLogin, $targetLogin, $authLevel) { | ||||||
| 		$admin  = $this->maniaControl->playerManager->getPlayer($adminLogin); | 		$admin  = $this->maniaControl->getPlayerManager()->getPlayer($adminLogin); | ||||||
| 		$target = $this->maniaControl->playerManager->getPlayer($targetLogin); | 		$target = $this->maniaControl->getPlayerManager()->getPlayer($targetLogin); | ||||||
| 		if (!$admin || !$target) { | 		if (!$admin || !$target) { | ||||||
| 			return; | 			return; | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
| 		$authLevelName = $this->maniaControl->authenticationManager->getAuthLevelName($authLevel); | 		$authLevelName = $this->maniaControl->getAuthenticationManager()->getAuthLevelName($authLevel); | ||||||
| 		if (!$this->maniaControl->authenticationManager->checkRight($admin, $authLevel + 1)) { | 		if (!$this->maniaControl->getAuthenticationManager()->checkRight($admin, $authLevel + 1)) { | ||||||
| 			$this->maniaControl->chat->sendError("You don't have the permission to add a {$authLevelName}!", $admin->login); | 			$this->maniaControl->getChat()->sendError("You don't have the permission to add a {$authLevelName}!", $admin); | ||||||
| 			return; | 			return; | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
| 		if ($this->maniaControl->authenticationManager->checkRight($target, $authLevel)) { | 		if ($this->maniaControl->getAuthenticationManager()->checkRight($target, $authLevel)) { | ||||||
| 			$this->maniaControl->chat->sendError("This Player is already {$authLevelName}!", $admin->login); | 			$this->maniaControl->getChat()->sendError("This Player is already {$authLevelName}!", $admin); | ||||||
| 			return; | 			return; | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
| 		$success = $this->maniaControl->authenticationManager->grantAuthLevel($target, $authLevel); | 		$success = $this->maniaControl->getAuthenticationManager()->grantAuthLevel($target, $authLevel); | ||||||
| 		if (!$success) { | 		if (!$success) { | ||||||
| 			$this->maniaControl->chat->sendError('Error occurred.', $admin->login); | 			$this->maniaControl->getChat()->sendError('Error occurred.', $admin); | ||||||
| 			return; | 			return; | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
| 		// Announce granting | 		// Announce granting | ||||||
| 		$title       = $this->maniaControl->authenticationManager->getAuthLevelName($admin->authLevel); | 		$title       = $this->maniaControl->getAuthenticationManager()->getAuthLevelName($admin->authLevel); | ||||||
| 		$chatMessage = $title . ' $<' . $admin->nickname . '$> added $<' . $target->nickname . '$> as $< ' . $authLevelName . '$>!'; | 		$chatMessage = $title . ' ' . $admin->getEscapedNickname(). ' added ' . $target->getEscapedNickname(). ' as $< ' . $authLevelName . '$>!'; | ||||||
| 		$this->maniaControl->chat->sendInformation($chatMessage); | 		$this->maniaControl->getChat()->sendInformation($chatMessage); | ||||||
| 		$this->maniaControl->log($chatMessage, true); | 		$this->maniaControl->log($chatMessage, true); | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| @@ -470,33 +468,33 @@ class PlayerActions { | |||||||
| 	 * @param string $targetLogin | 	 * @param string $targetLogin | ||||||
| 	 */ | 	 */ | ||||||
| 	public function revokeAuthLevel($adminLogin, $targetLogin) { | 	public function revokeAuthLevel($adminLogin, $targetLogin) { | ||||||
| 		$admin  = $this->maniaControl->playerManager->getPlayer($adminLogin); | 		$admin  = $this->maniaControl->getPlayerManager()->getPlayer($adminLogin); | ||||||
| 		$target = $this->maniaControl->playerManager->getPlayer($targetLogin); | 		$target = $this->maniaControl->getPlayerManager()->getPlayer($targetLogin); | ||||||
| 		if (!$admin || !$target) { | 		if (!$admin || !$target) { | ||||||
| 			return; | 			return; | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
| 		if (!$this->maniaControl->authenticationManager->checkRight($admin, $target->authLevel + 1)) { | 		if (!$this->maniaControl->getAuthenticationManager()->checkRight($admin, $target->authLevel + 1)) { | ||||||
| 			$title = $this->maniaControl->authenticationManager->getAuthLevelName($target->authLevel); | 			$title = $this->maniaControl->getAuthenticationManager()->getAuthLevelName($target->authLevel); | ||||||
| 			$this->maniaControl->chat->sendError("You can't revoke the Rights of a {$title}!", $admin->login); | 			$this->maniaControl->getChat()->sendError("You can't revoke the Rights of a {$title}!", $admin); | ||||||
| 			return; | 			return; | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
| 		if ($this->maniaControl->authenticationManager->checkRight($target, AuthenticationManager::AUTH_LEVEL_MASTERADMIN)) { | 		if ($this->maniaControl->getAuthenticationManager()->checkRight($target, AuthenticationManager::AUTH_LEVEL_MASTERADMIN)) { | ||||||
| 			$this->maniaControl->chat->sendError("MasterAdmins can't be removed!", $admin->login); | 			$this->maniaControl->getChat()->sendError("MasterAdmins can't be removed!", $admin); | ||||||
| 			return; | 			return; | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
| 		$success = $this->maniaControl->authenticationManager->grantAuthLevel($target, AuthenticationManager::AUTH_LEVEL_PLAYER); | 		$success = $this->maniaControl->getAuthenticationManager()->grantAuthLevel($target, AuthenticationManager::AUTH_LEVEL_PLAYER); | ||||||
| 		if (!$success) { | 		if (!$success) { | ||||||
| 			$this->maniaControl->chat->sendError('Error occurred.', $admin->login); | 			$this->maniaControl->getChat()->sendError('Error occurred.', $admin); | ||||||
| 			return; | 			return; | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
| 		// Announce revoke | 		// Announce revoke | ||||||
| 		$title       = $this->maniaControl->authenticationManager->getAuthLevelName($admin->authLevel); | 		$title       = $this->maniaControl->getAuthenticationManager()->getAuthLevelName($admin->authLevel); | ||||||
| 		$chatMessage = $title . ' $<' . $admin->nickname . '$> revoked the Rights of $<' . $target->nickname . '$>!'; | 		$chatMessage = $title . ' ' . $admin->getEscapedNickname(). ' revoked the Rights of ' . $target->getEscapedNickname(). '!'; | ||||||
| 		$this->maniaControl->chat->sendInformation($chatMessage); | 		$this->maniaControl->getChat()->sendInformation($chatMessage); | ||||||
| 		$this->maniaControl->log($chatMessage, true); | 		$this->maniaControl->log($chatMessage, true); | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| @@ -507,7 +505,7 @@ class PlayerActions { | |||||||
| 	 * @return bool | 	 * @return bool | ||||||
| 	 */ | 	 */ | ||||||
| 	public function isPlayerMuted($login) { | 	public function isPlayerMuted($login) { | ||||||
| 		$ignoreList = $this->maniaControl->client->getIgnoreList(100, 0); | 		$ignoreList = $this->maniaControl->getClient()->getIgnoreList(100, 0); | ||||||
| 		foreach ($ignoreList as $ignoredPlayers) { | 		foreach ($ignoreList as $ignoredPlayers) { | ||||||
| 			if ($ignoredPlayers->login === $login) { | 			if ($ignoredPlayers->login === $login) { | ||||||
| 				return true; | 				return true; | ||||||
|   | |||||||
| @@ -43,35 +43,35 @@ class PlayerCommands implements CommandListener, ManialinkPageAnswerListener, Ca | |||||||
| 	public function __construct(ManiaControl $maniaControl) { | 	public function __construct(ManiaControl $maniaControl) { | ||||||
| 		$this->maniaControl = $maniaControl; | 		$this->maniaControl = $maniaControl; | ||||||
|  |  | ||||||
| 		// Register for admin commands | 		// Admin commands | ||||||
| 		$this->maniaControl->commandManager->registerCommandListener(array('balance', 'teambalance', 'autoteambalance'), $this, 'command_TeamBalance', true, 'Balances the teams.'); | 		$this->maniaControl->getCommandManager()->registerCommandListener(array('balance', 'teambalance', 'autoteambalance'), $this, 'command_TeamBalance', true, 'Balances the teams.'); | ||||||
| 		$this->maniaControl->commandManager->registerCommandListener('kick', $this, 'command_Kick', true, 'Kicks player from the server.'); | 		$this->maniaControl->getCommandManager()->registerCommandListener('kick', $this, 'command_Kick', true, 'Kicks player from the server.'); | ||||||
| 		$this->maniaControl->commandManager->registerCommandListener('ban', $this, 'command_Ban', true, 'Bans player from the server.'); | 		$this->maniaControl->getCommandManager()->registerCommandListener('ban', $this, 'command_Ban', true, 'Bans player from the server.'); | ||||||
| 		$this->maniaControl->commandManager->registerCommandListener(array('forcespec', 'forcespectator'), $this, 'command_ForceSpectator', true, 'Forces player into spectator.'); | 		$this->maniaControl->getCommandManager()->registerCommandListener(array('forcespec', 'forcespectator'), $this, 'command_ForceSpectator', true, 'Forces player into spectator.'); | ||||||
| 		$this->maniaControl->commandManager->registerCommandListener('forceplay', $this, 'command_ForcePlay', true, 'Forces player into Play mode.'); | 		$this->maniaControl->getCommandManager()->registerCommandListener('forceplay', $this, 'command_ForcePlay', true, 'Forces player into Play mode.'); | ||||||
| 		$this->maniaControl->commandManager->registerCommandListener('forceblue', $this, 'command_ForceBlue', true, 'Forces player into blue team.'); | 		$this->maniaControl->getCommandManager()->registerCommandListener('forceblue', $this, 'command_ForceBlue', true, 'Forces player into blue team.'); | ||||||
| 		$this->maniaControl->commandManager->registerCommandListener('forcered', $this, 'command_ForceRed', true, 'Forces player into red team.'); | 		$this->maniaControl->getCommandManager()->registerCommandListener('forcered', $this, 'command_ForceRed', true, 'Forces player into red team.'); | ||||||
| 		$this->maniaControl->commandManager->registerCommandListener(array('addbots', 'addbot'), $this, 'command_AddFakePlayers', true, 'Adds bots to the game.'); | 		$this->maniaControl->getCommandManager()->registerCommandListener(array('addbots', 'addbot'), $this, 'command_AddFakePlayers', true, 'Adds bots to the game.'); | ||||||
| 		$this->maniaControl->commandManager->registerCommandListener(array('removebot', 'removebots'), $this, 'command_RemoveFakePlayers', true, 'Removes bots from the game.'); | 		$this->maniaControl->getCommandManager()->registerCommandListener(array('removebot', 'removebots'), $this, 'command_RemoveFakePlayers', true, 'Removes bots from the game.'); | ||||||
| 		$this->maniaControl->commandManager->registerCommandListener('mute', $this, 'command_MutePlayer', true, 'Mutes a player (prevents player from chatting).'); | 		$this->maniaControl->getCommandManager()->registerCommandListener('mute', $this, 'command_MutePlayer', true, 'Mutes a player (prevents player from chatting).'); | ||||||
| 		$this->maniaControl->commandManager->registerCommandListener('unmute', $this, 'command_UnmutePlayer', true, 'Unmute a player (enables player to chat again).'); | 		$this->maniaControl->getCommandManager()->registerCommandListener('unmute', $this, 'command_UnmutePlayer', true, 'Unmute a player (enables player to chat again).'); | ||||||
|  |  | ||||||
| 		// Register for player chat commands | 		// Player commands | ||||||
| 		$this->maniaControl->commandManager->registerCommandListener(array('player', 'players'), $this, 'command_playerList', false, 'Shows players currently on the server.'); | 		$this->maniaControl->getCommandManager()->registerCommandListener(array('player', 'players'), $this, 'command_playerList', false, 'Shows players currently on the server.'); | ||||||
|  |  | ||||||
| 		//Define Rights | 		// Permissions | ||||||
| 		$this->maniaControl->authenticationManager->definePermissionLevel(self::SETTING_PERMISSION_ADD_BOT, AuthenticationManager::AUTH_LEVEL_MODERATOR); | 		$this->maniaControl->getAuthenticationManager()->definePermissionLevel(self::SETTING_PERMISSION_ADD_BOT, AuthenticationManager::AUTH_LEVEL_MODERATOR); | ||||||
| 		$this->maniaControl->authenticationManager->definePermissionLevel(self::SETTING_PERMISSION_TEAM_BALANCE, AuthenticationManager::AUTH_LEVEL_MODERATOR); | 		$this->maniaControl->getAuthenticationManager()->definePermissionLevel(self::SETTING_PERMISSION_TEAM_BALANCE, AuthenticationManager::AUTH_LEVEL_MODERATOR); | ||||||
|  |  | ||||||
| 		//CallbackManager | 		// Callbacks | ||||||
| 		$this->maniaControl->callbackManager->registerCallbackListener(Server::CB_TEAM_MODE_CHANGED, $this, 'teamStatusChanged'); | 		$this->maniaControl->getCallbackManager()->registerCallbackListener(Server::CB_TEAM_MODE_CHANGED, $this, 'teamStatusChanged'); | ||||||
|  |  | ||||||
| 		// Action Open PlayerList | 		// Action Open PlayerList | ||||||
| 		$this->maniaControl->manialinkManager->registerManialinkPageAnswerListener(self::ACTION_OPEN_PLAYERLIST, $this, 'command_playerList'); | 		$this->maniaControl->getManialinkManager()->registerManialinkPageAnswerListener(self::ACTION_OPEN_PLAYERLIST, $this, 'command_playerList'); | ||||||
| 		$itemQuad = new Quad_UIConstruction_Buttons(); | 		$itemQuad = new Quad_UIConstruction_Buttons(); | ||||||
| 		$itemQuad->setSubStyle($itemQuad::SUBSTYLE_Author); | 		$itemQuad->setSubStyle($itemQuad::SUBSTYLE_Author); | ||||||
| 		$itemQuad->setAction(self::ACTION_OPEN_PLAYERLIST); | 		$itemQuad->setAction(self::ACTION_OPEN_PLAYERLIST); | ||||||
| 		$this->maniaControl->actionsMenu->addMenuItem($itemQuad, true, 15, 'Open PlayerList'); | 		$this->maniaControl->getActionsMenu()->addMenuItem($itemQuad, true, 15, 'Open PlayerList'); | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	/** | 	/** | ||||||
| @@ -83,11 +83,11 @@ class PlayerCommands implements CommandListener, ManialinkPageAnswerListener, Ca | |||||||
| 		//Add Balance Team Icon if it's a teamMode | 		//Add Balance Team Icon if it's a teamMode | ||||||
| 		if ($teamMode) { | 		if ($teamMode) { | ||||||
| 			// Action Balance Teams | 			// Action Balance Teams | ||||||
| 			$this->maniaControl->manialinkManager->registerManialinkPageAnswerListener(self::ACTION_BALANCE_TEAMS, $this, 'command_TeamBalance'); | 			$this->maniaControl->getManialinkManager()->registerManialinkPageAnswerListener(self::ACTION_BALANCE_TEAMS, $this, 'command_TeamBalance'); | ||||||
| 			$itemQuad = new Quad_Icons128x32_1(); | 			$itemQuad = new Quad_Icons128x32_1(); | ||||||
| 			$itemQuad->setSubStyle($itemQuad::SUBSTYLE_RT_Team); | 			$itemQuad->setSubStyle($itemQuad::SUBSTYLE_RT_Team); | ||||||
| 			$itemQuad->setAction(self::ACTION_BALANCE_TEAMS); | 			$itemQuad->setAction(self::ACTION_BALANCE_TEAMS); | ||||||
| 			$this->maniaControl->actionsMenu->addMenuItem($itemQuad, false, 40, 'Balance Teams'); | 			$this->maniaControl->getActionsMenu()->addMenuItem($itemQuad, false, 40, 'Balance Teams'); | ||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| @@ -98,19 +98,19 @@ class PlayerCommands implements CommandListener, ManialinkPageAnswerListener, Ca | |||||||
| 	 * @param Player $player | 	 * @param Player $player | ||||||
| 	 */ | 	 */ | ||||||
| 	public function command_TeamBalance(array $chatCallback, Player $player) { | 	public function command_TeamBalance(array $chatCallback, Player $player) { | ||||||
| 		if (!$this->maniaControl->authenticationManager->checkPermission($player, self::SETTING_PERMISSION_TEAM_BALANCE)) { | 		if (!$this->maniaControl->getAuthenticationManager()->checkPermission($player, self::SETTING_PERMISSION_TEAM_BALANCE)) { | ||||||
| 			$this->maniaControl->authenticationManager->sendNotAllowed($player); | 			$this->maniaControl->getAuthenticationManager()->sendNotAllowed($player); | ||||||
| 			return; | 			return; | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
| 		try { | 		try { | ||||||
| 			$this->maniaControl->client->autoTeamBalance(); | 			$this->maniaControl->getClient()->autoTeamBalance(); | ||||||
| 		} catch (GameModeException $exception) { | 		} catch (GameModeException $exception) { | ||||||
| 			$this->maniaControl->chat->sendException($exception, $player); | 			$this->maniaControl->getChat()->sendException($exception, $player); | ||||||
| 			return; | 			return; | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
| 		$this->maniaControl->chat->sendInformation($player->getEscapedNickname() . ' balanced Teams!'); | 		$this->maniaControl->getChat()->sendInformation($player->getEscapedNickname() . ' balanced Teams!'); | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	/** | 	/** | ||||||
| @@ -120,13 +120,13 @@ class PlayerCommands implements CommandListener, ManialinkPageAnswerListener, Ca | |||||||
| 	 * @param Player $player | 	 * @param Player $player | ||||||
| 	 */ | 	 */ | ||||||
| 	public function command_Kick(array $chat, Player $player) { | 	public function command_Kick(array $chat, Player $player) { | ||||||
| 		if (!$this->maniaControl->authenticationManager->checkPermission($player, PlayerActions::SETTING_PERMISSION_KICK_PLAYER)) { | 		if (!$this->maniaControl->getAuthenticationManager()->checkPermission($player, PlayerActions::SETTING_PERMISSION_KICK_PLAYER)) { | ||||||
| 			$this->maniaControl->authenticationManager->sendNotAllowed($player); | 			$this->maniaControl->getAuthenticationManager()->sendNotAllowed($player); | ||||||
| 			return; | 			return; | ||||||
| 		} | 		} | ||||||
| 		$params = explode(' ', $chat[1][2], 3); | 		$params = explode(' ', $chat[1][2], 3); | ||||||
| 		if (count($params) <= 1) { | 		if (count($params) <= 1) { | ||||||
| 			$this->maniaControl->chat->sendUsageInfo("No Login given! Example: '//kick login'", $player->login); | 			$this->maniaControl->getChat()->sendUsageInfo("No Login given! Example: '//kick login'", $player->login); | ||||||
| 			return; | 			return; | ||||||
| 		} | 		} | ||||||
| 		$targetLogin = $params[1]; | 		$targetLogin = $params[1]; | ||||||
| @@ -134,7 +134,7 @@ class PlayerCommands implements CommandListener, ManialinkPageAnswerListener, Ca | |||||||
| 		if (isset($params[2])) { | 		if (isset($params[2])) { | ||||||
| 			$message = $params[2]; | 			$message = $params[2]; | ||||||
| 		} | 		} | ||||||
| 		$this->maniaControl->playerManager->getPlayerActions()->kickPlayer($player->login, $targetLogin, $message); | 		$this->maniaControl->getPlayerManager()->getPlayerActions()->kickPlayer($player->login, $targetLogin, $message); | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	/** | 	/** | ||||||
| @@ -144,13 +144,13 @@ class PlayerCommands implements CommandListener, ManialinkPageAnswerListener, Ca | |||||||
| 	 * @param Player $player | 	 * @param Player $player | ||||||
| 	 */ | 	 */ | ||||||
| 	public function command_Ban(array $chat, Player $player) { | 	public function command_Ban(array $chat, Player $player) { | ||||||
| 		if (!$this->maniaControl->authenticationManager->checkPermission($player, PlayerActions::SETTING_PERMISSION_BAN_PLAYER)) { | 		if (!$this->maniaControl->getAuthenticationManager()->checkPermission($player, PlayerActions::SETTING_PERMISSION_BAN_PLAYER)) { | ||||||
| 			$this->maniaControl->authenticationManager->sendNotAllowed($player); | 			$this->maniaControl->getAuthenticationManager()->sendNotAllowed($player); | ||||||
| 			return; | 			return; | ||||||
| 		} | 		} | ||||||
| 		$params = explode(' ', $chat[1][2], 3); | 		$params = explode(' ', $chat[1][2], 3); | ||||||
| 		if (count($params) <= 1) { | 		if (count($params) <= 1) { | ||||||
| 			$this->maniaControl->chat->sendUsageInfo("No Login given! Example: '//ban login'", $player->login); | 			$this->maniaControl->getChat()->sendUsageInfo("No Login given! Example: '//ban login'", $player->login); | ||||||
| 			return; | 			return; | ||||||
| 		} | 		} | ||||||
| 		$targetLogin = $params[1]; | 		$targetLogin = $params[1]; | ||||||
| @@ -158,7 +158,7 @@ class PlayerCommands implements CommandListener, ManialinkPageAnswerListener, Ca | |||||||
| 		if (isset($params[2])) { | 		if (isset($params[2])) { | ||||||
| 			$message = $params[2]; | 			$message = $params[2]; | ||||||
| 		} | 		} | ||||||
| 		$this->maniaControl->playerManager->getPlayerActions()->banPlayer($player->login, $targetLogin, $message); | 		$this->maniaControl->getPlayerManager()->getPlayerActions()->banPlayer($player->login, $targetLogin, $message); | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	/** | 	/** | ||||||
| @@ -170,11 +170,11 @@ class PlayerCommands implements CommandListener, ManialinkPageAnswerListener, Ca | |||||||
| 	public function command_Warn(array $chatCallback, Player $player) { | 	public function command_Warn(array $chatCallback, Player $player) { | ||||||
| 		$params = explode(' ', $chatCallback[1][2], 3); | 		$params = explode(' ', $chatCallback[1][2], 3); | ||||||
| 		if (count($params) <= 1) { | 		if (count($params) <= 1) { | ||||||
| 			$this->maniaControl->chat->sendUsageInfo("No Login given! Example: '//warn login'", $player->login); | 			$this->maniaControl->getChat()->sendUsageInfo("No Login given! Example: '//warn login'", $player->login); | ||||||
| 			return; | 			return; | ||||||
| 		} | 		} | ||||||
| 		$targetLogin = $params[1]; | 		$targetLogin = $params[1]; | ||||||
| 		$this->maniaControl->playerManager->getPlayerActions()->warnPlayer($player->login, $targetLogin); | 		$this->maniaControl->getPlayerManager()->getPlayerActions()->warnPlayer($player->login, $targetLogin); | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	/** | 	/** | ||||||
| @@ -184,22 +184,22 @@ class PlayerCommands implements CommandListener, ManialinkPageAnswerListener, Ca | |||||||
| 	 * @param Player $player | 	 * @param Player $player | ||||||
| 	 */ | 	 */ | ||||||
| 	public function command_ForceSpectator(array $chat, Player $player) { | 	public function command_ForceSpectator(array $chat, Player $player) { | ||||||
| 		if (!$this->maniaControl->authenticationManager->checkPermission($player, PlayerActions::SETTING_PERMISSION_FORCE_PLAYER_SPEC)) { | 		if (!$this->maniaControl->getAuthenticationManager()->checkPermission($player, PlayerActions::SETTING_PERMISSION_FORCE_PLAYER_SPEC)) { | ||||||
| 			$this->maniaControl->authenticationManager->sendNotAllowed($player); | 			$this->maniaControl->getAuthenticationManager()->sendNotAllowed($player); | ||||||
| 			return; | 			return; | ||||||
| 		} | 		} | ||||||
| 		$params = explode(' ', $chat[1][2]); | 		$params = explode(' ', $chat[1][2]); | ||||||
| 		if (count($params) <= 1) { | 		if (count($params) <= 1) { | ||||||
| 			$this->maniaControl->chat->sendUsageInfo("No Login given! Example: '//forcespec login'", $player->login); | 			$this->maniaControl->getChat()->sendUsageInfo("No Login given! Example: '//forcespec login'", $player->login); | ||||||
| 			return; | 			return; | ||||||
| 		} | 		} | ||||||
| 		$targetLogin = $params[1]; | 		$targetLogin = $params[1]; | ||||||
|  |  | ||||||
| 		if (isset($params[2]) && is_numeric($params[2])) { | 		if (isset($params[2]) && is_numeric($params[2])) { | ||||||
| 			$type = (int)$params[2]; | 			$type = (int)$params[2]; | ||||||
| 			$this->maniaControl->playerManager->getPlayerActions()->forcePlayerToSpectator($player->login, $targetLogin, $type); | 			$this->maniaControl->getPlayerManager()->getPlayerActions()->forcePlayerToSpectator($player->login, $targetLogin, $type); | ||||||
| 		} else { | 		} else { | ||||||
| 			$this->maniaControl->playerManager->getPlayerActions()->forcePlayerToSpectator($player->login, $targetLogin); | 			$this->maniaControl->getPlayerManager()->getPlayerActions()->forcePlayerToSpectator($player->login, $targetLogin); | ||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| @@ -210,13 +210,13 @@ class PlayerCommands implements CommandListener, ManialinkPageAnswerListener, Ca | |||||||
| 	 * @param Player $player | 	 * @param Player $player | ||||||
| 	 */ | 	 */ | ||||||
| 	public function command_ForcePlay(array $chat, Player $player) { | 	public function command_ForcePlay(array $chat, Player $player) { | ||||||
| 		if (!$this->maniaControl->authenticationManager->checkPermission($player, PlayerActions::SETTING_PERMISSION_FORCE_PLAYER_PLAY)) { | 		if (!$this->maniaControl->getAuthenticationManager()->checkPermission($player, PlayerActions::SETTING_PERMISSION_FORCE_PLAYER_PLAY)) { | ||||||
| 			$this->maniaControl->authenticationManager->sendNotAllowed($player); | 			$this->maniaControl->getAuthenticationManager()->sendNotAllowed($player); | ||||||
| 			return; | 			return; | ||||||
| 		} | 		} | ||||||
| 		$params = explode(' ', $chat[1][2]); | 		$params = explode(' ', $chat[1][2]); | ||||||
| 		if (!isset($params[1])) { | 		if (!isset($params[1])) { | ||||||
| 			$this->maniaControl->chat->sendUsageInfo("No Login given! Example: '//forceplay login'", $player->login); | 			$this->maniaControl->getChat()->sendUsageInfo("No Login given! Example: '//forceplay login'", $player->login); | ||||||
| 			return; | 			return; | ||||||
| 		} | 		} | ||||||
| 		$targetLogin = $params[1]; | 		$targetLogin = $params[1]; | ||||||
| @@ -227,7 +227,7 @@ class PlayerCommands implements CommandListener, ManialinkPageAnswerListener, Ca | |||||||
| 		} | 		} | ||||||
| 		$selectable = ($type === 2); | 		$selectable = ($type === 2); | ||||||
|  |  | ||||||
| 		$this->maniaControl->playerManager->getPlayerActions()->forcePlayerToPlay($player->login, $targetLogin, $selectable); | 		$this->maniaControl->getPlayerManager()->getPlayerActions()->forcePlayerToPlay($player->login, $targetLogin, $selectable); | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	/** | 	/** | ||||||
| @@ -237,18 +237,18 @@ class PlayerCommands implements CommandListener, ManialinkPageAnswerListener, Ca | |||||||
| 	 * @param Player $player | 	 * @param Player $player | ||||||
| 	 */ | 	 */ | ||||||
| 	public function command_ForceBlue(array $chat, Player $player) { | 	public function command_ForceBlue(array $chat, Player $player) { | ||||||
| 		if (!$this->maniaControl->authenticationManager->checkPermission($player, PlayerActions::SETTING_PERMISSION_FORCE_PLAYER_TEAM)) { | 		if (!$this->maniaControl->getAuthenticationManager()->checkPermission($player, PlayerActions::SETTING_PERMISSION_FORCE_PLAYER_TEAM)) { | ||||||
| 			$this->maniaControl->authenticationManager->sendNotAllowed($player); | 			$this->maniaControl->getAuthenticationManager()->sendNotAllowed($player); | ||||||
| 			return; | 			return; | ||||||
| 		} | 		} | ||||||
| 		$params = explode(' ', $chat[1][2]); | 		$params = explode(' ', $chat[1][2]); | ||||||
| 		if (!isset($params[1])) { | 		if (!isset($params[1])) { | ||||||
| 			$this->maniaControl->chat->sendUsageInfo("No Login given! Example: '//forceblue login'", $player->login); | 			$this->maniaControl->getChat()->sendUsageInfo("No Login given! Example: '//forceblue login'", $player->login); | ||||||
| 			return; | 			return; | ||||||
| 		} | 		} | ||||||
| 		$targetLogin = $params[1]; | 		$targetLogin = $params[1]; | ||||||
|  |  | ||||||
| 		$this->maniaControl->playerManager->getPlayerActions()->forcePlayerToTeam($player->login, $targetLogin, PlayerActions::TEAM_BLUE); | 		$this->maniaControl->getPlayerManager()->getPlayerActions()->forcePlayerToTeam($player->login, $targetLogin, PlayerActions::TEAM_BLUE); | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	/** | 	/** | ||||||
| @@ -258,18 +258,18 @@ class PlayerCommands implements CommandListener, ManialinkPageAnswerListener, Ca | |||||||
| 	 * @param Player $player | 	 * @param Player $player | ||||||
| 	 */ | 	 */ | ||||||
| 	public function command_ForceRed(array $chat, Player $player) { | 	public function command_ForceRed(array $chat, Player $player) { | ||||||
| 		if (!$this->maniaControl->authenticationManager->checkPermission($player, PlayerActions::SETTING_PERMISSION_FORCE_PLAYER_TEAM)) { | 		if (!$this->maniaControl->getAuthenticationManager()->checkPermission($player, PlayerActions::SETTING_PERMISSION_FORCE_PLAYER_TEAM)) { | ||||||
| 			$this->maniaControl->authenticationManager->sendNotAllowed($player); | 			$this->maniaControl->getAuthenticationManager()->sendNotAllowed($player); | ||||||
| 			return; | 			return; | ||||||
| 		} | 		} | ||||||
| 		$params = explode(' ', $chat[1][2]); | 		$params = explode(' ', $chat[1][2]); | ||||||
| 		if (!isset($params[1])) { | 		if (!isset($params[1])) { | ||||||
| 			$this->maniaControl->chat->sendUsageInfo("No Login given! Example: '//forcered login'", $player->login); | 			$this->maniaControl->getChat()->sendUsageInfo("No Login given! Example: '//forcered login'", $player->login); | ||||||
| 			return; | 			return; | ||||||
| 		} | 		} | ||||||
| 		$targetLogin = $params[1]; | 		$targetLogin = $params[1]; | ||||||
|  |  | ||||||
| 		$this->maniaControl->playerManager->getPlayerActions()->forcePlayerToTeam($player->login, $targetLogin, PlayerActions::TEAM_RED); | 		$this->maniaControl->getPlayerManager()->getPlayerActions()->forcePlayerToTeam($player->login, $targetLogin, PlayerActions::TEAM_RED); | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	/** | 	/** | ||||||
| @@ -279,8 +279,8 @@ class PlayerCommands implements CommandListener, ManialinkPageAnswerListener, Ca | |||||||
| 	 * @param Player $player | 	 * @param Player $player | ||||||
| 	 */ | 	 */ | ||||||
| 	public function command_AddFakePlayers(array $chatCallback, Player $player) { | 	public function command_AddFakePlayers(array $chatCallback, Player $player) { | ||||||
| 		if (!$this->maniaControl->authenticationManager->checkPermission($player, self::SETTING_PERMISSION_ADD_BOT)) { | 		if (!$this->maniaControl->getAuthenticationManager()->checkPermission($player, self::SETTING_PERMISSION_ADD_BOT)) { | ||||||
| 			$this->maniaControl->authenticationManager->sendNotAllowed($player); | 			$this->maniaControl->getAuthenticationManager()->sendNotAllowed($player); | ||||||
| 			return; | 			return; | ||||||
| 		} | 		} | ||||||
| 		$amount       = 1; | 		$amount       = 1; | ||||||
| @@ -291,11 +291,11 @@ class PlayerCommands implements CommandListener, ManialinkPageAnswerListener, Ca | |||||||
|  |  | ||||||
| 		try { | 		try { | ||||||
| 			for ($i = 0; $i < $amount; $i++) { | 			for ($i = 0; $i < $amount; $i++) { | ||||||
| 				$this->maniaControl->client->connectFakePlayer(); | 				$this->maniaControl->getClient()->connectFakePlayer(); | ||||||
| 			} | 			} | ||||||
| 			$this->maniaControl->chat->sendSuccess('Fake players connected!', $player->login); | 			$this->maniaControl->getChat()->sendSuccess('Fake players connected!', $player); | ||||||
| 		} catch (UnavailableFeatureException $e) { | 		} catch (UnavailableFeatureException $e) { | ||||||
| 			$this->maniaControl->chat->sendSuccess('Error while connecting a Fake-Player.', $player->login); | 			$this->maniaControl->getChat()->sendSuccess('Error while connecting a Fake-Player.', $player); | ||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| @@ -306,12 +306,12 @@ class PlayerCommands implements CommandListener, ManialinkPageAnswerListener, Ca | |||||||
| 	 * @param Player $player | 	 * @param Player $player | ||||||
| 	 */ | 	 */ | ||||||
| 	public function command_RemoveFakePlayers(array $chatCallback, Player $player) { | 	public function command_RemoveFakePlayers(array $chatCallback, Player $player) { | ||||||
| 		if (!$this->maniaControl->authenticationManager->checkPermission($player, self::SETTING_PERMISSION_ADD_BOT)) { | 		if (!$this->maniaControl->getAuthenticationManager()->checkPermission($player, self::SETTING_PERMISSION_ADD_BOT)) { | ||||||
| 			$this->maniaControl->authenticationManager->sendNotAllowed($player); | 			$this->maniaControl->getAuthenticationManager()->sendNotAllowed($player); | ||||||
| 			return; | 			return; | ||||||
| 		} | 		} | ||||||
| 		$this->maniaControl->client->disconnectFakePlayer('*'); | 		$this->maniaControl->getClient()->disconnectFakePlayer('*'); | ||||||
| 		$this->maniaControl->chat->sendSuccess('Fake players disconnected!', $player->login); | 		$this->maniaControl->getChat()->sendSuccess('Fake players disconnected!', $player); | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	/** | 	/** | ||||||
| @@ -323,11 +323,11 @@ class PlayerCommands implements CommandListener, ManialinkPageAnswerListener, Ca | |||||||
| 	public function command_MutePlayer(array $chatCallback, Player $admin) { | 	public function command_MutePlayer(array $chatCallback, Player $admin) { | ||||||
| 		$commandParts = explode(' ', $chatCallback[1][2]); | 		$commandParts = explode(' ', $chatCallback[1][2]); | ||||||
| 		if (count($commandParts) <= 1) { | 		if (count($commandParts) <= 1) { | ||||||
| 			$this->maniaControl->chat->sendUsageInfo("No login specified! Example: '//mute login'"); | 			$this->maniaControl->getChat()->sendUsageInfo("No login specified! Example: '//mute login'", $admin); | ||||||
| 			return; | 			return; | ||||||
| 		} | 		} | ||||||
| 		$targetLogin = $commandParts[1]; | 		$targetLogin = $commandParts[1]; | ||||||
| 		$this->maniaControl->playerManager->getPlayerActions()->mutePlayer($admin->login, $targetLogin); | 		$this->maniaControl->getPlayerManager()->getPlayerActions()->mutePlayer($admin->login, $targetLogin); | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	/** | 	/** | ||||||
| @@ -339,11 +339,11 @@ class PlayerCommands implements CommandListener, ManialinkPageAnswerListener, Ca | |||||||
| 	public function command_UnmutePlayer(array $chatCallback, Player $admin) { | 	public function command_UnmutePlayer(array $chatCallback, Player $admin) { | ||||||
| 		$commandParts = explode(' ', $chatCallback[1][2]); | 		$commandParts = explode(' ', $chatCallback[1][2]); | ||||||
| 		if (count($commandParts) <= 1) { | 		if (count($commandParts) <= 1) { | ||||||
| 			$this->maniaControl->chat->sendUsageInfo("No login specified! Example: '//unmute login'"); | 			$this->maniaControl->getChat()->sendUsageInfo("No login specified! Example: '//unmute login'", $admin); | ||||||
| 			return; | 			return; | ||||||
| 		} | 		} | ||||||
| 		$targetLogin = $commandParts[1]; | 		$targetLogin = $commandParts[1]; | ||||||
| 		$this->maniaControl->playerManager->getPlayerActions()->unMutePlayer($admin->login, $targetLogin); | 		$this->maniaControl->getPlayerManager()->getPlayerActions()->unMutePlayer($admin->login, $targetLogin); | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	/** | 	/** | ||||||
| @@ -353,7 +353,7 @@ class PlayerCommands implements CommandListener, ManialinkPageAnswerListener, Ca | |||||||
| 	 * @param Player $player | 	 * @param Player $player | ||||||
| 	 */ | 	 */ | ||||||
| 	public function command_playerList(array $chatCallback, Player $player) { | 	public function command_playerList(array $chatCallback, Player $player) { | ||||||
| 		$this->maniaControl->playerManager->getPlayerList()->addPlayerToShownList($player, PlayerList::SHOWN_MAIN_WINDOW); | 		$this->maniaControl->getPlayerManager()->getPlayerList()->addPlayerToShownList($player, PlayerList::SHOWN_MAIN_WINDOW); | ||||||
| 		$this->maniaControl->playerManager->getPlayerList()->showPlayerList($player); | 		$this->maniaControl->getPlayerManager()->getPlayerList()->showPlayerList($player); | ||||||
| 	} | 	} | ||||||
| } | } | ||||||
|   | |||||||
| @@ -50,7 +50,7 @@ class PlayerDataManager { | |||||||
| 	 * @return bool | 	 * @return bool | ||||||
| 	 */ | 	 */ | ||||||
| 	private function initTables() { | 	private function initTables() { | ||||||
| 		$mysqli      = $this->maniaControl->database->mysqli; | 		$mysqli      = $this->maniaControl->getDatabase()->getMysqli(); | ||||||
| 		$defaultType = "'" . self::TYPE_STRING . "'"; | 		$defaultType = "'" . self::TYPE_STRING . "'"; | ||||||
| 		$typeSet     = $defaultType . ",'" . self::TYPE_INT . "','" . self::TYPE_REAL . "','" . self::TYPE_BOOL . "','" . self::TYPE_ARRAY . "'"; | 		$typeSet     = $defaultType . ",'" . self::TYPE_INT . "','" . self::TYPE_REAL . "','" . self::TYPE_BOOL . "','" . self::TYPE_ARRAY . "'"; | ||||||
| 		$query       = "CREATE TABLE IF NOT EXISTS `" . self::TABLE_PLAYERDATAMETADATA . "` ( | 		$query       = "CREATE TABLE IF NOT EXISTS `" . self::TABLE_PLAYERDATAMETADATA . "` ( | ||||||
| @@ -103,7 +103,7 @@ class PlayerDataManager { | |||||||
| 	 * Store Meta Data from the Database in the Ram | 	 * Store Meta Data from the Database in the Ram | ||||||
| 	 */ | 	 */ | ||||||
| 	private function storeMetaData() { | 	private function storeMetaData() { | ||||||
| 		$mysqli = $this->maniaControl->database->mysqli; | 		$mysqli = $this->maniaControl->getDatabase()->getMysqli(); | ||||||
|  |  | ||||||
| 		$query  = "SELECT * FROM `" . self::TABLE_PLAYERDATAMETADATA . "`;"; | 		$query  = "SELECT * FROM `" . self::TABLE_PLAYERDATAMETADATA . "`;"; | ||||||
| 		$result = $mysqli->query($query); | 		$result = $mysqli->query($query); | ||||||
| @@ -137,7 +137,7 @@ class PlayerDataManager { | |||||||
| 	 * @return bool | 	 * @return bool | ||||||
| 	 */ | 	 */ | ||||||
| 	public function defineMetaData($object, $dataName, $default, $dataDescription = '') { | 	public function defineMetaData($object, $dataName, $default, $dataDescription = '') { | ||||||
| 		$mysqli    = $this->maniaControl->database->mysqli; | 		$mysqli    = $this->maniaControl->getDatabase()->getMysqli(); | ||||||
| 		$className = ClassUtil::getClass($object); | 		$className = ClassUtil::getClass($object); | ||||||
|  |  | ||||||
| 		$query     = "INSERT INTO `" . self::TABLE_PLAYERDATAMETADATA . "` ( | 		$query     = "INSERT INTO `" . self::TABLE_PLAYERDATAMETADATA . "` ( | ||||||
| @@ -215,7 +215,7 @@ class PlayerDataManager { | |||||||
| 			return $this->storedData[$player->index][$meta->dataId]; | 			return $this->storedData[$player->index][$meta->dataId]; | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
| 		$mysqli        = $this->maniaControl->database->mysqli; | 		$mysqli        = $this->maniaControl->getDatabase()->getMysqli(); | ||||||
| 		$dataQuery     = "SELECT `value` FROM `" . self::TABLE_PLAYERDATA . "` | 		$dataQuery     = "SELECT `value` FROM `" . self::TABLE_PLAYERDATA . "` | ||||||
| 				WHERE `dataId` = ? | 				WHERE `dataId` = ? | ||||||
| 				AND `playerId` = ? | 				AND `playerId` = ? | ||||||
| @@ -271,7 +271,7 @@ class PlayerDataManager { | |||||||
| 			return false; | 			return false; | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
| 		$mysqli    = $this->maniaControl->database->mysqli; | 		$mysqli    = $this->maniaControl->getDatabase()->getMysqli(); | ||||||
| 		$query     = "INSERT INTO `" . self::TABLE_PLAYERDATA . "` ( | 		$query     = "INSERT INTO `" . self::TABLE_PLAYERDATA . "` ( | ||||||
| 				`serverIndex`, | 				`serverIndex`, | ||||||
| 				`playerId`, | 				`playerId`, | ||||||
|   | |||||||
| @@ -41,11 +41,11 @@ class PlayerDetailed { | |||||||
| 	public function __construct(ManiaControl $maniaControl) { | 	public function __construct(ManiaControl $maniaControl) { | ||||||
| 		$this->maniaControl = $maniaControl; | 		$this->maniaControl = $maniaControl; | ||||||
|  |  | ||||||
| 		// settings | 		// Settings | ||||||
| 		$this->width        = $this->maniaControl->manialinkManager->getStyleManager()->getListWidgetsWidth(); | 		$this->width        = $this->maniaControl->getManialinkManager()->getStyleManager()->getListWidgetsWidth(); | ||||||
| 		$this->height       = $this->maniaControl->manialinkManager->getStyleManager()->getListWidgetsHeight(); | 		$this->height       = $this->maniaControl->getManialinkManager()->getStyleManager()->getListWidgetsHeight(); | ||||||
| 		$this->quadStyle    = $this->maniaControl->manialinkManager->getStyleManager()->getDefaultMainWindowStyle(); | 		$this->quadStyle    = $this->maniaControl->getManialinkManager()->getStyleManager()->getDefaultMainWindowStyle(); | ||||||
| 		$this->quadSubstyle = $this->maniaControl->manialinkManager->getStyleManager()->getDefaultMainWindowSubStyle(); | 		$this->quadSubstyle = $this->maniaControl->getManialinkManager()->getStyleManager()->getDefaultMainWindowSubStyle(); | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	/** | 	/** | ||||||
| @@ -56,14 +56,14 @@ class PlayerDetailed { | |||||||
| 	 */ | 	 */ | ||||||
| 	public function showPlayerDetailed(Player $player, $targetLogin) { | 	public function showPlayerDetailed(Player $player, $targetLogin) { | ||||||
| 		/** @var Player $target */ | 		/** @var Player $target */ | ||||||
| 		$target = $this->maniaControl->playerManager->getPlayer($targetLogin); | 		$target = $this->maniaControl->getPlayerManager()->getPlayer($targetLogin); | ||||||
|  |  | ||||||
| 		//Create ManiaLink | 		// Create ManiaLink | ||||||
| 		$maniaLink = new ManiaLink(ManialinkManager::MAIN_MLID); | 		$maniaLink = new ManiaLink(ManialinkManager::MAIN_MLID); | ||||||
| 		$script    = $maniaLink->getScript(); | 		$script    = $maniaLink->getScript(); | ||||||
|  |  | ||||||
| 		// Main frame | 		// Main frame | ||||||
| 		$frame = $this->maniaControl->manialinkManager->getStyleManager()->getDefaultListFrame($script); | 		$frame = $this->maniaControl->getManialinkManager()->getStyleManager()->getDefaultListFrame($script); | ||||||
| 		$maniaLink->add($frame); | 		$maniaLink->add($frame); | ||||||
|  |  | ||||||
| 		// Create script and features | 		// Create script and features | ||||||
| @@ -168,7 +168,7 @@ class PlayerDetailed { | |||||||
| 		$label = clone $mainLabel; | 		$label = clone $mainLabel; | ||||||
| 		$frame->add($label); | 		$frame->add($label); | ||||||
| 		$label->setY($posY); | 		$label->setY($posY); | ||||||
| 		$label->setText($this->maniaControl->authenticationManager->getAuthLevelName($target->authLevel)); | 		$label->setText($this->maniaControl->getAuthenticationManager()->getAuthLevelName($target->authLevel)); | ||||||
|  |  | ||||||
| 		//LadderRank | 		//LadderRank | ||||||
| 		$posY -= 5; | 		$posY -= 5; | ||||||
| @@ -212,7 +212,7 @@ class PlayerDetailed { | |||||||
| 		$quad->setAction(PlayerCommands::ACTION_OPEN_PLAYERLIST); | 		$quad->setAction(PlayerCommands::ACTION_OPEN_PLAYERLIST); | ||||||
|  |  | ||||||
| 		// render and display xml | 		// render and display xml | ||||||
| 		$this->maniaControl->manialinkManager->displayWidget($maniaLink, $player, 'PlayerDetailed'); | 		$this->maniaControl->getManialinkManager()->displayWidget($maniaLink, $player, 'PlayerDetailed'); | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	/** | 	/** | ||||||
| @@ -224,7 +224,7 @@ class PlayerDetailed { | |||||||
| 	public function statisticsFrame(Player $player) { | 	public function statisticsFrame(Player $player) { | ||||||
| 		$frame = new Frame(); | 		$frame = new Frame(); | ||||||
|  |  | ||||||
| 		$playerStats = $this->maniaControl->statisticManager->getAllPlayerStats($player); | 		$playerStats = $this->maniaControl->getStatisticManager()->getAllPlayerStats($player); | ||||||
| 		$posY        = $this->height / 2 - 15; | 		$posY        = $this->height / 2 - 15; | ||||||
| 		$posX        = -$this->width / 2 + 52; | 		$posX        = -$this->width / 2 + 52; | ||||||
| 		$index       = 1; | 		$index       = 1; | ||||||
|   | |||||||
| @@ -66,23 +66,24 @@ class PlayerList implements ManialinkPageAnswerListener, CallbackListener, Timer | |||||||
| 	private $playersListShown = array(); | 	private $playersListShown = array(); | ||||||
|  |  | ||||||
| 	/** | 	/** | ||||||
| 	 * Create a PlayerList Instance | 	 * Construct a new PlayerList instance | ||||||
| 	 * | 	 * | ||||||
| 	 * @param ManiaControl $maniaControl | 	 * @param ManiaControl $maniaControl | ||||||
| 	 */ | 	 */ | ||||||
| 	public function __construct(ManiaControl $maniaControl) { | 	public function __construct(ManiaControl $maniaControl) { | ||||||
| 		$this->maniaControl = $maniaControl; | 		$this->maniaControl = $maniaControl; | ||||||
|  |  | ||||||
| 		$this->maniaControl->manialinkManager->registerManialinkPageAnswerListener(self::ACTION_CLOSE_PLAYER_ADV, $this, 'closePlayerAdvancedWidget'); | 		// Callbacks | ||||||
| 		$this->maniaControl->callbackManager->registerCallbackListener(ManialinkManager::CB_MAIN_WINDOW_CLOSED, $this, 'closeWidget'); | 		$this->maniaControl->getManialinkManager()->registerManialinkPageAnswerListener(self::ACTION_CLOSE_PLAYER_ADV, $this, 'closePlayerAdvancedWidget'); | ||||||
| 		$this->maniaControl->callbackManager->registerCallbackListener(ManialinkManager::CB_MAIN_WINDOW_OPENED, $this, 'handleWidgetOpened'); | 		$this->maniaControl->getCallbackManager()->registerCallbackListener(ManialinkManager::CB_MAIN_WINDOW_CLOSED, $this, 'closeWidget'); | ||||||
| 		$this->maniaControl->callbackManager->registerCallbackListener(CallbackManager::CB_MP_PLAYERMANIALINKPAGEANSWER, $this, 'handleManialinkPageAnswer'); | 		$this->maniaControl->getCallbackManager()->registerCallbackListener(ManialinkManager::CB_MAIN_WINDOW_OPENED, $this, 'handleWidgetOpened'); | ||||||
|  | 		$this->maniaControl->getCallbackManager()->registerCallbackListener(CallbackManager::CB_MP_PLAYERMANIALINKPAGEANSWER, $this, 'handleManialinkPageAnswer'); | ||||||
|  |  | ||||||
| 		// Update Widget Events | 		// Update Widget Events | ||||||
| 		$this->maniaControl->callbackManager->registerCallbackListener(PlayerManager::CB_PLAYERINFOCHANGED, $this, 'updateWidget'); | 		$this->maniaControl->getCallbackManager()->registerCallbackListener(PlayerManager::CB_PLAYERINFOCHANGED, $this, 'updateWidget'); | ||||||
| 		$this->maniaControl->callbackManager->registerCallbackListener(PlayerManager::CB_PLAYERDISCONNECT, $this, 'updateWidget'); | 		$this->maniaControl->getCallbackManager()->registerCallbackListener(PlayerManager::CB_PLAYERDISCONNECT, $this, 'updateWidget'); | ||||||
| 		$this->maniaControl->callbackManager->registerCallbackListener(PlayerManager::CB_PLAYERCONNECT, $this, 'updateWidget'); | 		$this->maniaControl->getCallbackManager()->registerCallbackListener(PlayerManager::CB_PLAYERCONNECT, $this, 'updateWidget'); | ||||||
| 		$this->maniaControl->callbackManager->registerCallbackListener(AuthenticationManager::CB_AUTH_LEVEL_CHANGED, $this, 'updateWidget'); | 		$this->maniaControl->getCallbackManager()->registerCallbackListener(AuthenticationManager::CB_AUTH_LEVEL_CHANGED, $this, 'updateWidget'); | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	/** | 	/** | ||||||
| @@ -134,11 +135,11 @@ class PlayerList implements ManialinkPageAnswerListener, CallbackListener, Timer | |||||||
| 	 * @param Player $player | 	 * @param Player $player | ||||||
| 	 */ | 	 */ | ||||||
| 	public function showPlayerList(Player $player) { | 	public function showPlayerList(Player $player) { | ||||||
| 		$width  = $this->maniaControl->manialinkManager->getStyleManager()->getListWidgetsWidth(); | 		$width  = $this->maniaControl->getManialinkManager()->getStyleManager()->getListWidgetsWidth(); | ||||||
| 		$height = $this->maniaControl->manialinkManager->getStyleManager()->getListWidgetsHeight(); | 		$height = $this->maniaControl->getManialinkManager()->getStyleManager()->getListWidgetsHeight(); | ||||||
|  |  | ||||||
| 		// get PlayerList | 		// get PlayerList | ||||||
| 		$players = $this->maniaControl->playerManager->getPlayers(); | 		$players = $this->maniaControl->getPlayerManager()->getPlayers(); | ||||||
|  |  | ||||||
| 		//create manialink | 		//create manialink | ||||||
| 		$maniaLink = new ManiaLink(ManialinkManager::MAIN_MLID); | 		$maniaLink = new ManiaLink(ManialinkManager::MAIN_MLID); | ||||||
| @@ -147,7 +148,7 @@ class PlayerList implements ManialinkPageAnswerListener, CallbackListener, Timer | |||||||
| 		$script->addFeature($paging); | 		$script->addFeature($paging); | ||||||
|  |  | ||||||
| 		// Main frame | 		// Main frame | ||||||
| 		$frame = $this->maniaControl->manialinkManager->getStyleManager()->getDefaultListFrame($script, $paging); | 		$frame = $this->maniaControl->getManialinkManager()->getStyleManager()->getDefaultListFrame($script, $paging); | ||||||
| 		$maniaLink->add($frame); | 		$maniaLink->add($frame); | ||||||
|  |  | ||||||
| 		// Start offsets | 		// Start offsets | ||||||
| @@ -155,7 +156,7 @@ class PlayerList implements ManialinkPageAnswerListener, CallbackListener, Timer | |||||||
| 		$posY = $height / 2; | 		$posY = $height / 2; | ||||||
|  |  | ||||||
| 		// Predefine Description Label | 		// Predefine Description Label | ||||||
| 		$descriptionLabel = $this->maniaControl->manialinkManager->getStyleManager()->getDefaultDescriptionLabel(); | 		$descriptionLabel = $this->maniaControl->getManialinkManager()->getStyleManager()->getDefaultDescriptionLabel(); | ||||||
| 		$frame->add($descriptionLabel); | 		$frame->add($descriptionLabel); | ||||||
|  |  | ||||||
| 		// Headline | 		// Headline | ||||||
| @@ -163,10 +164,10 @@ class PlayerList implements ManialinkPageAnswerListener, CallbackListener, Timer | |||||||
| 		$frame->add($headFrame); | 		$frame->add($headFrame); | ||||||
| 		$headFrame->setY($posY - 5); | 		$headFrame->setY($posY - 5); | ||||||
| 		$labelLineArray = array('Id' => $posX + 5, 'Nickname' => $posX + 18, 'Login' => $posX + 70, 'Location' => $posX + 101); | 		$labelLineArray = array('Id' => $posX + 5, 'Nickname' => $posX + 18, 'Login' => $posX + 70, 'Location' => $posX + 101); | ||||||
| 		if ($this->maniaControl->authenticationManager->checkRight($player, AuthenticationManager::AUTH_LEVEL_MODERATOR)) { | 		if ($this->maniaControl->getAuthenticationManager()->checkRight($player, AuthenticationManager::AUTH_LEVEL_MODERATOR)) { | ||||||
| 			$labelLineArray['Actions'] = $posX + 135; | 			$labelLineArray['Actions'] = $posX + 135; | ||||||
| 		} | 		} | ||||||
| 		$this->maniaControl->manialinkManager->labelLine($headFrame, $labelLineArray); | 		$this->maniaControl->getManialinkManager()->labelLine($headFrame, $labelLineArray); | ||||||
|  |  | ||||||
| 		$index     = 1; | 		$index     = 1; | ||||||
| 		$posY      = $height / 2 - 10; | 		$posY      = $height / 2 - 10; | ||||||
| @@ -194,7 +195,7 @@ class PlayerList implements ManialinkPageAnswerListener, CallbackListener, Timer | |||||||
| 			} | 			} | ||||||
|  |  | ||||||
| 			$array = array($index => $posX + 5, $listPlayer->nickname => $posX + 18, $listPlayer->login => $posX + 70, $path => $posX + 101); | 			$array = array($index => $posX + 5, $listPlayer->nickname => $posX + 18, $listPlayer->login => $posX + 70, $path => $posX + 101); | ||||||
| 			$this->maniaControl->manialinkManager->labelLine($playerFrame, $array); | 			$this->maniaControl->getManialinkManager()->labelLine($playerFrame, $array); | ||||||
|  |  | ||||||
| 			$playerFrame->setY($posY); | 			$playerFrame->setY($posY); | ||||||
|  |  | ||||||
| @@ -260,11 +261,11 @@ class PlayerList implements ManialinkPageAnswerListener, CallbackListener, Timer | |||||||
| 			$playerFrame->add($rightLabel); | 			$playerFrame->add($rightLabel); | ||||||
| 			$rightLabel->setX($posX + 13.9); | 			$rightLabel->setX($posX + 13.9); | ||||||
| 			$rightLabel->setZ(3.1); | 			$rightLabel->setZ(3.1); | ||||||
| 			$rightLabel->setText($this->maniaControl->authenticationManager->getAuthLevelAbbreviation($listPlayer->authLevel)); | 			$rightLabel->setText($this->maniaControl->getAuthenticationManager()->getAuthLevelAbbreviation($listPlayer->authLevel)); | ||||||
| 			$rightLabel->setTextSize(0.8); | 			$rightLabel->setTextSize(0.8); | ||||||
| 			$rightLabel->setTextColor('fff'); | 			$rightLabel->setTextColor('fff'); | ||||||
|  |  | ||||||
| 			$description = $this->maniaControl->authenticationManager->getAuthLevelName($listPlayer) . ' ' . $listPlayer->nickname; | 			$description = $this->maniaControl->getAuthenticationManager()->getAuthLevelName($listPlayer) . ' ' . $listPlayer->nickname; | ||||||
| 			$rightLabel->addTooltipLabelFeature($descriptionLabel, $description); | 			$rightLabel->addTooltipLabelFeature($descriptionLabel, $description); | ||||||
|  |  | ||||||
| 			// Player Statistics | 			// Player Statistics | ||||||
| @@ -302,7 +303,7 @@ class PlayerList implements ManialinkPageAnswerListener, CallbackListener, Timer | |||||||
| 			$description = 'View Player Profile of $<' . $listPlayer->nickname . '$>'; | 			$description = 'View Player Profile of $<' . $listPlayer->nickname . '$>'; | ||||||
| 			$playerQuad->addTooltipLabelFeature($descriptionLabel, $description); | 			$playerQuad->addTooltipLabelFeature($descriptionLabel, $description); | ||||||
|  |  | ||||||
| 			if ($this->maniaControl->authenticationManager->checkRight($player, AuthenticationManager::AUTH_LEVEL_MODERATOR)) { | 			if ($this->maniaControl->getAuthenticationManager()->checkRight($player, AuthenticationManager::AUTH_LEVEL_MODERATOR)) { | ||||||
| 				// Further Player actions Quad | 				// Further Player actions Quad | ||||||
| 				$playerQuad = new Quad_Icons64x64_1(); | 				$playerQuad = new Quad_Icons64x64_1(); | ||||||
| 				$playerFrame->add($playerQuad); | 				$playerFrame->add($playerQuad); | ||||||
| @@ -317,8 +318,8 @@ class PlayerList implements ManialinkPageAnswerListener, CallbackListener, Timer | |||||||
| 				$playerQuad->addTooltipLabelFeature($descriptionLabel, $description); | 				$playerQuad->addTooltipLabelFeature($descriptionLabel, $description); | ||||||
| 			} | 			} | ||||||
|  |  | ||||||
| 			if ($this->maniaControl->server->isTeamMode()) { | 			if ($this->maniaControl->getServer()->isTeamMode()) { | ||||||
| 				if ($this->maniaControl->authenticationManager->checkPermission($player, PlayerActions::SETTING_PERMISSION_FORCE_PLAYER_TEAM)) { | 				if ($this->maniaControl->getAuthenticationManager()->checkPermission($player, PlayerActions::SETTING_PERMISSION_FORCE_PLAYER_TEAM)) { | ||||||
| 					// Force to Red-Team Quad | 					// Force to Red-Team Quad | ||||||
| 					$redQuad = new Quad_Emblems(); | 					$redQuad = new Quad_Emblems(); | ||||||
| 					$playerFrame->add($redQuad); | 					$playerFrame->add($redQuad); | ||||||
| @@ -345,7 +346,7 @@ class PlayerList implements ManialinkPageAnswerListener, CallbackListener, Timer | |||||||
| 					$description = 'Force $<' . $listPlayer->nickname . '$> to Blue Team!'; | 					$description = 'Force $<' . $listPlayer->nickname . '$> to Blue Team!'; | ||||||
| 					$blueQuad->addTooltipLabelFeature($descriptionLabel, $description); | 					$blueQuad->addTooltipLabelFeature($descriptionLabel, $description); | ||||||
|  |  | ||||||
| 				} else if ($this->maniaControl->pluginManager->isPluginActive(self::DEFAULT_CUSTOM_VOTE_PLUGIN)) { | 				} else if ($this->maniaControl->getPluginManager()->isPluginActive(self::DEFAULT_CUSTOM_VOTE_PLUGIN)) { | ||||||
| 					// Kick Player Vote | 					// Kick Player Vote | ||||||
| 					$kickQuad = new Quad_UIConstruction_Buttons(); | 					$kickQuad = new Quad_UIConstruction_Buttons(); | ||||||
| 					$playerFrame->add($kickQuad); | 					$playerFrame->add($kickQuad); | ||||||
| @@ -359,7 +360,7 @@ class PlayerList implements ManialinkPageAnswerListener, CallbackListener, Timer | |||||||
| 					$kickQuad->addTooltipLabelFeature($descriptionLabel, $description); | 					$kickQuad->addTooltipLabelFeature($descriptionLabel, $description); | ||||||
| 				} | 				} | ||||||
| 			} else { | 			} else { | ||||||
| 				if ($this->maniaControl->authenticationManager->checkPermission($player, PlayerActions::SETTING_PERMISSION_FORCE_PLAYER_PLAY)) { | 				if ($this->maniaControl->getAuthenticationManager()->checkPermission($player, PlayerActions::SETTING_PERMISSION_FORCE_PLAYER_PLAY)) { | ||||||
| 					// Force to Play | 					// Force to Play | ||||||
| 					$playQuad = new Quad_Emblems(); | 					$playQuad = new Quad_Emblems(); | ||||||
| 					$playerFrame->add($playQuad); | 					$playerFrame->add($playQuad); | ||||||
| @@ -374,7 +375,7 @@ class PlayerList implements ManialinkPageAnswerListener, CallbackListener, Timer | |||||||
| 				} | 				} | ||||||
| 			} | 			} | ||||||
|  |  | ||||||
| 			if ($this->maniaControl->authenticationManager->checkPermission($player, PlayerActions::SETTING_PERMISSION_FORCE_PLAYER_SPEC)) { | 			if ($this->maniaControl->getAuthenticationManager()->checkPermission($player, PlayerActions::SETTING_PERMISSION_FORCE_PLAYER_SPEC)) { | ||||||
| 				// Force to Spectator Quad | 				// Force to Spectator Quad | ||||||
| 				$spectatorQuad = new Quad_BgRaceScore2(); | 				$spectatorQuad = new Quad_BgRaceScore2(); | ||||||
| 				$playerFrame->add($spectatorQuad); | 				$playerFrame->add($spectatorQuad); | ||||||
| @@ -387,7 +388,7 @@ class PlayerList implements ManialinkPageAnswerListener, CallbackListener, Timer | |||||||
| 				// Force to Spectator Description Label | 				// Force to Spectator Description Label | ||||||
| 				$description = 'Force $<' . $listPlayer->nickname . '$> to Spectator!'; | 				$description = 'Force $<' . $listPlayer->nickname . '$> to Spectator!'; | ||||||
| 				$spectatorQuad->addTooltipLabelFeature($descriptionLabel, $description); | 				$spectatorQuad->addTooltipLabelFeature($descriptionLabel, $description); | ||||||
| 			} else if ($this->maniaControl->pluginManager->isPluginActive(self::DEFAULT_CUSTOM_VOTE_PLUGIN)) { | 			} else if ($this->maniaControl->getPluginManager()->isPluginActive(self::DEFAULT_CUSTOM_VOTE_PLUGIN)) { | ||||||
| 				// Force to Spectator Quad | 				// Force to Spectator Quad | ||||||
| 				$spectatorQuad = new Quad_BgRaceScore2(); | 				$spectatorQuad = new Quad_BgRaceScore2(); | ||||||
| 				$playerFrame->add($spectatorQuad); | 				$playerFrame->add($spectatorQuad); | ||||||
| @@ -414,7 +415,7 @@ class PlayerList implements ManialinkPageAnswerListener, CallbackListener, Timer | |||||||
| 		} | 		} | ||||||
|  |  | ||||||
| 		// Render and display xml | 		// Render and display xml | ||||||
| 		$this->maniaControl->manialinkManager->displayWidget($maniaLink, $player, 'PlayerList'); | 		$this->maniaControl->getManialinkManager()->displayWidget($maniaLink, $player, 'PlayerList'); | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	/** | 	/** | ||||||
| @@ -425,11 +426,11 @@ class PlayerList implements ManialinkPageAnswerListener, CallbackListener, Timer | |||||||
| 	 * @return Frame | 	 * @return Frame | ||||||
| 	 */ | 	 */ | ||||||
| 	public function showAdvancedPlayerWidget(Player $admin, $login) { | 	public function showAdvancedPlayerWidget(Player $admin, $login) { | ||||||
| 		$player       = $this->maniaControl->playerManager->getPlayer($login); | 		$player       = $this->maniaControl->getPlayerManager()->getPlayer($login); | ||||||
| 		$width        = $this->maniaControl->manialinkManager->getStyleManager()->getListWidgetsWidth(); | 		$width        = $this->maniaControl->getManialinkManager()->getStyleManager()->getListWidgetsWidth(); | ||||||
| 		$height       = $this->maniaControl->manialinkManager->getStyleManager()->getListWidgetsHeight(); | 		$height       = $this->maniaControl->getManialinkManager()->getStyleManager()->getListWidgetsHeight(); | ||||||
| 		$quadStyle    = $this->maniaControl->manialinkManager->getStyleManager()->getDefaultMainWindowStyle(); | 		$quadStyle    = $this->maniaControl->getManialinkManager()->getStyleManager()->getDefaultMainWindowStyle(); | ||||||
| 		$quadSubstyle = $this->maniaControl->manialinkManager->getStyleManager()->getDefaultMainWindowSubStyle(); | 		$quadSubstyle = $this->maniaControl->getManialinkManager()->getStyleManager()->getDefaultMainWindowSubStyle(); | ||||||
|  |  | ||||||
| 		//Settings | 		//Settings | ||||||
| 		$posX      = $width / 2 + 2.5; | 		$posX      = $width / 2 + 2.5; | ||||||
| @@ -506,7 +507,7 @@ class PlayerList implements ManialinkPageAnswerListener, CallbackListener, Timer | |||||||
| 		$label->setTextSize($textSize); | 		$label->setTextSize($textSize); | ||||||
| 		$label->setTextColor($textColor); | 		$label->setTextColor($textColor); | ||||||
|  |  | ||||||
| 		if (!$this->maniaControl->playerManager->getPlayerActions()->isPlayerMuted($login)) { | 		if (!$this->maniaControl->getPlayerManager()->getPlayerActions()->isPlayerMuted($login)) { | ||||||
| 			$label->setText('Mute'); | 			$label->setText('Mute'); | ||||||
| 			$quad->setAction(self::ACTION_MUTE_PLAYER . '.' . $login); | 			$quad->setAction(self::ACTION_MUTE_PLAYER . '.' . $login); | ||||||
| 		} else { | 		} else { | ||||||
| @@ -593,7 +594,7 @@ class PlayerList implements ManialinkPageAnswerListener, CallbackListener, Timer | |||||||
| 		$label->setText('Set Moderator'); | 		$label->setText('Set Moderator'); | ||||||
| 		$label->setTextColor($textColor); | 		$label->setTextColor($textColor); | ||||||
|  |  | ||||||
| 		if ($player->authLevel > 0 && $this->maniaControl->authenticationManager->checkRight($admin, $player->authLevel + 1)) { | 		if ($player->authLevel > 0 && $this->maniaControl->getAuthenticationManager()->checkRight($admin, $player->authLevel + 1)) { | ||||||
| 			$posY -= 5; | 			$posY -= 5; | ||||||
| 			// Revoke Rights | 			// Revoke Rights | ||||||
| 			$quad = clone $quad; | 			$quad = clone $quad; | ||||||
| @@ -630,79 +631,79 @@ class PlayerList implements ManialinkPageAnswerListener, CallbackListener, Timer | |||||||
| 		switch ($action) { | 		switch ($action) { | ||||||
| 			case self::ACTION_SPECTATE_PLAYER: | 			case self::ACTION_SPECTATE_PLAYER: | ||||||
| 				try { | 				try { | ||||||
| 					$this->maniaControl->client->forceSpectator($adminLogin, PlayerActions::SPECTATOR_BUT_KEEP_SELECTABLE); | 					$this->maniaControl->getClient()->forceSpectator($adminLogin, PlayerActions::SPECTATOR_BUT_KEEP_SELECTABLE); | ||||||
| 					$this->maniaControl->client->forceSpectatorTarget($adminLogin, $targetLogin, 1); | 					$this->maniaControl->getClient()->forceSpectatorTarget($adminLogin, $targetLogin, 1); | ||||||
| 				} catch (PlayerStateException $e) { | 				} catch (PlayerStateException $e) { | ||||||
| 				} | 				} | ||||||
| 				break; | 				break; | ||||||
| 			case self::ACTION_OPEN_PLAYER_DETAILED: | 			case self::ACTION_OPEN_PLAYER_DETAILED: | ||||||
| 				$player = $this->maniaControl->playerManager->getPlayer($adminLogin); | 				$player = $this->maniaControl->getPlayerManager()->getPlayer($adminLogin); | ||||||
| 				$this->maniaControl->playerManager->getPlayerDetailed()->showPlayerDetailed($player, $targetLogin); | 				$this->maniaControl->getPlayerManager()->getPlayerDetailed()->showPlayerDetailed($player, $targetLogin); | ||||||
| 				unset($this->playersListShown[$player->login]); | 				unset($this->playersListShown[$player->login]); | ||||||
| 				break; | 				break; | ||||||
| 			case self::ACTION_FORCE_BLUE: | 			case self::ACTION_FORCE_BLUE: | ||||||
| 				$this->maniaControl->playerManager->getPlayerActions()->forcePlayerToTeam($adminLogin, $targetLogin, PlayerActions::TEAM_BLUE); | 				$this->maniaControl->getPlayerManager()->getPlayerActions()->forcePlayerToTeam($adminLogin, $targetLogin, PlayerActions::TEAM_BLUE); | ||||||
| 				break; | 				break; | ||||||
| 			case self::ACTION_FORCE_RED: | 			case self::ACTION_FORCE_RED: | ||||||
| 				$this->maniaControl->playerManager->getPlayerActions()->forcePlayerToTeam($adminLogin, $targetLogin, PlayerActions::TEAM_RED); | 				$this->maniaControl->getPlayerManager()->getPlayerActions()->forcePlayerToTeam($adminLogin, $targetLogin, PlayerActions::TEAM_RED); | ||||||
| 				break; | 				break; | ||||||
| 			case self::ACTION_FORCE_SPEC: | 			case self::ACTION_FORCE_SPEC: | ||||||
| 				$this->maniaControl->playerManager->getPlayerActions()->forcePlayerToSpectator($adminLogin, $targetLogin, PlayerActions::SPECTATOR_BUT_KEEP_SELECTABLE); | 				$this->maniaControl->getPlayerManager()->getPlayerActions()->forcePlayerToSpectator($adminLogin, $targetLogin, PlayerActions::SPECTATOR_BUT_KEEP_SELECTABLE); | ||||||
| 				break; | 				break; | ||||||
| 			case self::ACTION_FORCE_PLAY: | 			case self::ACTION_FORCE_PLAY: | ||||||
| 				$this->maniaControl->playerManager->getPlayerActions()->forcePlayerToPlay($adminLogin, $targetLogin); | 				$this->maniaControl->getPlayerManager()->getPlayerActions()->forcePlayerToPlay($adminLogin, $targetLogin); | ||||||
| 				break; | 				break; | ||||||
| 			case self::ACTION_MUTE_PLAYER: | 			case self::ACTION_MUTE_PLAYER: | ||||||
| 				$this->maniaControl->playerManager->getPlayerActions()->mutePlayer($adminLogin, $targetLogin); | 				$this->maniaControl->getPlayerManager()->getPlayerActions()->mutePlayer($adminLogin, $targetLogin); | ||||||
| 				$this->showPlayerList($this->maniaControl->playerManager->getPlayer($adminLogin)); | 				$this->showPlayerList($this->maniaControl->getPlayerManager()->getPlayer($adminLogin)); | ||||||
| 				break; | 				break; | ||||||
| 			case self::ACTION_UNMUTE_PLAYER: | 			case self::ACTION_UNMUTE_PLAYER: | ||||||
| 				$this->maniaControl->playerManager->getPlayerActions()->unMutePlayer($adminLogin, $targetLogin); | 				$this->maniaControl->getPlayerManager()->getPlayerActions()->unMutePlayer($adminLogin, $targetLogin); | ||||||
| 				$this->showPlayerList($this->maniaControl->playerManager->getPlayer($adminLogin)); | 				$this->showPlayerList($this->maniaControl->getPlayerManager()->getPlayer($adminLogin)); | ||||||
| 				break; | 				break; | ||||||
| 			case self::ACTION_WARN_PLAYER: | 			case self::ACTION_WARN_PLAYER: | ||||||
| 				$this->maniaControl->playerManager->getPlayerActions()->warnPlayer($adminLogin, $targetLogin); | 				$this->maniaControl->getPlayerManager()->getPlayerActions()->warnPlayer($adminLogin, $targetLogin); | ||||||
| 				break; | 				break; | ||||||
| 			case self::ACTION_KICK_PLAYER: | 			case self::ACTION_KICK_PLAYER: | ||||||
| 				$this->maniaControl->playerManager->getPlayerActions()->kickPlayer($adminLogin, $targetLogin); | 				$this->maniaControl->getPlayerManager()->getPlayerActions()->kickPlayer($adminLogin, $targetLogin); | ||||||
| 				break; | 				break; | ||||||
| 			case self::ACTION_BAN_PLAYER: | 			case self::ACTION_BAN_PLAYER: | ||||||
| 				$this->maniaControl->playerManager->getPlayerActions()->banPlayer($adminLogin, $targetLogin); | 				$this->maniaControl->getPlayerManager()->getPlayerActions()->banPlayer($adminLogin, $targetLogin); | ||||||
| 				break; | 				break; | ||||||
| 			case self::ACTION_PLAYER_ADV: | 			case self::ACTION_PLAYER_ADV: | ||||||
| 				$admin = $this->maniaControl->playerManager->getPlayer($adminLogin); | 				$admin = $this->maniaControl->getPlayerManager()->getPlayer($adminLogin); | ||||||
| 				$this->advancedPlayerWidget($admin, $targetLogin); | 				$this->advancedPlayerWidget($admin, $targetLogin); | ||||||
| 				break; | 				break; | ||||||
| 			case self::ACTION_ADD_AS_MASTER: | 			case self::ACTION_ADD_AS_MASTER: | ||||||
| 				$this->maniaControl->playerManager->getPlayerActions()->grandAuthLevel($adminLogin, $targetLogin, AuthenticationManager::AUTH_LEVEL_SUPERADMIN); | 				$this->maniaControl->getPlayerManager()->getPlayerActions()->grandAuthLevel($adminLogin, $targetLogin, AuthenticationManager::AUTH_LEVEL_SUPERADMIN); | ||||||
| 				break; | 				break; | ||||||
| 			case self::ACTION_ADD_AS_ADMIN: | 			case self::ACTION_ADD_AS_ADMIN: | ||||||
| 				$this->maniaControl->playerManager->getPlayerActions()->grandAuthLevel($adminLogin, $targetLogin, AuthenticationManager::AUTH_LEVEL_ADMIN); | 				$this->maniaControl->getPlayerManager()->getPlayerActions()->grandAuthLevel($adminLogin, $targetLogin, AuthenticationManager::AUTH_LEVEL_ADMIN); | ||||||
| 				break; | 				break; | ||||||
| 			case self::ACTION_ADD_AS_MOD: | 			case self::ACTION_ADD_AS_MOD: | ||||||
| 				$this->maniaControl->playerManager->getPlayerActions()->grandAuthLevel($adminLogin, $targetLogin, AuthenticationManager::AUTH_LEVEL_MODERATOR); | 				$this->maniaControl->getPlayerManager()->getPlayerActions()->grandAuthLevel($adminLogin, $targetLogin, AuthenticationManager::AUTH_LEVEL_MODERATOR); | ||||||
| 				break; | 				break; | ||||||
| 			case self::ACTION_REVOKE_RIGHTS: | 			case self::ACTION_REVOKE_RIGHTS: | ||||||
| 				$this->maniaControl->playerManager->getPlayerActions()->revokeAuthLevel($adminLogin, $targetLogin); | 				$this->maniaControl->getPlayerManager()->getPlayerActions()->revokeAuthLevel($adminLogin, $targetLogin); | ||||||
| 				break; | 				break; | ||||||
| 			case self::ACTION_FORCE_SPEC_VOTE: | 			case self::ACTION_FORCE_SPEC_VOTE: | ||||||
| 				/** @var $votesPlugin CustomVotesPlugin */ | 				/** @var $votesPlugin CustomVotesPlugin */ | ||||||
| 				$votesPlugin = $this->maniaControl->pluginManager->getPlugin(self::DEFAULT_CUSTOM_VOTE_PLUGIN); | 				$votesPlugin = $this->maniaControl->getPluginManager()->getPlugin(self::DEFAULT_CUSTOM_VOTE_PLUGIN); | ||||||
|  |  | ||||||
| 				$admin  = $this->maniaControl->playerManager->getPlayer($adminLogin); | 				$admin  = $this->maniaControl->getPlayerManager()->getPlayer($adminLogin); | ||||||
| 				$target = $this->maniaControl->playerManager->getPlayer($targetLogin); | 				$target = $this->maniaControl->getPlayerManager()->getPlayer($targetLogin); | ||||||
|  |  | ||||||
| 				$startMessage = '$<' . $admin->nickname . '$>$s started a vote to force $<' . $target->nickname . '$> into spectator!'; | 				$startMessage = $admin->getEscapedNickname() . '$s started a vote to force $<' . $target->nickname . '$> into spectator!'; | ||||||
|  |  | ||||||
| 				$votesPlugin->defineVote('forcespec', 'Force $<' . $target->nickname . '$> Spec', true, $startMessage); | 				$votesPlugin->defineVote('forcespec', 'Force ' . $target->getEscapedNickname() . ' Spec', true, $startMessage); | ||||||
|  |  | ||||||
| 				$votesPlugin->startVote($admin, 'forcespec', function ($result) use (&$votesPlugin, &$target) { | 				$votesPlugin->startVote($admin, 'forcespec', function ($result) use (&$votesPlugin, &$target) { | ||||||
| 					$this->maniaControl->chat->sendInformation('$sVote Successful -> Player $<' . $target->nickname . '$> forced to Spectator!'); | 					$this->maniaControl->getChat()->sendInformation('$sVote successful -> Player ' . $target->getEscapedNickname() . ' forced to Spectator!'); | ||||||
| 					$votesPlugin->undefineVote('forcespec'); | 					$votesPlugin->undefineVote('forcespec'); | ||||||
|  |  | ||||||
| 					try { | 					try { | ||||||
| 						$this->maniaControl->client->forceSpectator($target->login, PlayerActions::SPECTATOR_BUT_KEEP_SELECTABLE); | 						$this->maniaControl->getClient()->forceSpectator($target->login, PlayerActions::SPECTATOR_BUT_KEEP_SELECTABLE); | ||||||
| 						$this->maniaControl->client->spectatorReleasePlayerSlot($target->login); | 						$this->maniaControl->getClient()->spectatorReleasePlayerSlot($target->login); | ||||||
| 					} catch (PlayerStateException $e) { | 					} catch (PlayerStateException $e) { | ||||||
| 					} catch (UnknownPlayerException $e) { | 					} catch (UnknownPlayerException $e) { | ||||||
| 					} | 					} | ||||||
| @@ -710,23 +711,23 @@ class PlayerList implements ManialinkPageAnswerListener, CallbackListener, Timer | |||||||
| 				break; | 				break; | ||||||
| 			case self::ACTION_KICK_PLAYER_VOTE: | 			case self::ACTION_KICK_PLAYER_VOTE: | ||||||
| 				/** @var $votesPlugin CustomVotesPlugin */ | 				/** @var $votesPlugin CustomVotesPlugin */ | ||||||
| 				$votesPlugin = $this->maniaControl->pluginManager->getPlugin(self::DEFAULT_CUSTOM_VOTE_PLUGIN); | 				$votesPlugin = $this->maniaControl->getPluginManager()->getPlugin(self::DEFAULT_CUSTOM_VOTE_PLUGIN); | ||||||
|  |  | ||||||
| 				$admin  = $this->maniaControl->playerManager->getPlayer($adminLogin); | 				$admin  = $this->maniaControl->getPlayerManager()->getPlayer($adminLogin); | ||||||
| 				$target = $this->maniaControl->playerManager->getPlayer($targetLogin); | 				$target = $this->maniaControl->getPlayerManager()->getPlayer($targetLogin); | ||||||
|  |  | ||||||
| 				$startMessage = '$<' . $admin->nickname . '$>$s started a vote to kick $<' . $target->nickname . '$>!'; | 				$startMessage = $admin->getEscapedNickname() . '$s started a vote to kick $<' . $target->nickname . '$>!'; | ||||||
|  |  | ||||||
|  |  | ||||||
| 				$votesPlugin->defineVote('kick', 'Kick $<' . $target->nickname . '$>', true, $startMessage); | 				$votesPlugin->defineVote('kick', 'Kick ' . $target->getEscapedNickname(), true, $startMessage); | ||||||
|  |  | ||||||
| 				$votesPlugin->startVote($admin, 'kick', function ($result) use (&$votesPlugin, &$target) { | 				$votesPlugin->startVote($admin, 'kick', function ($result) use (&$votesPlugin, &$target) { | ||||||
| 					$this->maniaControl->chat->sendInformation('$sVote Successful -> $<' . $target->nickname . '$> got Kicked!'); | 					$this->maniaControl->getChat()->sendInformation('$sVote successful -> ' . $target->getEscapedNickname() . ' got Kicked!'); | ||||||
| 					$votesPlugin->undefineVote('kick'); | 					$votesPlugin->undefineVote('kick'); | ||||||
|  |  | ||||||
| 					$message = '$39F You got kicked due to a Public Vote!$z '; | 					$message = '$39F You got kicked due to a Public Vote!$z '; | ||||||
| 					try { | 					try { | ||||||
| 						$this->maniaControl->client->kick($target->login, $message); | 						$this->maniaControl->getClient()->kick($target->login, $message); | ||||||
| 					} catch (UnknownPlayerException $e) { | 					} catch (UnknownPlayerException $e) { | ||||||
| 					} | 					} | ||||||
| 				}); | 				}); | ||||||
| @@ -760,7 +761,7 @@ class PlayerList implements ManialinkPageAnswerListener, CallbackListener, Timer | |||||||
| 			} | 			} | ||||||
|  |  | ||||||
| 			// Check if shown player still exists | 			// Check if shown player still exists | ||||||
| 			$player = $this->maniaControl->playerManager->getPlayer($login); | 			$player = $this->maniaControl->getPlayerManager()->getPlayer($login); | ||||||
| 			if (!$player) { | 			if (!$player) { | ||||||
| 				unset($this->playersListShown[$login]); | 				unset($this->playersListShown[$login]); | ||||||
| 				continue; | 				continue; | ||||||
|   | |||||||
| @@ -78,27 +78,27 @@ class PlayerManager implements CallbackListener, TimerListener { | |||||||
| 		$this->playerList        = new PlayerList($maniaControl); | 		$this->playerList        = new PlayerList($maniaControl); | ||||||
| 		$this->adminLists        = new AdminLists($maniaControl); | 		$this->adminLists        = new AdminLists($maniaControl); | ||||||
|  |  | ||||||
| 		// Init settings | 		// Settings | ||||||
| 		$this->maniaControl->settingManager->initSetting($this, self::SETTING_JOIN_LEAVE_MESSAGES, true); | 		$this->maniaControl->getSettingManager()->initSetting($this, self::SETTING_JOIN_LEAVE_MESSAGES, true); | ||||||
|  |  | ||||||
| 		// Register for callbacks | 		// Callbacks | ||||||
| 		$this->maniaControl->callbackManager->registerCallbackListener(Callbacks::ONINIT, $this, 'onInit'); | 		$this->maniaControl->getCallbackManager()->registerCallbackListener(Callbacks::ONINIT, $this, 'onInit'); | ||||||
| 		$this->maniaControl->callbackManager->registerCallbackListener(CallbackManager::CB_MP_PLAYERCONNECT, $this, 'playerConnect'); | 		$this->maniaControl->getCallbackManager()->registerCallbackListener(CallbackManager::CB_MP_PLAYERCONNECT, $this, 'playerConnect'); | ||||||
| 		$this->maniaControl->callbackManager->registerCallbackListener(CallbackManager::CB_MP_PLAYERDISCONNECT, $this, 'playerDisconnect'); | 		$this->maniaControl->getCallbackManager()->registerCallbackListener(CallbackManager::CB_MP_PLAYERDISCONNECT, $this, 'playerDisconnect'); | ||||||
| 		$this->maniaControl->callbackManager->registerCallbackListener(CallbackManager::CB_MP_PLAYERINFOCHANGED, $this, 'playerInfoChanged'); | 		$this->maniaControl->getCallbackManager()->registerCallbackListener(CallbackManager::CB_MP_PLAYERINFOCHANGED, $this, 'playerInfoChanged'); | ||||||
|  |  | ||||||
| 		// Define player stats | 		// Player stats | ||||||
| 		$this->maniaControl->statisticManager->defineStatMetaData(self::STAT_JOIN_COUNT); | 		$this->maniaControl->getStatisticManager()->defineStatMetaData(self::STAT_JOIN_COUNT); | ||||||
| 		$this->maniaControl->statisticManager->defineStatMetaData(self::STAT_SERVERTIME, StatisticManager::STAT_TYPE_TIME); | 		$this->maniaControl->getStatisticManager()->defineStatMetaData(self::STAT_SERVERTIME, StatisticManager::STAT_TYPE_TIME); | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	/** | 	/** | ||||||
| 	 * Initialize necessary Database Tables | 	 * Initialize necessary database tables | ||||||
| 	 * | 	 * | ||||||
| 	 * @return bool | 	 * @return bool | ||||||
| 	 */ | 	 */ | ||||||
| 	private function initTables() { | 	private function initTables() { | ||||||
| 		$mysqli               = $this->maniaControl->database->mysqli; | 		$mysqli               = $this->maniaControl->getDatabase()->getMysqli(); | ||||||
| 		$playerTableQuery     = "CREATE TABLE IF NOT EXISTS `" . self::TABLE_PLAYERS . "` ( | 		$playerTableQuery     = "CREATE TABLE IF NOT EXISTS `" . self::TABLE_PLAYERS . "` ( | ||||||
| 				`index` int(11) NOT NULL AUTO_INCREMENT, | 				`index` int(11) NOT NULL AUTO_INCREMENT, | ||||||
| 				`login` varchar(100) NOT NULL, | 				`login` varchar(100) NOT NULL, | ||||||
| @@ -125,7 +125,7 @@ class PlayerManager implements CallbackListener, TimerListener { | |||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	/** | 	/** | ||||||
| 	 * Get player actions | 	 * Return the player actions | ||||||
| 	 * | 	 * | ||||||
| 	 * @return PlayerActions | 	 * @return PlayerActions | ||||||
| 	 */ | 	 */ | ||||||
| @@ -134,7 +134,7 @@ class PlayerManager implements CallbackListener, TimerListener { | |||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	/** | 	/** | ||||||
| 	 * Get player commands | 	 * Return the player commands | ||||||
| 	 * | 	 * | ||||||
| 	 * @return PlayerCommands | 	 * @return PlayerCommands | ||||||
| 	 */ | 	 */ | ||||||
| @@ -143,7 +143,7 @@ class PlayerManager implements CallbackListener, TimerListener { | |||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	/** | 	/** | ||||||
| 	 * Get player detailed | 	 * Return the player detailed | ||||||
| 	 * | 	 * | ||||||
| 	 * @return PlayerDetailed | 	 * @return PlayerDetailed | ||||||
| 	 */ | 	 */ | ||||||
| @@ -152,7 +152,16 @@ class PlayerManager implements CallbackListener, TimerListener { | |||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	/** | 	/** | ||||||
| 	 * Get player list | 	 * Return the player data manager | ||||||
|  | 	 * | ||||||
|  | 	 * @return PlayerDataManager | ||||||
|  | 	 */ | ||||||
|  | 	public function getPlayerDataManager() { | ||||||
|  | 		return $this->playerDataManager; | ||||||
|  | 	} | ||||||
|  |  | ||||||
|  | 	/** | ||||||
|  | 	 * Return the player list | ||||||
| 	 * | 	 * | ||||||
| 	 * @return PlayerList | 	 * @return PlayerList | ||||||
| 	 */ | 	 */ | ||||||
| @@ -161,7 +170,7 @@ class PlayerManager implements CallbackListener, TimerListener { | |||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	/** | 	/** | ||||||
| 	 * Get admin lists | 	 * Return the admin lists | ||||||
| 	 * | 	 * | ||||||
| 	 * @return AdminLists | 	 * @return AdminLists | ||||||
| 	 */ | 	 */ | ||||||
| @@ -174,20 +183,20 @@ class PlayerManager implements CallbackListener, TimerListener { | |||||||
| 	 */ | 	 */ | ||||||
| 	public function onInit() { | 	public function onInit() { | ||||||
| 		// Add all players | 		// Add all players | ||||||
| 		$players = $this->maniaControl->client->getPlayerList(300, 0, 2); | 		$players = $this->maniaControl->getClient()->getPlayerList(300, 0, 2); | ||||||
| 		foreach ($players as $playerItem) { | 		foreach ($players as $playerItem) { | ||||||
| 			if ($playerItem->playerId <= 0) { | 			if ($playerItem->playerId <= 0) { | ||||||
| 				continue; | 				continue; | ||||||
| 			} | 			} | ||||||
| 			try { | 			try { | ||||||
| 				$detailedPlayerInfo = $this->maniaControl->client->getDetailedPlayerInfo($playerItem->login); | 				$detailedPlayerInfo = $this->maniaControl->getClient()->getDetailedPlayerInfo($playerItem->login); | ||||||
| 			} catch (UnknownPlayerException $exception) { | 			} catch (UnknownPlayerException $exception) { | ||||||
| 				continue; | 				continue; | ||||||
| 			} | 			} | ||||||
|  |  | ||||||
| 			// Check if the Player is in a Team, to notify if its a TeamMode or not | 			// Check if the Player is in a Team, to notify if its a TeamMode or not | ||||||
| 			if ($playerItem->teamId >= 0) { | 			if ($playerItem->teamId >= 0) { | ||||||
| 				$this->maniaControl->server->setTeamMode(true); | 				$this->maniaControl->getServer()->setTeamMode(true); | ||||||
| 			} | 			} | ||||||
|  |  | ||||||
| 			$player = new Player($this->maniaControl, true); | 			$player = new Player($this->maniaControl, true); | ||||||
| @@ -217,7 +226,7 @@ class PlayerManager implements CallbackListener, TimerListener { | |||||||
| 	 * @return bool | 	 * @return bool | ||||||
| 	 */ | 	 */ | ||||||
| 	private function savePlayer(Player &$player) { | 	private function savePlayer(Player &$player) { | ||||||
| 		$mysqli = $this->maniaControl->database->mysqli; | 		$mysqli = $this->maniaControl->getDatabase()->getMysqli(); | ||||||
|  |  | ||||||
| 		// Save player | 		// Save player | ||||||
| 		$playerQuery     = "INSERT INTO `" . self::TABLE_PLAYERS . "` ( | 		$playerQuery     = "INSERT INTO `" . self::TABLE_PLAYERS . "` ( | ||||||
| @@ -276,7 +285,7 @@ class PlayerManager implements CallbackListener, TimerListener { | |||||||
| 	public function playerConnect(array $callback) { | 	public function playerConnect(array $callback) { | ||||||
| 		$login = $callback[1][0]; | 		$login = $callback[1][0]; | ||||||
| 		try { | 		try { | ||||||
| 			$playerInfo = $this->maniaControl->client->getDetailedPlayerInfo($login); | 			$playerInfo = $this->maniaControl->getClient()->getDetailedPlayerInfo($login); | ||||||
| 			$player     = new Player($this->maniaControl, true); | 			$player     = new Player($this->maniaControl, true); | ||||||
| 			$player->setDetailedInfo($playerInfo); | 			$player->setDetailedInfo($playerInfo); | ||||||
|  |  | ||||||
| @@ -298,9 +307,9 @@ class PlayerManager implements CallbackListener, TimerListener { | |||||||
| 		} | 		} | ||||||
|  |  | ||||||
| 		// Trigger own callbacks | 		// Trigger own callbacks | ||||||
| 		$this->maniaControl->callbackManager->triggerCallback(self::CB_PLAYERDISCONNECT, $player); | 		$this->maniaControl->getCallbackManager()->triggerCallback(self::CB_PLAYERDISCONNECT, $player); | ||||||
| 		if ($this->getPlayerCount(false) <= 0) { | 		if ($this->getPlayerCount(false) <= 0) { | ||||||
| 			$this->maniaControl->callbackManager->triggerCallback(self::CB_SERVER_EMPTY); | 			$this->maniaControl->getCallbackManager()->triggerCallback(self::CB_SERVER_EMPTY); | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
| 		if ($player->isFakePlayer()) { | 		if ($player->isFakePlayer()) { | ||||||
| @@ -311,12 +320,12 @@ class PlayerManager implements CallbackListener, TimerListener { | |||||||
| 		$logMessage = "Player left: {$player->login} / {$player->nickname} Playtime: {$played}"; | 		$logMessage = "Player left: {$player->login} / {$player->nickname} Playtime: {$played}"; | ||||||
| 		$this->maniaControl->log(Formatter::stripCodes($logMessage)); | 		$this->maniaControl->log(Formatter::stripCodes($logMessage)); | ||||||
|  |  | ||||||
| 		if ($this->maniaControl->settingManager->getSettingValue($this, self::SETTING_JOIN_LEAVE_MESSAGES)) { | 		if ($this->maniaControl->getSettingManager()->getSettingValue($this, self::SETTING_JOIN_LEAVE_MESSAGES)) { | ||||||
| 			$this->maniaControl->chat->sendChat('$0f0$<$fff' . $player->nickname . '$> has left the game'); | 			$this->maniaControl->getChat()->sendChat('$0f0$<$fff' . $player->nickname . '$> has left the game'); | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
| 		//Destroys stored PlayerData, after all Disconnect Callbacks got Handled | 		//Destroys stored PlayerData, after all Disconnect Callbacks got Handled | ||||||
| 		$this->playerDataManager->destroyPlayerData($player); | 		$this->getPlayerDataManager()->destroyPlayerData($player); | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	/** | 	/** | ||||||
| @@ -350,7 +359,7 @@ class PlayerManager implements CallbackListener, TimerListener { | |||||||
| 		} | 		} | ||||||
| 		$playedTime = time() - $player->joinTime; | 		$playedTime = time() - $player->joinTime; | ||||||
|  |  | ||||||
| 		return $this->maniaControl->statisticManager->insertStat(self::STAT_SERVERTIME, $player, $this->maniaControl->server->index, $playedTime); | 		return $this->maniaControl->getStatisticManager()->insertStat(self::STAT_SERVERTIME, $player, $this->maniaControl->getServer()->index, $playedTime); | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	/** | 	/** | ||||||
| @@ -388,7 +397,7 @@ class PlayerManager implements CallbackListener, TimerListener { | |||||||
|  |  | ||||||
| 		//Check if the Player is in a Team, to notify if its a TeamMode or not | 		//Check if the Player is in a Team, to notify if its a TeamMode or not | ||||||
| 		if ($player->teamId >= 0) { | 		if ($player->teamId >= 0) { | ||||||
| 			$this->maniaControl->server->setTeamMode(true); | 			$this->maniaControl->getServer()->setTeamMode(true); | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
| 		$prevJoinState = $player->hasJoinedGame; | 		$prevJoinState = $player->hasJoinedGame; | ||||||
| @@ -399,26 +408,25 @@ class PlayerManager implements CallbackListener, TimerListener { | |||||||
| 		//Check if Player finished joining the game | 		//Check if Player finished joining the game | ||||||
| 		if ($player->hasJoinedGame && !$prevJoinState) { | 		if ($player->hasJoinedGame && !$prevJoinState) { | ||||||
|  |  | ||||||
| 			if ($this->maniaControl->settingManager->getSettingValue($this, self::SETTING_JOIN_LEAVE_MESSAGES) && !$player->isFakePlayer()) { | 			if ($this->maniaControl->getSettingManager()->getSettingValue($this, self::SETTING_JOIN_LEAVE_MESSAGES) && !$player->isFakePlayer()) { | ||||||
| 				$string      = array(0 => '$0f0Player', 1 => '$0f0Moderator', 2 => '$0f0Admin', 3 => '$0f0SuperAdmin', 4 => '$0f0MasterAdmin'); | 				$string      = array(0 => '$0f0Player', 1 => '$0f0Moderator', 2 => '$0f0Admin', 3 => '$0f0SuperAdmin', 4 => '$0f0MasterAdmin'); | ||||||
| 				$chatMessage = '$0f0' . $string[$player->authLevel] . ' $<$fff' . $player->nickname . '$> Nation: $<$fff' . $player->getCountry() . '$> joined!'; | 				$chatMessage = '$0f0' . $string[$player->authLevel] . ' $<$fff' . $player->nickname . '$> Nation: $<$fff' . $player->getCountry() . '$> joined!'; | ||||||
| 				$this->maniaControl->chat->sendChat($chatMessage); | 				$this->maniaControl->getChat()->sendChat($chatMessage); | ||||||
| 				$this->maniaControl->chat->sendInformation('This server uses ManiaControl v' . ManiaControl::VERSION . '!', $player->login); | 				$this->maniaControl->getChat()->sendInformation('This server uses ManiaControl v' . ManiaControl::VERSION . '!', $player->login); | ||||||
| 			} | 			} | ||||||
|  |  | ||||||
| 			$logMessage = "Player joined: {$player->login} / " . Formatter::stripCodes($player->nickname) . " Nation: " . $player->getCountry() . " IP: {$player->ipAddress}"; | 			$logMessage = "Player joined: {$player->login} / " . Formatter::stripCodes($player->nickname) . " Nation: " . $player->getCountry() . " IP: {$player->ipAddress}"; | ||||||
| 			$this->maniaControl->log($logMessage); | 			$this->maniaControl->log($logMessage); | ||||||
|  |  | ||||||
| 			// Increment the Player Join Count | 			// Increment the Player Join Count | ||||||
| 			$this->maniaControl->statisticManager->incrementStat(self::STAT_JOIN_COUNT, $player, $this->maniaControl->server->index); | 			$this->maniaControl->getStatisticManager()->incrementStat(self::STAT_JOIN_COUNT, $player, $this->maniaControl->getServer()->index); | ||||||
|  |  | ||||||
| 			// Trigger own PlayerJoined callback | 			// Trigger own PlayerJoined callback | ||||||
| 			$this->maniaControl->callbackManager->triggerCallback(self::CB_PLAYERCONNECT, $player); | 			$this->maniaControl->getCallbackManager()->triggerCallback(self::CB_PLAYERCONNECT, $player); | ||||||
|  |  | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
| 		// Trigger own callback | 		// Trigger own callback | ||||||
| 		$this->maniaControl->callbackManager->triggerCallback(self::CB_PLAYERINFOCHANGED, $player); | 		$this->maniaControl->getCallbackManager()->triggerCallback(self::CB_PLAYERINFOCHANGED, $player); | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	/** | 	/** | ||||||
| @@ -448,7 +456,7 @@ class PlayerManager implements CallbackListener, TimerListener { | |||||||
| 	 * @return Player | 	 * @return Player | ||||||
| 	 */ | 	 */ | ||||||
| 	private function getPlayerFromDatabaseByLogin($playerLogin) { | 	private function getPlayerFromDatabaseByLogin($playerLogin) { | ||||||
| 		$mysqli = $this->maniaControl->database->mysqli; | 		$mysqli = $this->maniaControl->getDatabase()->getMysqli(); | ||||||
|  |  | ||||||
| 		$query  = "SELECT * FROM `" . self::TABLE_PLAYERS . "` | 		$query  = "SELECT * FROM `" . self::TABLE_PLAYERS . "` | ||||||
| 				WHERE `login` LIKE '" . $mysqli->escape_string($playerLogin) . "';"; | 				WHERE `login` LIKE '" . $mysqli->escape_string($playerLogin) . "';"; | ||||||
| @@ -533,7 +541,7 @@ class PlayerManager implements CallbackListener, TimerListener { | |||||||
| 			return null; | 			return null; | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
| 		$mysqli = $this->maniaControl->database->mysqli; | 		$mysqli = $this->maniaControl->getDatabase()->getMysqli(); | ||||||
| 		$query  = "SELECT * FROM `" . self::TABLE_PLAYERS . "` | 		$query  = "SELECT * FROM `" . self::TABLE_PLAYERS . "` | ||||||
| 				WHERE `index` = {$playerIndex};"; | 				WHERE `index` = {$playerIndex};"; | ||||||
| 		$result = $mysqli->query($query); | 		$result = $mysqli->query($query); | ||||||
|   | |||||||
| @@ -45,8 +45,11 @@ class InstallMenu implements ConfiguratorMenu, ManialinkPageAnswerListener { | |||||||
| 	public function __construct(ManiaControl $maniaControl) { | 	public function __construct(ManiaControl $maniaControl) { | ||||||
| 		$this->maniaControl = $maniaControl; | 		$this->maniaControl = $maniaControl; | ||||||
|  |  | ||||||
| 		$this->maniaControl->authenticationManager->definePermissionLevel(self::SETTING_PERMISSION_INSTALL_PLUGINS, AuthenticationManager::AUTH_LEVEL_SUPERADMIN); | 		// Permissions | ||||||
| 		$this->maniaControl->manialinkManager->registerManialinkPageAnswerListener(self::ACTION_REFRESH_LIST, $this, 'handleRefreshListAction'); | 		$this->maniaControl->getAuthenticationManager()->definePermissionLevel(self::SETTING_PERMISSION_INSTALL_PLUGINS, AuthenticationManager::AUTH_LEVEL_SUPERADMIN); | ||||||
|  |  | ||||||
|  | 		// Callbacks | ||||||
|  | 		$this->maniaControl->getManialinkManager()->registerManialinkPageAnswerListener(self::ACTION_REFRESH_LIST, $this, 'handleRefreshListAction'); | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	/** | 	/** | ||||||
| @@ -122,7 +125,7 @@ class InstallMenu implements ConfiguratorMenu, ManialinkPageAnswerListener { | |||||||
|  |  | ||||||
| 			// List plugins | 			// List plugins | ||||||
| 			foreach ($pluginList as $plugin) { | 			foreach ($pluginList as $plugin) { | ||||||
| 				if ($this->maniaControl->pluginManager->isPluginIdInstalled($plugin->id)) { | 				if ($this->maniaControl->getPluginManager()->isPluginIdInstalled($plugin->id)) { | ||||||
| 					// Already installed -> Skip | 					// Already installed -> Skip | ||||||
| 					continue; | 					continue; | ||||||
| 				} | 				} | ||||||
| @@ -270,6 +273,6 @@ class InstallMenu implements ConfiguratorMenu, ManialinkPageAnswerListener { | |||||||
| 	 * @param Player $player | 	 * @param Player $player | ||||||
| 	 */ | 	 */ | ||||||
| 	public function handleRefreshListAction(array $actionCallback, Player $player) { | 	public function handleRefreshListAction(array $actionCallback, Player $player) { | ||||||
| 		$this->maniaControl->configurator->showMenu($player, $this); | 		$this->maniaControl->getConfigurator()->showMenu($player, $this); | ||||||
| 	} | 	} | ||||||
| } | } | ||||||
|   | |||||||
| @@ -47,10 +47,10 @@ class PluginManager { | |||||||
| 		$this->initTables(); | 		$this->initTables(); | ||||||
|  |  | ||||||
| 		$this->pluginMenu = new PluginMenu($maniaControl); | 		$this->pluginMenu = new PluginMenu($maniaControl); | ||||||
| 		$this->maniaControl->configurator->addMenu($this->pluginMenu); | 		$this->maniaControl->getConfigurator()->addMenu($this->pluginMenu); | ||||||
|  |  | ||||||
| 		$this->pluginInstallMenu = new InstallMenu($maniaControl); | 		$this->pluginInstallMenu = new InstallMenu($maniaControl); | ||||||
| 		$this->maniaControl->configurator->addMenu($this->pluginInstallMenu); | 		$this->maniaControl->getConfigurator()->addMenu($this->pluginInstallMenu); | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	/** | 	/** | ||||||
| @@ -59,7 +59,7 @@ class PluginManager { | |||||||
| 	 * @return bool | 	 * @return bool | ||||||
| 	 */ | 	 */ | ||||||
| 	private function initTables() { | 	private function initTables() { | ||||||
| 		$mysqli            = $this->maniaControl->database->mysqli; | 		$mysqli            = $this->maniaControl->getDatabase()->getMysqli(); | ||||||
| 		$pluginsTableQuery = "CREATE TABLE IF NOT EXISTS `" . self::TABLE_PLUGINS . "` ( | 		$pluginsTableQuery = "CREATE TABLE IF NOT EXISTS `" . self::TABLE_PLUGINS . "` ( | ||||||
| 				`index` int(11) NOT NULL AUTO_INCREMENT, | 				`index` int(11) NOT NULL AUTO_INCREMENT, | ||||||
| 				`className` varchar(100) NOT NULL, | 				`className` varchar(100) NOT NULL, | ||||||
| @@ -152,22 +152,22 @@ class PluginManager { | |||||||
| 		$plugin->unload(); | 		$plugin->unload(); | ||||||
|  |  | ||||||
| 		if ($plugin instanceof CallbackListener) { | 		if ($plugin instanceof CallbackListener) { | ||||||
| 			$this->maniaControl->callbackManager->unregisterCallbackListener($plugin); | 			$this->maniaControl->getCallbackManager()->unregisterCallbackListener($plugin); | ||||||
| 			$this->maniaControl->callbackManager->unregisterScriptCallbackListener($plugin); | 			$this->maniaControl->getCallbackManager()->unregisterScriptCallbackListener($plugin); | ||||||
| 		} | 		} | ||||||
| 		if ($plugin instanceof CommandListener) { | 		if ($plugin instanceof CommandListener) { | ||||||
| 			$this->maniaControl->commandManager->unregisterCommandListener($plugin); | 			$this->maniaControl->getCommandManager()->unregisterCommandListener($plugin); | ||||||
| 		} | 		} | ||||||
| 		if ($plugin instanceof ManialinkPageAnswerListener) { | 		if ($plugin instanceof ManialinkPageAnswerListener) { | ||||||
| 			$this->maniaControl->manialinkManager->unregisterManialinkPageAnswerListener($plugin); | 			$this->maniaControl->getManialinkManager()->unregisterManialinkPageAnswerListener($plugin); | ||||||
| 		} | 		} | ||||||
| 		if ($plugin instanceof TimerListener) { | 		if ($plugin instanceof TimerListener) { | ||||||
| 			$this->maniaControl->timerManager->unregisterTimerListenings($plugin); | 			$this->maniaControl->getTimerManager()->unregisterTimerListenings($plugin); | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
| 		$this->savePluginStatus($pluginClass, false); | 		$this->savePluginStatus($pluginClass, false); | ||||||
|  |  | ||||||
| 		$this->maniaControl->callbackManager->triggerCallback(self::CB_PLUGIN_UNLOADED, $pluginClass, $plugin); | 		$this->maniaControl->getCallbackManager()->triggerCallback(self::CB_PLUGIN_UNLOADED, $pluginClass, $plugin); | ||||||
|  |  | ||||||
| 		return true; | 		return true; | ||||||
| 	} | 	} | ||||||
| @@ -205,7 +205,7 @@ class PluginManager { | |||||||
| 	 * @return bool | 	 * @return bool | ||||||
| 	 */ | 	 */ | ||||||
| 	private function savePluginStatus($className, $active) { | 	private function savePluginStatus($className, $active) { | ||||||
| 		$mysqli            = $this->maniaControl->database->mysqli; | 		$mysqli            = $this->maniaControl->getDatabase()->getMysqli(); | ||||||
| 		$pluginStatusQuery = "INSERT INTO `" . self::TABLE_PLUGINS . "` ( | 		$pluginStatusQuery = "INSERT INTO `" . self::TABLE_PLUGINS . "` ( | ||||||
| 				`className`, | 				`className`, | ||||||
| 				`active` | 				`active` | ||||||
| @@ -327,7 +327,7 @@ class PluginManager { | |||||||
| 	 * @return bool | 	 * @return bool | ||||||
| 	 */ | 	 */ | ||||||
| 	public function getSavedPluginStatus($className) { | 	public function getSavedPluginStatus($className) { | ||||||
| 		$mysqli            = $this->maniaControl->database->mysqli; | 		$mysqli            = $this->maniaControl->getDatabase()->getMysqli(); | ||||||
| 		$pluginStatusQuery = "SELECT `active` FROM `" . self::TABLE_PLUGINS . "` | 		$pluginStatusQuery = "SELECT `active` FROM `" . self::TABLE_PLUGINS . "` | ||||||
| 				WHERE `className` = ?;"; | 				WHERE `className` = ?;"; | ||||||
| 		$pluginStatement   = $mysqli->prepare($pluginStatusQuery); | 		$pluginStatement   = $mysqli->prepare($pluginStatusQuery); | ||||||
| @@ -378,7 +378,7 @@ class PluginManager { | |||||||
| 			$plugin->load($this->maniaControl); | 			$plugin->load($this->maniaControl); | ||||||
| 		} catch (\Exception $e) { | 		} catch (\Exception $e) { | ||||||
| 			$message = "Error during Plugin Activation of '{$pluginClass}': '{$e->getMessage()}'"; | 			$message = "Error during Plugin Activation of '{$pluginClass}': '{$e->getMessage()}'"; | ||||||
| 			$this->maniaControl->chat->sendError($message, $adminLogin); | 			$this->maniaControl->getChat()->sendError($message, $adminLogin); | ||||||
| 			$this->maniaControl->log($message); | 			$this->maniaControl->log($message); | ||||||
| 			$this->savePluginStatus($pluginClass, false); | 			$this->savePluginStatus($pluginClass, false); | ||||||
| 			return false; | 			return false; | ||||||
| @@ -387,7 +387,7 @@ class PluginManager { | |||||||
| 		$this->activePlugins[$pluginClass] = $plugin; | 		$this->activePlugins[$pluginClass] = $plugin; | ||||||
| 		$this->savePluginStatus($pluginClass, true); | 		$this->savePluginStatus($pluginClass, true); | ||||||
|  |  | ||||||
| 		$this->maniaControl->callbackManager->triggerCallback(self::CB_PLUGIN_LOADED, $pluginClass, $plugin); | 		$this->maniaControl->getCallbackManager()->triggerCallback(self::CB_PLUGIN_LOADED, $pluginClass, $plugin); | ||||||
|  |  | ||||||
| 		return true; | 		return true; | ||||||
| 	} | 	} | ||||||
| @@ -462,7 +462,7 @@ class PluginManager { | |||||||
| 	 */ | 	 */ | ||||||
| 	public function fetchPluginList(callable $function) { | 	public function fetchPluginList(callable $function) { | ||||||
| 		$url = ManiaControl::URL_WEBSERVICE . 'plugins'; | 		$url = ManiaControl::URL_WEBSERVICE . 'plugins'; | ||||||
| 		$this->maniaControl->fileReader->loadFile($url, function ($dataJson, $error) use (&$function) { | 		$this->maniaControl->getFileReader()->loadFile($url, function ($dataJson, $error) use (&$function) { | ||||||
| 			$data = json_decode($dataJson); | 			$data = json_decode($dataJson); | ||||||
| 			call_user_func($function, $data, $error); | 			call_user_func($function, $data, $error); | ||||||
| 		}); | 		}); | ||||||
|   | |||||||
| @@ -52,16 +52,19 @@ class PluginMenu implements CallbackListener, ConfiguratorMenu, ManialinkPageAns | |||||||
| 	private $maniaControl = null; | 	private $maniaControl = null; | ||||||
|  |  | ||||||
| 	/** | 	/** | ||||||
| 	 * Create a new plugin menu instance | 	 * Construct a new plugin menu instance | ||||||
| 	 * | 	 * | ||||||
| 	 * @param ManiaControl $maniaControl | 	 * @param ManiaControl $maniaControl | ||||||
| 	 */ | 	 */ | ||||||
| 	public function __construct(ManiaControl $maniaControl) { | 	public function __construct(ManiaControl $maniaControl) { | ||||||
| 		$this->maniaControl = $maniaControl; | 		$this->maniaControl = $maniaControl; | ||||||
|  |  | ||||||
| 		$this->maniaControl->manialinkManager->registerManialinkPageAnswerListener(self::ACTION_BACK_TO_PLUGINS, $this, 'backToPlugins'); | 		// Callbacks | ||||||
| 		$this->maniaControl->callbackManager->registerCallbackListener(CallbackManager::CB_MP_PLAYERMANIALINKPAGEANSWER, $this, 'handleManialinkPageAnswer'); | 		$this->maniaControl->getCallbackManager()->registerCallbackListener(CallbackManager::CB_MP_PLAYERMANIALINKPAGEANSWER, $this, 'handleManialinkPageAnswer'); | ||||||
| 		$this->maniaControl->authenticationManager->definePermissionLevel(self::SETTING_PERMISSION_CHANGE_PLUGIN_SETTINGS, AuthenticationManager::AUTH_LEVEL_SUPERADMIN); | 		$this->maniaControl->getManialinkManager()->registerManialinkPageAnswerListener(self::ACTION_BACK_TO_PLUGINS, $this, 'backToPlugins'); | ||||||
|  |  | ||||||
|  | 		// Permissions | ||||||
|  | 		$this->maniaControl->getAuthenticationManager()->definePermissionLevel(self::SETTING_PERMISSION_CHANGE_PLUGIN_SETTINGS, AuthenticationManager::AUTH_LEVEL_SUPERADMIN); | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	/** | 	/** | ||||||
| @@ -79,7 +82,7 @@ class PluginMenu implements CallbackListener, ConfiguratorMenu, ManialinkPageAns | |||||||
| 	 */ | 	 */ | ||||||
| 	public function backToPlugins($callback, Player $player) { | 	public function backToPlugins($callback, Player $player) { | ||||||
| 		$player->destroyCache($this, self::CACHE_SETTING_CLASS); | 		$player->destroyCache($this, self::CACHE_SETTING_CLASS); | ||||||
| 		$this->maniaControl->configurator->showMenu($player, $this); | 		$this->maniaControl->getConfigurator()->showMenu($player, $this); | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	/** | 	/** | ||||||
| @@ -90,7 +93,7 @@ class PluginMenu implements CallbackListener, ConfiguratorMenu, ManialinkPageAns | |||||||
| 		$script->addFeature($paging); | 		$script->addFeature($paging); | ||||||
| 		$frame = new Frame(); | 		$frame = new Frame(); | ||||||
|  |  | ||||||
| 		$pluginClasses = $this->maniaControl->pluginManager->getPluginClasses(); | 		$pluginClasses = $this->maniaControl->getPluginManager()->getPluginClasses(); | ||||||
|  |  | ||||||
| 		// Config | 		// Config | ||||||
| 		$pagerSize    = 9.; | 		$pagerSize    = 9.; | ||||||
| @@ -131,7 +134,7 @@ class PluginMenu implements CallbackListener, ConfiguratorMenu, ManialinkPageAns | |||||||
| 		// Display normal Plugin List | 		// Display normal Plugin List | ||||||
| 		// Plugin pages | 		// Plugin pages | ||||||
| 		$posY          = 0.; | 		$posY          = 0.; | ||||||
| 		$pluginUpdates = $this->maniaControl->updateManager->pluginUpdateManager->getPluginsUpdates(); | 		$pluginUpdates = $this->maniaControl->getUpdateManager()->getPluginUpdateManager()->getPluginsUpdates(); | ||||||
|  |  | ||||||
| 		usort($pluginClasses, function ($pluginClassA, $pluginClassB) { | 		usort($pluginClasses, function ($pluginClassA, $pluginClassB) { | ||||||
| 			/** @var Plugin $pluginClassA */ | 			/** @var Plugin $pluginClassA */ | ||||||
| @@ -149,7 +152,7 @@ class PluginMenu implements CallbackListener, ConfiguratorMenu, ManialinkPageAns | |||||||
| 				$posY = $height * 0.41; | 				$posY = $height * 0.41; | ||||||
| 			} | 			} | ||||||
|  |  | ||||||
| 			$active = $this->maniaControl->pluginManager->isPluginActive($pluginClass); | 			$active = $this->maniaControl->getPluginManager()->isPluginActive($pluginClass); | ||||||
|  |  | ||||||
| 			$pluginFrame = new Frame(); | 			$pluginFrame = new Frame(); | ||||||
| 			$pageFrame->add($pluginFrame); | 			$pageFrame->add($pluginFrame); | ||||||
| @@ -251,7 +254,7 @@ class PluginMenu implements CallbackListener, ConfiguratorMenu, ManialinkPageAns | |||||||
| 	 */ | 	 */ | ||||||
| 	private function getPluginSettingsMenu(Frame $frame, $width, $height, Paging $paging, Player $player, $settingClass) { | 	private function getPluginSettingsMenu(Frame $frame, $width, $height, Paging $paging, Player $player, $settingClass) { | ||||||
| 		// TODO: centralize menu code to use by mc settings and plugin settings | 		// TODO: centralize menu code to use by mc settings and plugin settings | ||||||
| 		$settings = $this->maniaControl->settingManager->getSettingsByClass($settingClass); | 		$settings = $this->maniaControl->getSettingManager()->getSettingsByClass($settingClass); | ||||||
|  |  | ||||||
| 		$pageSettingsMaxCount = 11; | 		$pageSettingsMaxCount = 11; | ||||||
| 		$posY                 = 0; | 		$posY                 = 0; | ||||||
| @@ -344,7 +347,7 @@ class PluginMenu implements CallbackListener, ConfiguratorMenu, ManialinkPageAns | |||||||
| 	 */ | 	 */ | ||||||
| 	public function handleManialinkPageAnswer(array $callback) { | 	public function handleManialinkPageAnswer(array $callback) { | ||||||
| 		$login  = $callback[1][1]; | 		$login  = $callback[1][1]; | ||||||
| 		$player = $this->maniaControl->playerManager->getPlayer($login); | 		$player = $this->maniaControl->getPlayerManager()->getPlayer($login); | ||||||
| 		if (!$player) { | 		if (!$player) { | ||||||
| 			return; | 			return; | ||||||
| 		} | 		} | ||||||
| @@ -360,22 +363,22 @@ class PluginMenu implements CallbackListener, ConfiguratorMenu, ManialinkPageAns | |||||||
| 		if ($enable) { | 		if ($enable) { | ||||||
| 			$pluginClass = substr($actionId, strlen(self::ACTION_PREFIX_ENABLEPLUGIN)); | 			$pluginClass = substr($actionId, strlen(self::ACTION_PREFIX_ENABLEPLUGIN)); | ||||||
| 			/** @var Plugin $pluginClass */ | 			/** @var Plugin $pluginClass */ | ||||||
| 			$activated = $this->maniaControl->pluginManager->activatePlugin($pluginClass, $player->login); | 			$activated = $this->maniaControl->getPluginManager()->activatePlugin($pluginClass, $player->login); | ||||||
| 			if ($activated) { | 			if ($activated) { | ||||||
| 				$this->maniaControl->chat->sendSuccess($pluginClass::getName() . ' activated!', $player); | 				$this->maniaControl->getChat()->sendSuccess($pluginClass::getName() . ' activated!', $player); | ||||||
| 				$this->maniaControl->log("{$player->login} activated '{$pluginClass}'!", true); | 				$this->maniaControl->log("{$player->login} activated '{$pluginClass}'!", true); | ||||||
| 			} else { | 			} else { | ||||||
| 				$this->maniaControl->chat->sendError('Error activating ' . $pluginClass::getName() . '!', $player); | 				$this->maniaControl->getChat()->sendError('Error activating ' . $pluginClass::getName() . '!', $player); | ||||||
| 			} | 			} | ||||||
| 		} else if ($disable) { | 		} else if ($disable) { | ||||||
| 			$pluginClass = substr($actionId, strlen(self::ACTION_PREFIX_DISABLEPLUGIN)); | 			$pluginClass = substr($actionId, strlen(self::ACTION_PREFIX_DISABLEPLUGIN)); | ||||||
| 			/** @var Plugin $pluginClass */ | 			/** @var Plugin $pluginClass */ | ||||||
| 			$deactivated = $this->maniaControl->pluginManager->deactivatePlugin($pluginClass); | 			$deactivated = $this->maniaControl->getPluginManager()->deactivatePlugin($pluginClass); | ||||||
| 			if ($deactivated) { | 			if ($deactivated) { | ||||||
| 				$this->maniaControl->chat->sendSuccess($pluginClass::getName() . ' deactivated!', $player); | 				$this->maniaControl->getChat()->sendSuccess($pluginClass::getName() . ' deactivated!', $player); | ||||||
| 				$this->maniaControl->log("{$player->login} deactivated '{$pluginClass}'!", true); | 				$this->maniaControl->log("{$player->login} deactivated '{$pluginClass}'!", true); | ||||||
| 			} else { | 			} else { | ||||||
| 				$this->maniaControl->chat->sendError('Error deactivating ' . $pluginClass::getName() . '!', $player); | 				$this->maniaControl->getChat()->sendError('Error deactivating ' . $pluginClass::getName() . '!', $player); | ||||||
| 			} | 			} | ||||||
| 		} else if ($settings) { | 		} else if ($settings) { | ||||||
| 			// Open Settings Menu | 			// Open Settings Menu | ||||||
| @@ -384,15 +387,15 @@ class PluginMenu implements CallbackListener, ConfiguratorMenu, ManialinkPageAns | |||||||
| 		} | 		} | ||||||
|  |  | ||||||
| 		// Reopen the Menu | 		// Reopen the Menu | ||||||
| 		$this->maniaControl->configurator->showMenu($player, $this); | 		$this->maniaControl->getConfigurator()->showMenu($player, $this); | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	/** | 	/** | ||||||
| 	 * @see \ManiaControl\Configurators\ConfiguratorMenu::saveConfigData() | 	 * @see \ManiaControl\Configurators\ConfiguratorMenu::saveConfigData() | ||||||
| 	 */ | 	 */ | ||||||
| 	public function saveConfigData(array $configData, Player $player) { | 	public function saveConfigData(array $configData, Player $player) { | ||||||
| 		if (!$this->maniaControl->authenticationManager->checkPermission($player, self::SETTING_PERMISSION_CHANGE_PLUGIN_SETTINGS)) { | 		if (!$this->maniaControl->getAuthenticationManager()->checkPermission($player, self::SETTING_PERMISSION_CHANGE_PLUGIN_SETTINGS)) { | ||||||
| 			$this->maniaControl->authenticationManager->sendNotAllowed($player); | 			$this->maniaControl->getAuthenticationManager()->sendNotAllowed($player); | ||||||
| 			return; | 			return; | ||||||
| 		} | 		} | ||||||
| 		if (!$configData[3] || strpos($configData[3][0]['Name'], self::ACTION_PREFIX_SETTING) !== 0) { | 		if (!$configData[3] || strpos($configData[3][0]['Name'], self::ACTION_PREFIX_SETTING) !== 0) { | ||||||
| @@ -403,7 +406,7 @@ class PluginMenu implements CallbackListener, ConfiguratorMenu, ManialinkPageAns | |||||||
|  |  | ||||||
| 		foreach ($configData[3] as $settingData) { | 		foreach ($configData[3] as $settingData) { | ||||||
| 			$settingIndex  = (int)substr($settingData['Name'], $prefixLength); | 			$settingIndex  = (int)substr($settingData['Name'], $prefixLength); | ||||||
| 			$settingObject = $this->maniaControl->settingManager->getSettingObjectByIndex($settingIndex); | 			$settingObject = $this->maniaControl->getSettingManager()->getSettingObjectByIndex($settingIndex); | ||||||
| 			if (!$settingObject) { | 			if (!$settingObject) { | ||||||
| 				continue; | 				continue; | ||||||
| 			} | 			} | ||||||
| @@ -413,12 +416,12 @@ class PluginMenu implements CallbackListener, ConfiguratorMenu, ManialinkPageAns | |||||||
| 			} | 			} | ||||||
|  |  | ||||||
| 			$settingObject->value = $settingData['Value']; | 			$settingObject->value = $settingData['Value']; | ||||||
| 			$this->maniaControl->settingManager->saveSetting($settingObject); | 			$this->maniaControl->getSettingManager()->saveSetting($settingObject); | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
| 		$this->maniaControl->chat->sendSuccess('Plugin Settings saved!', $player); | 		$this->maniaControl->getChat()->sendSuccess('Plugin Settings saved!', $player); | ||||||
|  |  | ||||||
| 		// Reopen the Menu | 		// Reopen the Menu | ||||||
| 		$this->maniaControl->configurator->showMenu($player, $this); | 		$this->maniaControl->getConfigurator()->showMenu($player, $this); | ||||||
| 	} | 	} | ||||||
| } | } | ||||||
|   | |||||||
| @@ -56,39 +56,39 @@ class Commands implements CallbackListener, CommandListener, ManialinkPageAnswer | |||||||
| 	public function __construct(ManiaControl $maniaControl) { | 	public function __construct(ManiaControl $maniaControl) { | ||||||
| 		$this->maniaControl = $maniaControl; | 		$this->maniaControl = $maniaControl; | ||||||
|  |  | ||||||
| 		// Register for callbacks | 		// Callbacks | ||||||
| 		$this->maniaControl->timerManager->registerTimerListening($this, 'each5Seconds', 5000); | 		$this->maniaControl->getTimerManager()->registerTimerListening($this, 'each5Seconds', 5000); | ||||||
| 		$this->maniaControl->callbackManager->registerCallbackListener(Callbacks::ONINIT, $this, 'handleOnInit'); | 		$this->maniaControl->getCallbackManager()->registerCallbackListener(Callbacks::ONINIT, $this, 'handleOnInit'); | ||||||
| 		$this->maniaControl->callbackManager->registerCallbackListener(Callbacks::WARMUPSTATUS, $this, 'handleWarmUpStatus'); | 		$this->maniaControl->getCallbackManager()->registerCallbackListener(Callbacks::WARMUPSTATUS, $this, 'handleWarmUpStatus'); | ||||||
|  |  | ||||||
| 		// Register for commands | 		// Chat commands | ||||||
| 		$this->maniaControl->commandManager->registerCommandListener('setservername', $this, 'commandSetServerName', true, 'Sets the ServerName.'); | 		$this->maniaControl->getCommandManager()->registerCommandListener('setservername', $this, 'commandSetServerName', true, 'Sets the ServerName.'); | ||||||
| 		$this->maniaControl->commandManager->registerCommandListener('setpwd', $this, 'commandSetPwd', true, 'Sets play password.'); | 		$this->maniaControl->getCommandManager()->registerCommandListener('setpwd', $this, 'commandSetPwd', true, 'Sets play password.'); | ||||||
| 		$this->maniaControl->commandManager->registerCommandListener('setspecpwd', $this, 'commandSetSpecPwd', true, 'Sets spectator password.'); | 		$this->maniaControl->getCommandManager()->registerCommandListener('setspecpwd', $this, 'commandSetSpecPwd', true, 'Sets spectator password.'); | ||||||
| 		$this->maniaControl->commandManager->registerCommandListener('setmaxplayers', $this, 'commandSetMaxPlayers', true, 'Sets the maximum number of players.'); | 		$this->maniaControl->getCommandManager()->registerCommandListener('setmaxplayers', $this, 'commandSetMaxPlayers', true, 'Sets the maximum number of players.'); | ||||||
| 		$this->maniaControl->commandManager->registerCommandListener('setmaxspectators', $this, 'commandSetMaxSpectators', true, 'Sets the maximum number of spectators.'); | 		$this->maniaControl->getCommandManager()->registerCommandListener('setmaxspectators', $this, 'commandSetMaxSpectators', true, 'Sets the maximum number of spectators.'); | ||||||
| 		$this->maniaControl->commandManager->registerCommandListener('shutdownserver', $this, 'commandShutdownServer', true, 'Shuts down the ManiaPlanet server.'); | 		$this->maniaControl->getCommandManager()->registerCommandListener('shutdownserver', $this, 'commandShutdownServer', true, 'Shuts down the ManiaPlanet server.'); | ||||||
| 		$this->maniaControl->commandManager->registerCommandListener('systeminfo', $this, 'commandSystemInfo', true, 'Shows system information.'); | 		$this->maniaControl->getCommandManager()->registerCommandListener('systeminfo', $this, 'commandSystemInfo', true, 'Shows system information.'); | ||||||
| 		$this->maniaControl->commandManager->registerCommandListener('cancel', $this, 'commandCancelVote', true, 'Cancels the current vote.'); | 		$this->maniaControl->getCommandManager()->registerCommandListener('cancel', $this, 'commandCancelVote', true, 'Cancels the current vote.'); | ||||||
|  |  | ||||||
| 		// Register for page actions | 		// Page actions | ||||||
| 		$this->maniaControl->manialinkManager->registerManialinkPageAnswerListener(self::ACTION_SET_PAUSE, $this, 'setPause'); | 		$this->maniaControl->getManialinkManager()->registerManialinkPageAnswerListener(self::ACTION_SET_PAUSE, $this, 'setPause'); | ||||||
| 		$this->maniaControl->manialinkManager->registerManialinkPageAnswerListener(self::ACTION_EXTEND_WARMUP, $this, 'commandExtendWarmup'); | 		$this->maniaControl->getManialinkManager()->registerManialinkPageAnswerListener(self::ACTION_EXTEND_WARMUP, $this, 'commandExtendWarmup'); | ||||||
| 		$this->maniaControl->manialinkManager->registerManialinkPageAnswerListener(self::ACTION_END_WARMUP, $this, 'commandEndWarmup'); | 		$this->maniaControl->getManialinkManager()->registerManialinkPageAnswerListener(self::ACTION_END_WARMUP, $this, 'commandEndWarmup'); | ||||||
| 		$this->maniaControl->manialinkManager->registerManialinkPageAnswerListener(self::ACTION_CANCEL_VOTE, $this, 'commandCancelVote'); | 		$this->maniaControl->getManialinkManager()->registerManialinkPageAnswerListener(self::ACTION_CANCEL_VOTE, $this, 'commandCancelVote'); | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	/** | 	/** | ||||||
| 	 * Handle ManiaControl OnInit Callback | 	 * Handle ManiaControl OnInit Callback | ||||||
| 	 */ | 	 */ | ||||||
| 	public function handleOnInit() { | 	public function handleOnInit() { | ||||||
| 		// Define Permissions | 		// Permissions | ||||||
| 		$this->maniaControl->authenticationManager->definePermissionLevel(self::SETTING_PERMISSION_SHUTDOWN_SERVER, AuthenticationManager::AUTH_LEVEL_SUPERADMIN); | 		$this->maniaControl->getAuthenticationManager()->definePermissionLevel(self::SETTING_PERMISSION_SHUTDOWN_SERVER, AuthenticationManager::AUTH_LEVEL_SUPERADMIN); | ||||||
| 		$this->maniaControl->authenticationManager->definePermissionLevel(self::SETTING_PERMISSION_SHOW_SYSTEMINFO, AuthenticationManager::AUTH_LEVEL_SUPERADMIN); | 		$this->maniaControl->getAuthenticationManager()->definePermissionLevel(self::SETTING_PERMISSION_SHOW_SYSTEMINFO, AuthenticationManager::AUTH_LEVEL_SUPERADMIN); | ||||||
| 		$this->maniaControl->authenticationManager->definePermissionLevel(self::SETTING_PERMISSION_CHANGE_SERVERSETTINGS, AuthenticationManager::AUTH_LEVEL_ADMIN); | 		$this->maniaControl->getAuthenticationManager()->definePermissionLevel(self::SETTING_PERMISSION_CHANGE_SERVERSETTINGS, AuthenticationManager::AUTH_LEVEL_ADMIN); | ||||||
| 		$this->maniaControl->authenticationManager->definePermissionLevel(self::SETTING_PERMISSION_SET_PAUSE, AuthenticationManager::AUTH_LEVEL_MODERATOR); | 		$this->maniaControl->getAuthenticationManager()->definePermissionLevel(self::SETTING_PERMISSION_SET_PAUSE, AuthenticationManager::AUTH_LEVEL_MODERATOR); | ||||||
| 		$this->maniaControl->authenticationManager->definePermissionLevel(self::SETTING_PERMISSION_CANCEL_VOTE, AuthenticationManager::AUTH_LEVEL_MODERATOR); | 		$this->maniaControl->getAuthenticationManager()->definePermissionLevel(self::SETTING_PERMISSION_CANCEL_VOTE, AuthenticationManager::AUTH_LEVEL_MODERATOR); | ||||||
| 		$this->maniaControl->authenticationManager->definePermissionLevel(self::SETTING_PERMISSION_HANDLE_WARMUP, AuthenticationManager::AUTH_LEVEL_MODERATOR); | 		$this->maniaControl->getAuthenticationManager()->definePermissionLevel(self::SETTING_PERMISSION_HANDLE_WARMUP, AuthenticationManager::AUTH_LEVEL_MODERATOR); | ||||||
|  |  | ||||||
| 		$this->updateCancelVoteMenuItem(); | 		$this->updateCancelVoteMenuItem(); | ||||||
| 		$this->updateWarmUpMenuItems(); | 		$this->updateWarmUpMenuItems(); | ||||||
| @@ -101,7 +101,7 @@ class Commands implements CallbackListener, CommandListener, ManialinkPageAnswer | |||||||
| 		$itemQuad = new Quad_Icons64x64_1(); | 		$itemQuad = new Quad_Icons64x64_1(); | ||||||
| 		$itemQuad->setSubStyle($itemQuad::SUBSTYLE_ArrowRed); | 		$itemQuad->setSubStyle($itemQuad::SUBSTYLE_ArrowRed); | ||||||
| 		$itemQuad->setAction(self::ACTION_CANCEL_VOTE); | 		$itemQuad->setAction(self::ACTION_CANCEL_VOTE); | ||||||
| 		$this->maniaControl->actionsMenu->addMenuItem($itemQuad, false, 30, 'Cancel Vote'); | 		$this->maniaControl->getActionsMenu()->addMenuItem($itemQuad, false, 30, 'Cancel Vote'); | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	/** | 	/** | ||||||
| @@ -110,14 +110,14 @@ class Commands implements CallbackListener, CommandListener, ManialinkPageAnswer | |||||||
| 	private function updateWarmUpMenuItems() { | 	private function updateWarmUpMenuItems() { | ||||||
| 		$pauseExists = false; | 		$pauseExists = false; | ||||||
| 		try { | 		try { | ||||||
| 			$scriptInfos = $this->maniaControl->client->getModeScriptInfo(); | 			$scriptInfos = $this->maniaControl->getClient()->getModeScriptInfo(); | ||||||
| 			foreach ($scriptInfos->commandDescs as $param) { | 			foreach ($scriptInfos->commandDescs as $param) { | ||||||
| 				if ($param->name === self::COMMAND_FORCE_WARMUP) { | 				if ($param->name === self::COMMAND_FORCE_WARMUP) { | ||||||
| 					$pauseExists = true; | 					$pauseExists = true; | ||||||
| 					break; | 					break; | ||||||
| 				} | 				} | ||||||
| 			} | 			} | ||||||
| 			$this->maniaControl->client->triggerModeScriptEvent("WarmUp_GetStatus"); | 			$this->maniaControl->getClient()->triggerModeScriptEvent("WarmUp_GetStatus"); | ||||||
| 		} catch (GameModeException $e) { | 		} catch (GameModeException $e) { | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
| @@ -126,7 +126,7 @@ class Commands implements CallbackListener, CommandListener, ManialinkPageAnswer | |||||||
| 			$itemQuad = new Quad_Icons128x32_1(); | 			$itemQuad = new Quad_Icons128x32_1(); | ||||||
| 			$itemQuad->setSubStyle($itemQuad::SUBSTYLE_ManiaLinkSwitch); | 			$itemQuad->setSubStyle($itemQuad::SUBSTYLE_ManiaLinkSwitch); | ||||||
| 			$itemQuad->setAction(self::ACTION_SET_PAUSE); | 			$itemQuad->setAction(self::ACTION_SET_PAUSE); | ||||||
| 			$this->maniaControl->actionsMenu->addAdminMenuItem($itemQuad, 13, 'Pause the current game'); | 			$this->maniaControl->getActionsMenu()->addAdminMenuItem($itemQuad, 13, 'Pause the current game'); | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
| 	} | 	} | ||||||
| @@ -142,16 +142,16 @@ class Commands implements CallbackListener, CommandListener, ManialinkPageAnswer | |||||||
| 			$itemQuad = new Quad_BgRaceScore2(); | 			$itemQuad = new Quad_BgRaceScore2(); | ||||||
| 			$itemQuad->setSubStyle($itemQuad::SUBSTYLE_SendScore); | 			$itemQuad->setSubStyle($itemQuad::SUBSTYLE_SendScore); | ||||||
| 			$itemQuad->setAction(self::ACTION_EXTEND_WARMUP); | 			$itemQuad->setAction(self::ACTION_EXTEND_WARMUP); | ||||||
| 			$this->maniaControl->actionsMenu->addMenuItem($itemQuad, false, 14, 'Extend Warmup'); | 			$this->maniaControl->getActionsMenu()->addMenuItem($itemQuad, false, 14, 'Extend Warmup'); | ||||||
|  |  | ||||||
| 			// Stop WarmUp menu item | 			// Stop WarmUp menu item | ||||||
| 			$itemQuad = new Quad_Icons64x64_1(); | 			$itemQuad = new Quad_Icons64x64_1(); | ||||||
| 			$itemQuad->setSubStyle($itemQuad::SUBSTYLE_ArrowGreen); | 			$itemQuad->setSubStyle($itemQuad::SUBSTYLE_ArrowGreen); | ||||||
| 			$itemQuad->setAction(self::ACTION_END_WARMUP); | 			$itemQuad->setAction(self::ACTION_END_WARMUP); | ||||||
| 			$this->maniaControl->actionsMenu->addMenuItem($itemQuad, false, 15, 'End Warmup'); | 			$this->maniaControl->getActionsMenu()->addMenuItem($itemQuad, false, 15, 'End Warmup'); | ||||||
| 		} else { | 		} else { | ||||||
| 			$this->maniaControl->actionsMenu->removeMenuItem(14, false); | 			$this->maniaControl->getActionsMenu()->removeMenuItem(14, false); | ||||||
| 			$this->maniaControl->actionsMenu->removeMenuItem(15, false); | 			$this->maniaControl->getActionsMenu()->removeMenuItem(15, false); | ||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| @@ -162,18 +162,18 @@ class Commands implements CallbackListener, CommandListener, ManialinkPageAnswer | |||||||
| 	 * @param Player $player | 	 * @param Player $player | ||||||
| 	 */ | 	 */ | ||||||
| 	public function commandCancelVote(array $chatCallback, Player $player) { | 	public function commandCancelVote(array $chatCallback, Player $player) { | ||||||
| 		if (!$this->maniaControl->authenticationManager->checkPermission($player, self::SETTING_PERMISSION_CANCEL_VOTE)) { | 		if (!$this->maniaControl->getAuthenticationManager()->checkPermission($player, self::SETTING_PERMISSION_CANCEL_VOTE)) { | ||||||
| 			$this->maniaControl->authenticationManager->sendNotAllowed($player); | 			$this->maniaControl->getAuthenticationManager()->sendNotAllowed($player); | ||||||
| 			return; | 			return; | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
| 		if ($this->maniaControl->client->cancelVote()) { | 		if ($this->maniaControl->getClient()->cancelVote()) { | ||||||
| 			$this->maniaControl->chat->sendInformation($player->getEscapedNickname() . ' cancelled the Vote!'); | 			$this->maniaControl->getChat()->sendInformation($player->getEscapedNickname() . ' cancelled the Vote!'); | ||||||
| 		} else { | 		} else { | ||||||
| 			$this->maniaControl->chat->sendInformation("There's no vote running currently!", $player); | 			$this->maniaControl->getChat()->sendInformation("There's no vote running currently!", $player); | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
| 		$this->maniaControl->callbackManager->triggerCallback(self::CB_VOTE_CANCELLED, $player); | 		$this->maniaControl->getCallbackManager()->triggerCallback(self::CB_VOTE_CANCELLED, $player); | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
|  |  | ||||||
| @@ -184,14 +184,14 @@ class Commands implements CallbackListener, CommandListener, ManialinkPageAnswer | |||||||
| 	 * @param Player $player | 	 * @param Player $player | ||||||
| 	 */ | 	 */ | ||||||
| 	public function commandExtendWarmup(array $callback, Player $player) { | 	public function commandExtendWarmup(array $callback, Player $player) { | ||||||
| 		if (!$this->maniaControl->authenticationManager->checkPermission($player, self::SETTING_PERMISSION_HANDLE_WARMUP)) { | 		if (!$this->maniaControl->getAuthenticationManager()->checkPermission($player, self::SETTING_PERMISSION_HANDLE_WARMUP)) { | ||||||
| 			$this->maniaControl->authenticationManager->sendNotAllowed($player); | 			$this->maniaControl->getAuthenticationManager()->sendNotAllowed($player); | ||||||
| 			return; | 			return; | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
| 		try { | 		try { | ||||||
| 			$this->maniaControl->client->triggerModeScriptEvent('WarmUp_Extend', '10'); | 			$this->maniaControl->getClient()->triggerModeScriptEvent('WarmUp_Extend', '10'); | ||||||
| 			$this->maniaControl->chat->sendInformation('$<' . $player->nickname . '$> extended the WarmUp by 10 seconds!'); | 			$this->maniaControl->getChat()->sendInformation($player->getEscapedNickname() . ' extended the WarmUp by 10 seconds!'); | ||||||
| 		} catch (GameModeException $e) { | 		} catch (GameModeException $e) { | ||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
| @@ -203,14 +203,14 @@ class Commands implements CallbackListener, CommandListener, ManialinkPageAnswer | |||||||
| 	 * @param Player $player | 	 * @param Player $player | ||||||
| 	 */ | 	 */ | ||||||
| 	public function commandEndWarmup(array $callback, Player $player) { | 	public function commandEndWarmup(array $callback, Player $player) { | ||||||
| 		if (!$this->maniaControl->authenticationManager->checkPermission($player, self::SETTING_PERMISSION_HANDLE_WARMUP)) { | 		if (!$this->maniaControl->getAuthenticationManager()->checkPermission($player, self::SETTING_PERMISSION_HANDLE_WARMUP)) { | ||||||
| 			$this->maniaControl->authenticationManager->sendNotAllowed($player); | 			$this->maniaControl->getAuthenticationManager()->sendNotAllowed($player); | ||||||
| 			return; | 			return; | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
| 		try { | 		try { | ||||||
| 			$this->maniaControl->client->triggerModeScriptEvent('WarmUp_Stop', ''); | 			$this->maniaControl->getClient()->triggerModeScriptEvent('WarmUp_Stop', ''); | ||||||
| 			$this->maniaControl->chat->sendInformation('$<' . $player->nickname . '$> stopped the WarmUp!'); | 			$this->maniaControl->getChat()->sendInformation($player->getEscapedNickname() . ' stopped the WarmUp!'); | ||||||
| 		} catch (GameModeException $e) { | 		} catch (GameModeException $e) { | ||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
| @@ -222,13 +222,13 @@ class Commands implements CallbackListener, CommandListener, ManialinkPageAnswer | |||||||
| 	 * @param Player $player | 	 * @param Player $player | ||||||
| 	 */ | 	 */ | ||||||
| 	public function setPause(array $callback, Player $player) { | 	public function setPause(array $callback, Player $player) { | ||||||
| 		if (!$this->maniaControl->authenticationManager->checkPermission($player, self::SETTING_PERMISSION_SET_PAUSE)) { | 		if (!$this->maniaControl->getAuthenticationManager()->checkPermission($player, self::SETTING_PERMISSION_SET_PAUSE)) { | ||||||
| 			$this->maniaControl->authenticationManager->sendNotAllowed($player); | 			$this->maniaControl->getAuthenticationManager()->sendNotAllowed($player); | ||||||
| 			return; | 			return; | ||||||
| 		} | 		} | ||||||
| 		try { | 		try { | ||||||
| 			$this->maniaControl->client->sendModeScriptCommands(array('Command_ForceWarmUp' => true)); | 			$this->maniaControl->getClient()->sendModeScriptCommands(array('Command_ForceWarmUp' => true)); | ||||||
| 			$this->maniaControl->chat->sendInformation('$<' . $player->nickname . '$> paused the Game!'); | 			$this->maniaControl->getChat()->sendInformation($player->getEscapedNickname() . ' paused the Game!'); | ||||||
| 		} catch (GameModeException $e) { | 		} catch (GameModeException $e) { | ||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
| @@ -240,7 +240,7 @@ class Commands implements CallbackListener, CommandListener, ManialinkPageAnswer | |||||||
| 		// TODO: move empty & delayed shutdown code into server class | 		// TODO: move empty & delayed shutdown code into server class | ||||||
| 		// Empty shutdown | 		// Empty shutdown | ||||||
| 		if ($this->serverShutdownEmpty) { | 		if ($this->serverShutdownEmpty) { | ||||||
| 			if ($this->maniaControl->playerManager->getPlayerCount(false) <= 0) { | 			if ($this->maniaControl->getPlayerManager()->getPlayerCount(false) <= 0) { | ||||||
| 				$this->shutdownServer('empty'); | 				$this->shutdownServer('empty'); | ||||||
| 			} | 			} | ||||||
| 		} | 		} | ||||||
| @@ -260,7 +260,7 @@ class Commands implements CallbackListener, CommandListener, ManialinkPageAnswer | |||||||
| 	 */ | 	 */ | ||||||
| 	private function shutdownServer($login = '-') { | 	private function shutdownServer($login = '-') { | ||||||
| 		$this->maniaControl->log("Server shutdown requested by '{$login}'!"); | 		$this->maniaControl->log("Server shutdown requested by '{$login}'!"); | ||||||
| 		$this->maniaControl->client->stopServer(); | 		$this->maniaControl->getClient()->stopServer(); | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	/** | 	/** | ||||||
| @@ -270,13 +270,13 @@ class Commands implements CallbackListener, CommandListener, ManialinkPageAnswer | |||||||
| 	 * @param Player $player | 	 * @param Player $player | ||||||
| 	 */ | 	 */ | ||||||
| 	public function commandSystemInfo(array $chat, Player $player) { | 	public function commandSystemInfo(array $chat, Player $player) { | ||||||
| 		if (!$this->maniaControl->authenticationManager->checkPermission($player, self::SETTING_PERMISSION_SHOW_SYSTEMINFO)) { | 		if (!$this->maniaControl->getAuthenticationManager()->checkPermission($player, self::SETTING_PERMISSION_SHOW_SYSTEMINFO)) { | ||||||
| 			$this->maniaControl->authenticationManager->sendNotAllowed($player); | 			$this->maniaControl->getAuthenticationManager()->sendNotAllowed($player); | ||||||
| 			return; | 			return; | ||||||
| 		} | 		} | ||||||
| 		$systemInfo = $this->maniaControl->client->getSystemInfo(); | 		$systemInfo = $this->maniaControl->getClient()->getSystemInfo(); | ||||||
| 		$message    = 'SystemInfo: ip=' . $systemInfo->publishedIp . ', port=' . $systemInfo->port . ', p2pPort=' . $systemInfo->p2PPort . ', title=' . $systemInfo->titleId . ', login=' . $systemInfo->serverLogin . '.'; | 		$message    = 'SystemInfo: ip=' . $systemInfo->publishedIp . ', port=' . $systemInfo->port . ', p2pPort=' . $systemInfo->p2PPort . ', title=' . $systemInfo->titleId . ', login=' . $systemInfo->serverLogin . '.'; | ||||||
| 		$this->maniaControl->chat->sendInformation($message, $player->login); | 		$this->maniaControl->getChat()->sendInformation($message, $player->login); | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	/** | 	/** | ||||||
| @@ -286,8 +286,8 @@ class Commands implements CallbackListener, CommandListener, ManialinkPageAnswer | |||||||
| 	 * @param Player $player | 	 * @param Player $player | ||||||
| 	 */ | 	 */ | ||||||
| 	public function commandShutdownServer(array $chat, Player $player) { | 	public function commandShutdownServer(array $chat, Player $player) { | ||||||
| 		if (!$this->maniaControl->authenticationManager->checkPermission($player, self::SETTING_PERMISSION_SHUTDOWN_SERVER)) { | 		if (!$this->maniaControl->getAuthenticationManager()->checkPermission($player, self::SETTING_PERMISSION_SHUTDOWN_SERVER)) { | ||||||
| 			$this->maniaControl->authenticationManager->sendNotAllowed($player); | 			$this->maniaControl->getAuthenticationManager()->sendNotAllowed($player); | ||||||
| 			return; | 			return; | ||||||
| 		} | 		} | ||||||
| 		// Check for delayed shutdown | 		// Check for delayed shutdown | ||||||
| @@ -297,22 +297,22 @@ class Commands implements CallbackListener, CommandListener, ManialinkPageAnswer | |||||||
| 			if (strtolower($param) === 'empty') { | 			if (strtolower($param) === 'empty') { | ||||||
| 				$this->serverShutdownEmpty = !$this->serverShutdownEmpty; | 				$this->serverShutdownEmpty = !$this->serverShutdownEmpty; | ||||||
| 				if ($this->serverShutdownEmpty) { | 				if ($this->serverShutdownEmpty) { | ||||||
| 					$this->maniaControl->chat->sendInformation("The server will shutdown as soon as it's empty!", $player->login); | 					$this->maniaControl->getChat()->sendInformation("The server will shutdown as soon as it's empty!", $player); | ||||||
| 					return; | 					return; | ||||||
| 				} | 				} | ||||||
| 				$this->maniaControl->chat->sendInformation("Empty-shutdown cancelled!", $player->login); | 				$this->maniaControl->getChat()->sendInformation("Empty-shutdown cancelled!", $player); | ||||||
| 				return; | 				return; | ||||||
| 			} | 			} | ||||||
| 			$delay = (int)$param; | 			$delay = (int)$param; | ||||||
| 			if ($delay <= 0) { | 			if ($delay <= 0) { | ||||||
| 				// Cancel shutdown | 				// Cancel shutdown | ||||||
| 				$this->serverShutdownTime = -1; | 				$this->serverShutdownTime = -1; | ||||||
| 				$this->maniaControl->chat->sendInformation("Delayed shutdown cancelled!", $player->login); | 				$this->maniaControl->getChat()->sendInformation("Delayed shutdown cancelled!", $player); | ||||||
| 				return; | 				return; | ||||||
| 			} | 			} | ||||||
| 			// Trigger delayed shutdown | 			// Trigger delayed shutdown | ||||||
| 			$this->serverShutdownTime = time() + $delay * 60.; | 			$this->serverShutdownTime = time() + $delay * 60.; | ||||||
| 			$this->maniaControl->chat->sendInformation("The server will shut down in {$delay} minutes!", $player->login); | 			$this->maniaControl->getChat()->sendInformation("The server will shut down in {$delay} minutes!", $player); | ||||||
| 			return; | 			return; | ||||||
| 		} | 		} | ||||||
| 		$this->shutdownServer($player->login); | 		$this->shutdownServer($player->login); | ||||||
| @@ -325,18 +325,18 @@ class Commands implements CallbackListener, CommandListener, ManialinkPageAnswer | |||||||
| 	 * @param Player $player | 	 * @param Player $player | ||||||
| 	 */ | 	 */ | ||||||
| 	public function commandSetServerName(array $chat, Player $player) { | 	public function commandSetServerName(array $chat, Player $player) { | ||||||
| 		if (!$this->maniaControl->authenticationManager->checkPermission($player, self::SETTING_PERMISSION_CHANGE_SERVERSETTINGS)) { | 		if (!$this->maniaControl->getAuthenticationManager()->checkPermission($player, self::SETTING_PERMISSION_CHANGE_SERVERSETTINGS)) { | ||||||
| 			$this->maniaControl->authenticationManager->sendNotAllowed($player); | 			$this->maniaControl->getAuthenticationManager()->sendNotAllowed($player); | ||||||
| 			return; | 			return; | ||||||
| 		} | 		} | ||||||
| 		$params = explode(' ', $chat[1][2], 2); | 		$params = explode(' ', $chat[1][2], 2); | ||||||
| 		if (count($params) < 2) { | 		if (count($params) < 2) { | ||||||
| 			$this->maniaControl->chat->sendUsageInfo('Usage example: //setservername ManiaPlanet Server', $player->login); | 			$this->maniaControl->getChat()->sendUsageInfo('Usage example: //setservername ManiaPlanet Server', $player); | ||||||
| 			return; | 			return; | ||||||
| 		} | 		} | ||||||
| 		$serverName = $params[1]; | 		$serverName = $params[1]; | ||||||
| 		$this->maniaControl->client->setServerName($serverName); | 		$this->maniaControl->getClient()->setServerName($serverName); | ||||||
| 		$this->maniaControl->chat->sendSuccess("Server name changed to: '{$serverName}'!", $player->login); | 		$this->maniaControl->getChat()->sendSuccess("Server name changed to: '{$serverName}'!", $player); | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	/** | 	/** | ||||||
| @@ -346,8 +346,8 @@ class Commands implements CallbackListener, CommandListener, ManialinkPageAnswer | |||||||
| 	 * @param Player $player | 	 * @param Player $player | ||||||
| 	 */ | 	 */ | ||||||
| 	public function commandSetPwd(array $chatCallback, Player $player) { | 	public function commandSetPwd(array $chatCallback, Player $player) { | ||||||
| 		if (!$this->maniaControl->authenticationManager->checkPermission($player, self::SETTING_PERMISSION_CHANGE_SERVERSETTINGS)) { | 		if (!$this->maniaControl->getAuthenticationManager()->checkPermission($player, self::SETTING_PERMISSION_CHANGE_SERVERSETTINGS)) { | ||||||
| 			$this->maniaControl->authenticationManager->sendNotAllowed($player); | 			$this->maniaControl->getAuthenticationManager()->sendNotAllowed($player); | ||||||
| 			return; | 			return; | ||||||
| 		} | 		} | ||||||
| 		$messageParts   = explode(' ', $chatCallback[1][2], 2); | 		$messageParts   = explode(' ', $chatCallback[1][2], 2); | ||||||
| @@ -357,8 +357,8 @@ class Commands implements CallbackListener, CommandListener, ManialinkPageAnswer | |||||||
| 			$password       = $messageParts[1]; | 			$password       = $messageParts[1]; | ||||||
| 			$successMessage = "Password changed to: '{$password}'!"; | 			$successMessage = "Password changed to: '{$password}'!"; | ||||||
| 		} | 		} | ||||||
| 		$this->maniaControl->client->setServerPassword($password); | 		$this->maniaControl->getClient()->setServerPassword($password); | ||||||
| 		$this->maniaControl->chat->sendSuccess($successMessage, $player->login); | 		$this->maniaControl->getChat()->sendSuccess($successMessage, $player); | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	/** | 	/** | ||||||
| @@ -368,8 +368,8 @@ class Commands implements CallbackListener, CommandListener, ManialinkPageAnswer | |||||||
| 	 * @param Player $player | 	 * @param Player $player | ||||||
| 	 */ | 	 */ | ||||||
| 	public function commandSetSpecPwd(array $chatCallback, Player $player) { | 	public function commandSetSpecPwd(array $chatCallback, Player $player) { | ||||||
| 		if (!$this->maniaControl->authenticationManager->checkPermission($player, self::SETTING_PERMISSION_CHANGE_SERVERSETTINGS)) { | 		if (!$this->maniaControl->getAuthenticationManager()->checkPermission($player, self::SETTING_PERMISSION_CHANGE_SERVERSETTINGS)) { | ||||||
| 			$this->maniaControl->authenticationManager->sendNotAllowed($player); | 			$this->maniaControl->getAuthenticationManager()->sendNotAllowed($player); | ||||||
| 			return; | 			return; | ||||||
| 		} | 		} | ||||||
| 		$messageParts   = explode(' ', $chatCallback[1][2], 2); | 		$messageParts   = explode(' ', $chatCallback[1][2], 2); | ||||||
| @@ -379,8 +379,8 @@ class Commands implements CallbackListener, CommandListener, ManialinkPageAnswer | |||||||
| 			$password       = $messageParts[1]; | 			$password       = $messageParts[1]; | ||||||
| 			$successMessage = "Spectator password changed to: '{$password}'!"; | 			$successMessage = "Spectator password changed to: '{$password}'!"; | ||||||
| 		} | 		} | ||||||
| 		$this->maniaControl->client->setServerPasswordForSpectator($password); | 		$this->maniaControl->getClient()->setServerPasswordForSpectator($password); | ||||||
| 		$this->maniaControl->chat->sendSuccess($successMessage, $player->login); | 		$this->maniaControl->getChat()->sendSuccess($successMessage, $player); | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	/** | 	/** | ||||||
| @@ -390,18 +390,18 @@ class Commands implements CallbackListener, CommandListener, ManialinkPageAnswer | |||||||
| 	 * @param Player $player | 	 * @param Player $player | ||||||
| 	 */ | 	 */ | ||||||
| 	public function commandSetMaxPlayers(array $chatCallback, Player $player) { | 	public function commandSetMaxPlayers(array $chatCallback, Player $player) { | ||||||
| 		if (!$this->maniaControl->authenticationManager->checkPermission($player, self::SETTING_PERMISSION_CHANGE_SERVERSETTINGS)) { | 		if (!$this->maniaControl->getAuthenticationManager()->checkPermission($player, self::SETTING_PERMISSION_CHANGE_SERVERSETTINGS)) { | ||||||
| 			$this->maniaControl->authenticationManager->sendNotAllowed($player); | 			$this->maniaControl->getAuthenticationManager()->sendNotAllowed($player); | ||||||
| 			return; | 			return; | ||||||
| 		} | 		} | ||||||
| 		$messageParts = explode(' ', $chatCallback[1][2], 2); | 		$messageParts = explode(' ', $chatCallback[1][2], 2); | ||||||
| 		if (!isset($messageParts[1])) { | 		if (!isset($messageParts[1])) { | ||||||
| 			$this->maniaControl->chat->sendUsageInfo('Usage example: //setmaxplayers 16', $player->login); | 			$this->maniaControl->getChat()->sendUsageInfo('Usage example: //setmaxplayers 16', $player); | ||||||
| 			return; | 			return; | ||||||
| 		} | 		} | ||||||
| 		$amount = $messageParts[1]; | 		$amount = $messageParts[1]; | ||||||
| 		if (!is_numeric($amount)) { | 		if (!is_numeric($amount)) { | ||||||
| 			$this->maniaControl->chat->sendUsageInfo('Usage example: //setmaxplayers 16', $player->login); | 			$this->maniaControl->getChat()->sendUsageInfo('Usage example: //setmaxplayers 16', $player); | ||||||
| 			return; | 			return; | ||||||
| 		} | 		} | ||||||
| 		$amount = (int)$amount; | 		$amount = (int)$amount; | ||||||
| @@ -409,8 +409,8 @@ class Commands implements CallbackListener, CommandListener, ManialinkPageAnswer | |||||||
| 			$amount = 0; | 			$amount = 0; | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
| 		$this->maniaControl->client->setMaxPlayers($amount); | 		$this->maniaControl->getClient()->setMaxPlayers($amount); | ||||||
| 		$this->maniaControl->chat->sendSuccess("Changed max players to: {$amount}", $player->login); | 		$this->maniaControl->getChat()->sendSuccess("Changed max players to: {$amount}", $player); | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	/** | 	/** | ||||||
| @@ -420,18 +420,18 @@ class Commands implements CallbackListener, CommandListener, ManialinkPageAnswer | |||||||
| 	 * @param Player $player | 	 * @param Player $player | ||||||
| 	 */ | 	 */ | ||||||
| 	public function commandSetMaxSpectators(array $chatCallback, Player $player) { | 	public function commandSetMaxSpectators(array $chatCallback, Player $player) { | ||||||
| 		if (!$this->maniaControl->authenticationManager->checkPermission($player, self::SETTING_PERMISSION_CHANGE_SERVERSETTINGS)) { | 		if (!$this->maniaControl->getAuthenticationManager()->checkPermission($player, self::SETTING_PERMISSION_CHANGE_SERVERSETTINGS)) { | ||||||
| 			$this->maniaControl->authenticationManager->sendNotAllowed($player); | 			$this->maniaControl->getAuthenticationManager()->sendNotAllowed($player); | ||||||
| 			return; | 			return; | ||||||
| 		} | 		} | ||||||
| 		$messageParts = explode(' ', $chatCallback[1][2], 2); | 		$messageParts = explode(' ', $chatCallback[1][2], 2); | ||||||
| 		if (!isset($messageParts[1])) { | 		if (!isset($messageParts[1])) { | ||||||
| 			$this->maniaControl->chat->sendUsageInfo('Usage example: //setmaxspectators 16', $player->login); | 			$this->maniaControl->getChat()->sendUsageInfo('Usage example: //setmaxspectators 16', $player); | ||||||
| 			return; | 			return; | ||||||
| 		} | 		} | ||||||
| 		$amount = $messageParts[1]; | 		$amount = $messageParts[1]; | ||||||
| 		if (!is_numeric($amount)) { | 		if (!is_numeric($amount)) { | ||||||
| 			$this->maniaControl->chat->sendUsageInfo('Usage example: //setmaxspectators 16', $player->login); | 			$this->maniaControl->getChat()->sendUsageInfo('Usage example: //setmaxspectators 16', $player); | ||||||
| 			return; | 			return; | ||||||
| 		} | 		} | ||||||
| 		$amount = (int)$amount; | 		$amount = (int)$amount; | ||||||
| @@ -439,7 +439,7 @@ class Commands implements CallbackListener, CommandListener, ManialinkPageAnswer | |||||||
| 			$amount = 0; | 			$amount = 0; | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
| 		$this->maniaControl->client->setMaxSpectators($amount); | 		$this->maniaControl->getClient()->setMaxSpectators($amount); | ||||||
| 		$this->maniaControl->chat->sendSuccess("Changed max spectators to: {$amount}", $player->login); | 		$this->maniaControl->getChat()->sendSuccess("Changed max spectators to: {$amount}", $player); | ||||||
| 	} | 	} | ||||||
| } | } | ||||||
|   | |||||||
| @@ -22,14 +22,15 @@ class Directory implements CallbackListener { | |||||||
| 	private $maniaControl = null; | 	private $maniaControl = null; | ||||||
|  |  | ||||||
| 	/** | 	/** | ||||||
| 	 * Create new server directory instance | 	 * Construct new server directory instance | ||||||
| 	 * | 	 * | ||||||
| 	 * @param ManiaControl $maniaControl | 	 * @param ManiaControl $maniaControl | ||||||
| 	 */ | 	 */ | ||||||
| 	public function __construct(ManiaControl $maniaControl) { | 	public function __construct(ManiaControl $maniaControl) { | ||||||
| 		$this->maniaControl = $maniaControl; | 		$this->maniaControl = $maniaControl; | ||||||
|  |  | ||||||
| 		$this->maniaControl->callbackManager->registerCallbackListener(CallbackManager::CB_MP_SERVERSTOP, $this, 'handleServerStopCallback'); | 		// Callbacks | ||||||
|  | 		$this->maniaControl->getCallbackManager()->registerCallbackListener(CallbackManager::CB_MP_SERVERSTOP, $this, 'handleServerStopCallback'); | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	/** | 	/** | ||||||
| @@ -38,7 +39,7 @@ class Directory implements CallbackListener { | |||||||
| 	 * @return string | 	 * @return string | ||||||
| 	 */ | 	 */ | ||||||
| 	public function getMapsFolder() { | 	public function getMapsFolder() { | ||||||
| 		return $this->maniaControl->client->getMapsDirectory(); | 		return $this->maniaControl->getClient()->getMapsDirectory(); | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	/** | 	/** | ||||||
| @@ -47,7 +48,7 @@ class Directory implements CallbackListener { | |||||||
| 	 * @return string | 	 * @return string | ||||||
| 	 */ | 	 */ | ||||||
| 	public function getSkinsFolder() { | 	public function getSkinsFolder() { | ||||||
| 		return $this->maniaControl->client->getSkinsDirectory(); | 		return $this->maniaControl->getClient()->getSkinsDirectory(); | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	/** | 	/** | ||||||
| @@ -82,7 +83,7 @@ class Directory implements CallbackListener { | |||||||
| 	 * @return string | 	 * @return string | ||||||
| 	 */ | 	 */ | ||||||
| 	public function getGameDataFolder() { | 	public function getGameDataFolder() { | ||||||
| 		return $this->maniaControl->client->gameDataDirectory(); | 		return $this->maniaControl->getClient()->gameDataDirectory(); | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	/** | 	/** | ||||||
|   | |||||||
| @@ -29,10 +29,10 @@ class RankingManager implements CallbackListener { | |||||||
| 	public function __construct(ManiaControl $maniaControl) { | 	public function __construct(ManiaControl $maniaControl) { | ||||||
| 		$this->maniaControl = $maniaControl; | 		$this->maniaControl = $maniaControl; | ||||||
|  |  | ||||||
| 		//Register Callbacks | 		// Callbacks | ||||||
| 		$this->maniaControl->callbackManager->registerCallbackListener(CallbackManager::CB_MP_MODESCRIPTCALLBACK, $this, 'handleCallbacks'); | 		$this->maniaControl->getCallbackManager()->registerCallbackListener(CallbackManager::CB_MP_MODESCRIPTCALLBACK, $this, 'handleCallbacks'); | ||||||
| 		$this->maniaControl->callbackManager->registerCallbackListener(CallbackManager::CB_MP_MODESCRIPTCALLBACKARRAY, $this, 'handleCallbacks'); | 		$this->maniaControl->getCallbackManager()->registerCallbackListener(CallbackManager::CB_MP_MODESCRIPTCALLBACKARRAY, $this, 'handleCallbacks'); | ||||||
| 		$this->maniaControl->callbackManager->registerCallbackListener(Callbacks::ONINIT, $this, 'onInit'); | 		$this->maniaControl->getCallbackManager()->registerCallbackListener(Callbacks::ONINIT, $this, 'onInit'); | ||||||
| 		//TODO won message at end of the map (disable as setting) (and public announce only all %50 (setting) players) | 		//TODO won message at end of the map (disable as setting) (and public announce only all %50 (setting) players) | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| @@ -41,7 +41,7 @@ class RankingManager implements CallbackListener { | |||||||
| 	 */ | 	 */ | ||||||
| 	public function onInit() { | 	public function onInit() { | ||||||
| 		try { | 		try { | ||||||
| 			$this->maniaControl->client->triggerModeScriptEvent('LibXmlRpc_GetRankings', ''); | 			$this->maniaControl->getClient()->triggerModeScriptEvent('LibXmlRpc_GetRankings', ''); | ||||||
| 		} catch (GameModeException $e) { | 		} catch (GameModeException $e) { | ||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
| @@ -90,7 +90,7 @@ class RankingManager implements CallbackListener { | |||||||
| 		array_multisort($this->rankings, SORT_DESC, SORT_NUMERIC); | 		array_multisort($this->rankings, SORT_DESC, SORT_NUMERIC); | ||||||
|  |  | ||||||
| 		//TODO if Local Records activated-> sort asc | 		//TODO if Local Records activated-> sort asc | ||||||
| 		$this->maniaControl->callbackManager->triggerCallback(Callbacks::RANKINGSUPDATED, $this->getRankings()); | 		$this->maniaControl->getCallbackManager()->triggerCallback(Callbacks::RANKINGSUPDATED, $this->getRankings()); | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	/** | 	/** | ||||||
|   | |||||||
| @@ -38,7 +38,7 @@ class ScriptManager { | |||||||
| 		if (!$this->isScriptMode()) { | 		if (!$this->isScriptMode()) { | ||||||
| 			return false; | 			return false; | ||||||
| 		} | 		} | ||||||
| 		$scriptSettings = $this->maniaControl->client->getModeScriptSettings(); | 		$scriptSettings = $this->maniaControl->getClient()->getModeScriptSettings(); | ||||||
|  |  | ||||||
| 		if (!array_key_exists('S_UseScriptCallbacks', $scriptSettings)) { | 		if (!array_key_exists('S_UseScriptCallbacks', $scriptSettings)) { | ||||||
| 			return false; | 			return false; | ||||||
| @@ -47,7 +47,7 @@ class ScriptManager { | |||||||
| 		$scriptSettings['S_UseScriptCallbacks'] = (bool)$enable; | 		$scriptSettings['S_UseScriptCallbacks'] = (bool)$enable; | ||||||
| 		$actionName                             = ($enable ? 'en' : 'dis'); | 		$actionName                             = ($enable ? 'en' : 'dis'); | ||||||
|  |  | ||||||
| 		$this->maniaControl->client->setModeScriptSettings($scriptSettings); | 		$this->maniaControl->getClient()->setModeScriptSettings($scriptSettings); | ||||||
| 		$this->maniaControl->log("Script Callbacks successfully {$actionName}abled!"); | 		$this->maniaControl->log("Script Callbacks successfully {$actionName}abled!"); | ||||||
| 		return true; | 		return true; | ||||||
| 	} | 	} | ||||||
| @@ -59,7 +59,7 @@ class ScriptManager { | |||||||
| 	 */ | 	 */ | ||||||
| 	public function isScriptMode() { | 	public function isScriptMode() { | ||||||
| 		if (is_null($this->isScriptMode)) { | 		if (is_null($this->isScriptMode)) { | ||||||
| 			$gameMode           = $this->maniaControl->client->getGameMode(); | 			$gameMode           = $this->maniaControl->getClient()->getGameMode(); | ||||||
| 			$this->isScriptMode = ($gameMode === 0); | 			$this->isScriptMode = ($gameMode === 0); | ||||||
| 		} | 		} | ||||||
| 		return $this->isScriptMode; | 		return $this->isScriptMode; | ||||||
|   | |||||||
| @@ -72,8 +72,8 @@ class Server implements CallbackListener { | |||||||
| 		$this->rankingManager = new RankingManager($maniaControl); | 		$this->rankingManager = new RankingManager($maniaControl); | ||||||
| 		$this->scriptManager  = new ScriptManager($maniaControl); | 		$this->scriptManager  = new ScriptManager($maniaControl); | ||||||
|  |  | ||||||
| 		// Register for callbacks | 		// Callbacks | ||||||
| 		$this->maniaControl->callbackManager->registerCallbackListener(Callbacks::ONINIT, $this, 'onInit'); | 		$this->maniaControl->getCallbackManager()->registerCallbackListener(Callbacks::ONINIT, $this, 'onInit'); | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	/** | 	/** | ||||||
| @@ -82,7 +82,7 @@ class Server implements CallbackListener { | |||||||
| 	 * @return bool | 	 * @return bool | ||||||
| 	 */ | 	 */ | ||||||
| 	private function initTables() { | 	private function initTables() { | ||||||
| 		$mysqli    = $this->maniaControl->database->mysqli; | 		$mysqli    = $this->maniaControl->getDatabase()->getMysqli(); | ||||||
| 		$query     = "CREATE TABLE IF NOT EXISTS `" . self::TABLE_SERVERS . "` ( | 		$query     = "CREATE TABLE IF NOT EXISTS `" . self::TABLE_SERVERS . "` ( | ||||||
| 				`index` int(11) NOT NULL AUTO_INCREMENT, | 				`index` int(11) NOT NULL AUTO_INCREMENT, | ||||||
| 				`login` varchar(100) NOT NULL, | 				`login` varchar(100) NOT NULL, | ||||||
| @@ -158,7 +158,9 @@ class Server implements CallbackListener { | |||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	/** | 	/** | ||||||
| 	 * Load the Server Configuration from the Config XML | 	 * Load the server configuration from the config XML | ||||||
|  | 	 * | ||||||
|  | 	 * @return Config | ||||||
| 	 */ | 	 */ | ||||||
| 	public function loadConfig() { | 	public function loadConfig() { | ||||||
| 		// Server id parameter | 		// Server id parameter | ||||||
| @@ -167,13 +169,13 @@ class Server implements CallbackListener { | |||||||
| 		// Server xml element with given id | 		// Server xml element with given id | ||||||
| 		$serverElement = null; | 		$serverElement = null; | ||||||
| 		if ($serverId) { | 		if ($serverId) { | ||||||
| 			$serverElements = $this->maniaControl->config->xpath("server[@id='{$serverId}']"); | 			$serverElements = $this->maniaControl->getConfig()->xpath("server[@id='{$serverId}']"); | ||||||
| 			if (!$serverElements) { | 			if (!$serverElements) { | ||||||
| 				$this->maniaControl->quit("No Server configured with the ID '{$serverId}'!", true); | 				$this->maniaControl->quit("No Server configured with the ID '{$serverId}'!", true); | ||||||
| 			} | 			} | ||||||
| 			$serverElement = $serverElements[0]; | 			$serverElement = $serverElements[0]; | ||||||
| 		} else { | 		} else { | ||||||
| 			$serverElements = $this->maniaControl->config->xpath('server'); | 			$serverElements = $this->maniaControl->getConfig()->xpath('server'); | ||||||
| 			if (!$serverElements) { | 			if (!$serverElements) { | ||||||
| 				$this->maniaControl->quit('Invalid server configuration (No Server configured).', true); | 				$this->maniaControl->quit('Invalid server configuration (No Server configured).', true); | ||||||
| 			} | 			} | ||||||
| @@ -196,6 +198,7 @@ class Server implements CallbackListener { | |||||||
| 			$this->maniaControl->quit("Your config file doesn't seem to be maintained properly. Please check the server configuration again! {$message}", true); | 			$this->maniaControl->quit("Your config file doesn't seem to be maintained properly. Please check the server configuration again! {$message}", true); | ||||||
| 		} | 		} | ||||||
| 		$this->config = $config; | 		$this->config = $config; | ||||||
|  | 		return $this->config; | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	/** | 	/** | ||||||
| @@ -204,8 +207,8 @@ class Server implements CallbackListener { | |||||||
| 	 * @return \stdClass[] | 	 * @return \stdClass[] | ||||||
| 	 */ | 	 */ | ||||||
| 	public function getAllServers() { | 	public function getAllServers() { | ||||||
| 		$mysqli = $this->maniaControl->database->mysqli; | 		$mysqli = $this->maniaControl->getDatabase()->getMysqli(); | ||||||
| 		$query  = "SELECT * FROM `" . self::TABLE_SERVERS . "`"; | 		$query  = "SELECT * FROM `" . self::TABLE_SERVERS . "`;"; | ||||||
| 		$result = $mysqli->query($query); | 		$result = $mysqli->query($query); | ||||||
| 		if (!$result) { | 		if (!$result) { | ||||||
| 			trigger_error($mysqli->error); | 			trigger_error($mysqli->error); | ||||||
| @@ -233,7 +236,7 @@ class Server implements CallbackListener { | |||||||
| 	 */ | 	 */ | ||||||
| 	private function updateProperties() { | 	private function updateProperties() { | ||||||
| 		// System info | 		// System info | ||||||
| 		$systemInfo    = $this->maniaControl->client->getSystemInfo(); | 		$systemInfo    = $this->maniaControl->getClient()->getSystemInfo(); | ||||||
| 		$this->ip      = $systemInfo->publishedIp; | 		$this->ip      = $systemInfo->publishedIp; | ||||||
| 		$this->port    = $systemInfo->port; | 		$this->port    = $systemInfo->port; | ||||||
| 		$this->p2pPort = $systemInfo->p2PPort; | 		$this->p2pPort = $systemInfo->p2PPort; | ||||||
| @@ -241,7 +244,7 @@ class Server implements CallbackListener { | |||||||
| 		$this->titleId = $systemInfo->titleId; | 		$this->titleId = $systemInfo->titleId; | ||||||
|  |  | ||||||
| 		// Database index | 		// Database index | ||||||
| 		$mysqli    = $this->maniaControl->database->mysqli; | 		$mysqli    = $this->maniaControl->getDatabase()->getMysqli(); | ||||||
| 		$query     = "INSERT INTO `" . self::TABLE_SERVERS . "` ( | 		$query     = "INSERT INTO `" . self::TABLE_SERVERS . "` ( | ||||||
| 				`login` | 				`login` | ||||||
| 				) VALUES ( | 				) VALUES ( | ||||||
| @@ -270,7 +273,7 @@ class Server implements CallbackListener { | |||||||
| 	 * @return \Maniaplanet\DedicatedServer\Structures\PlayerDetailedInfo | 	 * @return \Maniaplanet\DedicatedServer\Structures\PlayerDetailedInfo | ||||||
| 	 */ | 	 */ | ||||||
| 	public function getInfo() { | 	public function getInfo() { | ||||||
| 		return $this->maniaControl->client->getDetailedPlayerInfo($this->login); | 		return $this->maniaControl->getClient()->getDetailedPlayerInfo($this->login); | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	/** | 	/** | ||||||
| @@ -282,10 +285,10 @@ class Server implements CallbackListener { | |||||||
| 	public function getValidationReplay($login) { | 	public function getValidationReplay($login) { | ||||||
| 		$login = Player::parseLogin($login); | 		$login = Player::parseLogin($login); | ||||||
| 		try { | 		try { | ||||||
| 			$replay = $this->maniaControl->client->getValidationReplay($login); | 			$replay = $this->maniaControl->getClient()->getValidationReplay($login); | ||||||
| 		} catch (Exception $e) { | 		} catch (Exception $e) { | ||||||
| 			// TODO temp added 19.04.2014 | 			// TODO temp added 19.04.2014 | ||||||
| 			$this->maniaControl->errorHandler->triggerDebugNotice("Exception line 330 Server.php" . $e->getMessage()); | 			$this->maniaControl->getErrorHandler()->triggerDebugNotice("Exception line 330 Server.php" . $e->getMessage()); | ||||||
| 			trigger_error("Couldn't get validation replay of '{$login}'. " . $e->getMessage()); | 			trigger_error("Couldn't get validation replay of '{$login}'. " . $e->getMessage()); | ||||||
| 			return null; | 			return null; | ||||||
| 		} | 		} | ||||||
| @@ -306,17 +309,17 @@ class Server implements CallbackListener { | |||||||
|  |  | ||||||
| 		// Build file name | 		// Build file name | ||||||
| 		$login    = Player::parseLogin($login); | 		$login    = Player::parseLogin($login); | ||||||
| 		$map      = $this->maniaControl->mapManager->getCurrentMap(); | 		$map      = $this->maniaControl->getMapManager()->getCurrentMap(); | ||||||
| 		$gameMode = $this->getGameMode(); | 		$gameMode = $this->getGameMode(); | ||||||
| 		$time     = time(); | 		$time     = time(); | ||||||
| 		$fileName = "GhostReplays/Ghost.{$login}.{$gameMode}.{$time}.{$map->uid}.Replay.Gbx"; | 		$fileName = "GhostReplays/Ghost.{$login}.{$gameMode}.{$time}.{$map->uid}.Replay.Gbx"; | ||||||
|  |  | ||||||
| 		// Save ghost replay | 		// Save ghost replay | ||||||
| 		try { | 		try { | ||||||
| 			$this->maniaControl->client->saveBestGhostsReplay($login, $fileName); | 			$this->maniaControl->getClient()->saveBestGhostsReplay($login, $fileName); | ||||||
| 		} catch (Exception $e) { | 		} catch (Exception $e) { | ||||||
| 			// TODO temp added 19.04.2014 | 			// TODO temp added 19.04.2014 | ||||||
| 			$this->maniaControl->errorHandler->triggerDebugNotice("Exception line 360 Server.php" . $e->getMessage()); | 			$this->maniaControl->getErrorHandler()->triggerDebugNotice("Exception line 360 Server.php" . $e->getMessage()); | ||||||
|  |  | ||||||
| 			trigger_error("Couldn't save ghost replay. " . $e->getMessage()); | 			trigger_error("Couldn't save ghost replay. " . $e->getMessage()); | ||||||
| 			return null; | 			return null; | ||||||
| @@ -355,7 +358,7 @@ class Server implements CallbackListener { | |||||||
| 		if (is_int($parseValue)) { | 		if (is_int($parseValue)) { | ||||||
| 			$gameMode = $parseValue; | 			$gameMode = $parseValue; | ||||||
| 		} else { | 		} else { | ||||||
| 			$gameMode = $this->maniaControl->client->getGameMode(); | 			$gameMode = $this->maniaControl->getClient()->getGameMode(); | ||||||
| 		} | 		} | ||||||
| 		if ($stringValue) { | 		if ($stringValue) { | ||||||
| 			switch ($gameMode) { | 			switch ($gameMode) { | ||||||
| @@ -387,7 +390,7 @@ class Server implements CallbackListener { | |||||||
| 	 * @return bool | 	 * @return bool | ||||||
| 	 */ | 	 */ | ||||||
| 	public function waitForStatus($statusCode = 4) { | 	public function waitForStatus($statusCode = 4) { | ||||||
| 		$response = $this->maniaControl->client->getStatus(); | 		$response = $this->maniaControl->getClient()->getStatus(); | ||||||
| 		// Check if server has the given status | 		// Check if server has the given status | ||||||
| 		if ($response->code === 4) { | 		if ($response->code === 4) { | ||||||
| 			return true; | 			return true; | ||||||
| @@ -400,7 +403,7 @@ class Server implements CallbackListener { | |||||||
| 		$this->maniaControl->log("Current Status: {$lastStatus}"); | 		$this->maniaControl->log("Current Status: {$lastStatus}"); | ||||||
| 		while ($response->code !== 4) { | 		while ($response->code !== 4) { | ||||||
| 			sleep(1); | 			sleep(1); | ||||||
| 			$response = $this->maniaControl->client->getStatus(); | 			$response = $this->maniaControl->getClient()->getStatus(); | ||||||
| 			if ($lastStatus !== $response->name) { | 			if ($lastStatus !== $response->name) { | ||||||
| 				$this->maniaControl->log("New Status: {$response->name}"); | 				$this->maniaControl->log("New Status: {$response->name}"); | ||||||
| 				$lastStatus = $response->name; | 				$lastStatus = $response->name; | ||||||
| @@ -425,7 +428,7 @@ class Server implements CallbackListener { | |||||||
|  |  | ||||||
| 		// Trigger callback | 		// Trigger callback | ||||||
| 		if ($oldStatus !== $this->teamMode | $oldStatus === null) { | 		if ($oldStatus !== $this->teamMode | $oldStatus === null) { | ||||||
| 			$this->maniaControl->callbackManager->triggerCallback(self::CB_TEAM_MODE_CHANGED, $teamMode); | 			$this->maniaControl->getCallbackManager()->triggerCallback(self::CB_TEAM_MODE_CHANGED, $teamMode); | ||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| @@ -438,12 +441,21 @@ class Server implements CallbackListener { | |||||||
| 		return $this->teamMode; | 		return $this->teamMode; | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
|  | 	/** | ||||||
|  | 	 * Build the join link | ||||||
|  | 	 * | ||||||
|  | 	 * @return string | ||||||
|  | 	 */ | ||||||
|  | 	public function getJoinLink() { | ||||||
|  | 		return 'maniaplanet://#join=' . $this->login . '@' . $this->titleId; | ||||||
|  | 	} | ||||||
|  |  | ||||||
| 	/** | 	/** | ||||||
| 	 * Check if the Servers is empty | 	 * Check if the Servers is empty | ||||||
| 	 * | 	 * | ||||||
| 	 * @return bool | 	 * @return bool | ||||||
| 	 */ | 	 */ | ||||||
| 	public function isEmpty() { | 	public function isEmpty() { | ||||||
| 		return ($this->maniaControl->playerManager->getPlayerCount(false) === 0); | 		return ($this->maniaControl->getPlayerManager()->getPlayerCount(false) === 0); | ||||||
| 	} | 	} | ||||||
| } | } | ||||||
|   | |||||||
| @@ -59,11 +59,11 @@ class ServerOptionsMenu implements CallbackListener, ConfiguratorMenu, TimerList | |||||||
| 		$this->initTables(); | 		$this->initTables(); | ||||||
|  |  | ||||||
| 		// Callbacks | 		// Callbacks | ||||||
| 		$this->maniaControl->callbackManager->registerCallbackListener(Callbacks::ONINIT, $this, 'onInit'); | 		$this->maniaControl->getCallbackManager()->registerCallbackListener(Callbacks::ONINIT, $this, 'onInit'); | ||||||
| 		$this->maniaControl->timerManager->registerTimerListening($this, 'saveCurrentServerOptions', 6 * 3600 * 1000); | 		$this->maniaControl->getTimerManager()->registerTimerListening($this, 'saveCurrentServerOptions', 6 * 3600 * 1000); | ||||||
|  |  | ||||||
| 		// Permissions | 		// Permissions | ||||||
| 		$this->maniaControl->authenticationManager->definePermissionLevel(self::SETTING_PERMISSION_CHANGE_SERVER_OPTIONS, AuthenticationManager::AUTH_LEVEL_SUPERADMIN); | 		$this->maniaControl->getAuthenticationManager()->definePermissionLevel(self::SETTING_PERMISSION_CHANGE_SERVER_OPTIONS, AuthenticationManager::AUTH_LEVEL_SUPERADMIN); | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	/** | 	/** | ||||||
| @@ -72,7 +72,7 @@ class ServerOptionsMenu implements CallbackListener, ConfiguratorMenu, TimerList | |||||||
| 	 * @return bool | 	 * @return bool | ||||||
| 	 */ | 	 */ | ||||||
| 	private function initTables() { | 	private function initTables() { | ||||||
| 		$mysqli    = $this->maniaControl->database->mysqli; | 		$mysqli    = $this->maniaControl->getDatabase()->getMysqli(); | ||||||
| 		$query     = "CREATE TABLE IF NOT EXISTS `" . self::TABLE_SERVER_OPTIONS . "` ( | 		$query     = "CREATE TABLE IF NOT EXISTS `" . self::TABLE_SERVER_OPTIONS . "` ( | ||||||
| 				`index` int(11) NOT NULL AUTO_INCREMENT, | 				`index` int(11) NOT NULL AUTO_INCREMENT, | ||||||
| 				`serverIndex` int(11) NOT NULL, | 				`serverIndex` int(11) NOT NULL, | ||||||
| @@ -109,7 +109,7 @@ class ServerOptionsMenu implements CallbackListener, ConfiguratorMenu, TimerList | |||||||
| 	 * @return bool | 	 * @return bool | ||||||
| 	 */ | 	 */ | ||||||
| 	public function saveCurrentServerOptions() { | 	public function saveCurrentServerOptions() { | ||||||
| 		$serverOptions = $this->maniaControl->client->getServerOptions(); | 		$serverOptions = $this->maniaControl->getClient()->getServerOptions(); | ||||||
| 		return $this->saveServerOptions($serverOptions); | 		return $this->saveServerOptions($serverOptions); | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| @@ -121,7 +121,7 @@ class ServerOptionsMenu implements CallbackListener, ConfiguratorMenu, TimerList | |||||||
| 	 * @return bool | 	 * @return bool | ||||||
| 	 */ | 	 */ | ||||||
| 	private function saveServerOptions(ServerOptions $serverOptions, $triggerCallbacks = false) { | 	private function saveServerOptions(ServerOptions $serverOptions, $triggerCallbacks = false) { | ||||||
| 		$mysqli    = $this->maniaControl->database->mysqli; | 		$mysqli    = $this->maniaControl->getDatabase()->getMysqli(); | ||||||
| 		$query     = "INSERT INTO `" . self::TABLE_SERVER_OPTIONS . "` ( | 		$query     = "INSERT INTO `" . self::TABLE_SERVER_OPTIONS . "` ( | ||||||
| 				`serverIndex`, | 				`serverIndex`, | ||||||
| 				`optionName`, | 				`optionName`, | ||||||
| @@ -138,7 +138,7 @@ class ServerOptionsMenu implements CallbackListener, ConfiguratorMenu, TimerList | |||||||
|  |  | ||||||
| 		$optionName  = null; | 		$optionName  = null; | ||||||
| 		$optionValue = null; | 		$optionValue = null; | ||||||
| 		$statement->bind_param('iss', $this->maniaControl->server->index, $optionName, $optionValue); | 		$statement->bind_param('iss', $this->maniaControl->getServer()->index, $optionName, $optionValue); | ||||||
|  |  | ||||||
| 		$serverOptionsArray = $serverOptions->toArray(); | 		$serverOptionsArray = $serverOptions->toArray(); | ||||||
| 		foreach ($serverOptionsArray as $optionName => $optionValue) { | 		foreach ($serverOptionsArray as $optionName => $optionValue) { | ||||||
| @@ -154,7 +154,7 @@ class ServerOptionsMenu implements CallbackListener, ConfiguratorMenu, TimerList | |||||||
| 			} | 			} | ||||||
|  |  | ||||||
| 			if ($triggerCallbacks) { | 			if ($triggerCallbacks) { | ||||||
| 				$this->maniaControl->callbackManager->triggerCallback(self::CB_SERVER_OPTION_CHANGED, array(self::CB_SERVER_OPTION_CHANGED, $optionName, $optionValue)); | 				$this->maniaControl->getCallbackManager()->triggerCallback(self::CB_SERVER_OPTION_CHANGED, array(self::CB_SERVER_OPTION_CHANGED, $optionName, $optionValue)); | ||||||
| 			} | 			} | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
| @@ -175,16 +175,17 @@ class ServerOptionsMenu implements CallbackListener, ConfiguratorMenu, TimerList | |||||||
| 	 * @return bool | 	 * @return bool | ||||||
| 	 */ | 	 */ | ||||||
| 	public function loadOptionsFromDatabase() { | 	public function loadOptionsFromDatabase() { | ||||||
| 		$mysqli = $this->maniaControl->database->mysqli; | 		$mysqli = $this->maniaControl->getDatabase()->getMysqli(); | ||||||
|  | 		$serverIndex = $this->maniaControl->getServer()->index; | ||||||
| 		$query  = "SELECT * FROM `" . self::TABLE_SERVER_OPTIONS . "` | 		$query  = "SELECT * FROM `" . self::TABLE_SERVER_OPTIONS . "` | ||||||
| 				WHERE `serverIndex` = {$this->maniaControl->server->index};"; | 				WHERE `serverIndex` = {$serverIndex};"; | ||||||
| 		$result = $mysqli->query($query); | 		$result = $mysqli->query($query); | ||||||
| 		if ($mysqli->error) { | 		if ($mysqli->error) { | ||||||
| 			trigger_error($mysqli->error); | 			trigger_error($mysqli->error); | ||||||
| 			return false; | 			return false; | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
| 		$oldServerOptions = $this->maniaControl->client->getServerOptions(); | 		$oldServerOptions = $this->maniaControl->getClient()->getServerOptions(); | ||||||
| 		$newServerOptions = new ServerOptions(); | 		$newServerOptions = new ServerOptions(); | ||||||
|  |  | ||||||
| 		while ($row = $result->fetch_object()) { | 		while ($row = $result->fetch_object()) { | ||||||
| @@ -201,9 +202,9 @@ class ServerOptionsMenu implements CallbackListener, ConfiguratorMenu, TimerList | |||||||
|  |  | ||||||
| 		$loaded = false; | 		$loaded = false; | ||||||
| 		try { | 		try { | ||||||
| 			$loaded = $this->maniaControl->client->setServerOptions($newServerOptions); | 			$loaded = $this->maniaControl->getClient()->setServerOptions($newServerOptions); | ||||||
| 		} catch (ServerOptionsException $exception) { | 		} catch (ServerOptionsException $exception) { | ||||||
| 			$this->maniaControl->chat->sendExceptionToAdmins($exception); | 			$this->maniaControl->getChat()->sendExceptionToAdmins($exception); | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
| 		if ($loaded) { | 		if ($loaded) { | ||||||
| @@ -240,7 +241,7 @@ class ServerOptionsMenu implements CallbackListener, ConfiguratorMenu, TimerList | |||||||
| 		$script->addFeature($paging); | 		$script->addFeature($paging); | ||||||
| 		$frame = new Frame(); | 		$frame = new Frame(); | ||||||
|  |  | ||||||
| 		$serverOptions      = $this->maniaControl->client->getServerOptions(); | 		$serverOptions      = $this->maniaControl->getClient()->getServerOptions(); | ||||||
| 		$serverOptionsArray = $serverOptions->toArray(); | 		$serverOptionsArray = $serverOptions->toArray(); | ||||||
|  |  | ||||||
| 		// Config | 		// Config | ||||||
| @@ -343,8 +344,8 @@ class ServerOptionsMenu implements CallbackListener, ConfiguratorMenu, TimerList | |||||||
| 	 * @see \ManiaControl\Configurators\ConfiguratorMenu::saveConfigData() | 	 * @see \ManiaControl\Configurators\ConfiguratorMenu::saveConfigData() | ||||||
| 	 */ | 	 */ | ||||||
| 	public function saveConfigData(array $configData, Player $player) { | 	public function saveConfigData(array $configData, Player $player) { | ||||||
| 		if (!$this->maniaControl->authenticationManager->checkPermission($player, self::SETTING_PERMISSION_CHANGE_SERVER_OPTIONS)) { | 		if (!$this->maniaControl->getAuthenticationManager()->checkPermission($player, self::SETTING_PERMISSION_CHANGE_SERVER_OPTIONS)) { | ||||||
| 			$this->maniaControl->authenticationManager->sendNotAllowed($player); | 			$this->maniaControl->getAuthenticationManager()->sendNotAllowed($player); | ||||||
| 			return; | 			return; | ||||||
| 		} | 		} | ||||||
| 		if (!$configData[3] || strpos($configData[3][0]['Name'], self::ACTION_PREFIX_OPTION) !== 0) { | 		if (!$configData[3] || strpos($configData[3][0]['Name'], self::ACTION_PREFIX_OPTION) !== 0) { | ||||||
| @@ -353,7 +354,7 @@ class ServerOptionsMenu implements CallbackListener, ConfiguratorMenu, TimerList | |||||||
|  |  | ||||||
| 		$prefixLength = strlen(self::ACTION_PREFIX_OPTION); | 		$prefixLength = strlen(self::ACTION_PREFIX_OPTION); | ||||||
|  |  | ||||||
| 		$oldServerOptions = $this->maniaControl->client->getServerOptions(); | 		$oldServerOptions = $this->maniaControl->getClient()->getServerOptions(); | ||||||
| 		$newServerOptions = new ServerOptions(); | 		$newServerOptions = new ServerOptions(); | ||||||
|  |  | ||||||
| 		foreach ($configData[3] as $option) { | 		foreach ($configData[3] as $option) { | ||||||
| @@ -366,13 +367,13 @@ class ServerOptionsMenu implements CallbackListener, ConfiguratorMenu, TimerList | |||||||
|  |  | ||||||
| 		$success = $this->applyNewServerOptions($newServerOptions, $player); | 		$success = $this->applyNewServerOptions($newServerOptions, $player); | ||||||
| 		if ($success) { | 		if ($success) { | ||||||
| 			$this->maniaControl->chat->sendSuccess('Server Options saved!', $player); | 			$this->maniaControl->getChat()->sendSuccess('Server Options saved!', $player); | ||||||
| 		} else { | 		} else { | ||||||
| 			$this->maniaControl->chat->sendError('Server Options saving failed!', $player); | 			$this->maniaControl->getChat()->sendError('Server Options saving failed!', $player); | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
| 		// Reopen the Menu | 		// Reopen the Menu | ||||||
| 		$this->maniaControl->configurator->showMenu($player, $this); | 		$this->maniaControl->getConfigurator()->showMenu($player, $this); | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	/** | 	/** | ||||||
| @@ -384,15 +385,15 @@ class ServerOptionsMenu implements CallbackListener, ConfiguratorMenu, TimerList | |||||||
| 	 */ | 	 */ | ||||||
| 	private function applyNewServerOptions(ServerOptions $newServerOptions, Player $player) { | 	private function applyNewServerOptions(ServerOptions $newServerOptions, Player $player) { | ||||||
| 		try { | 		try { | ||||||
| 			$this->maniaControl->client->setServerOptions($newServerOptions); | 			$this->maniaControl->getClient()->setServerOptions($newServerOptions); | ||||||
| 		} catch (ServerOptionsException $exception) { | 		} catch (ServerOptionsException $exception) { | ||||||
| 			$this->maniaControl->chat->sendException($exception, $player); | 			$this->maniaControl->getChat()->sendException($exception, $player); | ||||||
| 			return false; | 			return false; | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
| 		$this->saveServerOptions($newServerOptions, true); | 		$this->saveServerOptions($newServerOptions, true); | ||||||
|  |  | ||||||
| 		$this->maniaControl->callbackManager->triggerCallback(self::CB_SERVER_OPTIONS_CHANGED, array(self::CB_SERVER_OPTIONS_CHANGED)); | 		$this->maniaControl->getCallbackManager()->triggerCallback(self::CB_SERVER_OPTIONS_CHANGED, array(self::CB_SERVER_OPTIONS_CHANGED)); | ||||||
|  |  | ||||||
| 		return true; | 		return true; | ||||||
| 	} | 	} | ||||||
|   | |||||||
| @@ -35,16 +35,16 @@ class UsageReporter implements TimerListener { | |||||||
| 	public function __construct(ManiaControl $maniaControl) { | 	public function __construct(ManiaControl $maniaControl) { | ||||||
| 		$this->maniaControl = $maniaControl; | 		$this->maniaControl = $maniaControl; | ||||||
|  |  | ||||||
| 		$this->maniaControl->settingManager->initSetting($this, self::SETTING_REPORT_USAGE, true); | 		$this->maniaControl->getSettingManager()->initSetting($this, self::SETTING_REPORT_USAGE, true); | ||||||
|  |  | ||||||
| 		$this->maniaControl->timerManager->registerTimerListening($this, 'reportUsage', 1000 * 60 * self::UPDATE_MINUTE_COUNT); | 		$this->maniaControl->getTimerManager()->registerTimerListening($this, 'reportUsage', 1000 * 60 * self::UPDATE_MINUTE_COUNT); | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	/** | 	/** | ||||||
| 	 * Report Usage of ManiaControl on the current Server | 	 * Report Usage of ManiaControl on the current Server | ||||||
| 	 */ | 	 */ | ||||||
| 	public function reportUsage() { | 	public function reportUsage() { | ||||||
| 		if (DEV_MODE || !$this->maniaControl->settingManager->getSettingValue($this, self::SETTING_REPORT_USAGE)) { | 		if (DEV_MODE || !$this->maniaControl->getSettingManager()->getSettingValue($this, self::SETTING_REPORT_USAGE)) { | ||||||
| 			return; | 			return; | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
| @@ -52,32 +52,32 @@ class UsageReporter implements TimerListener { | |||||||
| 		$properties['ManiaControlVersion'] = ManiaControl::VERSION; | 		$properties['ManiaControlVersion'] = ManiaControl::VERSION; | ||||||
| 		$properties['OperatingSystem']     = php_uname(); | 		$properties['OperatingSystem']     = php_uname(); | ||||||
| 		$properties['PHPVersion']          = phpversion(); | 		$properties['PHPVersion']          = phpversion(); | ||||||
| 		$properties['ServerLogin']         = $this->maniaControl->server->login; | 		$properties['ServerLogin']         = $this->maniaControl->getServer()->login; | ||||||
| 		$properties['TitleId']             = $this->maniaControl->server->titleId; | 		$properties['TitleId']             = $this->maniaControl->getServer()->titleId; | ||||||
| 		$properties['ServerName']          = Formatter::stripDirtyCodes($this->maniaControl->client->getServerName()); | 		$properties['ServerName']          = Formatter::stripDirtyCodes($this->maniaControl->getClient()->getServerName()); | ||||||
| 		$properties['UpdateChannel']       = $this->maniaControl->updateManager->getCurrentUpdateChannelSetting(); | 		$properties['UpdateChannel']       = $this->maniaControl->getUpdateManager()->getCurrentUpdateChannelSetting(); | ||||||
|  |  | ||||||
| 		$properties['PlayerCount']     = $this->maniaControl->playerManager->getPlayerCount(); | 		$properties['PlayerCount']     = $this->maniaControl->getPlayerManager()->getPlayerCount(); | ||||||
| 		$properties['MemoryUsage']     = memory_get_usage(); | 		$properties['MemoryUsage']     = memory_get_usage(); | ||||||
| 		$properties['MemoryPeakUsage'] = memory_get_peak_usage(); | 		$properties['MemoryPeakUsage'] = memory_get_peak_usage(); | ||||||
|  |  | ||||||
| 		$maxPlayers               = $this->maniaControl->client->getMaxPlayers(); | 		$maxPlayers               = $this->maniaControl->getClient()->getMaxPlayers(); | ||||||
| 		$properties['MaxPlayers'] = $maxPlayers['CurrentValue']; | 		$properties['MaxPlayers'] = $maxPlayers['CurrentValue']; | ||||||
|  |  | ||||||
| 		try { | 		try { | ||||||
| 			$scriptName               = $this->maniaControl->client->getScriptName(); | 			$scriptName               = $this->maniaControl->getClient()->getScriptName(); | ||||||
| 			$properties['ScriptName'] = $scriptName['CurrentValue']; | 			$properties['ScriptName'] = $scriptName['CurrentValue']; | ||||||
| 		} catch (GameModeException $e) { | 		} catch (GameModeException $e) { | ||||||
| 			$properties['ScriptName'] = ''; | 			$properties['ScriptName'] = ''; | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
| 		$properties['ActivePlugins'] = $this->maniaControl->pluginManager->getActivePluginsIds(); | 		$properties['ActivePlugins'] = $this->maniaControl->getPluginManager()->getActivePluginsIds(); | ||||||
|  |  | ||||||
| 		$json = json_encode($properties); | 		$json = json_encode($properties); | ||||||
| 		$info = base64_encode($json); | 		$info = base64_encode($json); | ||||||
|  |  | ||||||
| 		$url = ManiaControl::URL_WEBSERVICE . '/usagereport?info=' . urlencode($info); | 		$url = ManiaControl::URL_WEBSERVICE . '/usagereport?info=' . urlencode($info); | ||||||
| 		$this->maniaControl->fileReader->loadFile($url, function ($response, $error) { | 		$this->maniaControl->getFileReader()->loadFile($url, function ($response, $error) { | ||||||
| 			$response = json_decode($response); | 			$response = json_decode($response); | ||||||
| 			if ($error || !$response) { | 			if ($error || !$response) { | ||||||
| 				$this->maniaControl->log('Error while Sending data: ' . print_r($error, true)); | 				$this->maniaControl->log('Error while Sending data: ' . print_r($error, true)); | ||||||
|   | |||||||
| @@ -43,7 +43,7 @@ class VoteRatiosMenu implements CallbackListener, ConfiguratorMenu, TimerListene | |||||||
| 		$this->maniaControl = $maniaControl; | 		$this->maniaControl = $maniaControl; | ||||||
|  |  | ||||||
| 		// Permissions | 		// Permissions | ||||||
| 		$this->maniaControl->authenticationManager->definePermissionLevel(self::SETTING_PERMISSION_CHANGE_VOTE_RATIOS, AuthenticationManager::AUTH_LEVEL_ADMIN); | 		$this->maniaControl->getAuthenticationManager()->definePermissionLevel(self::SETTING_PERMISSION_CHANGE_VOTE_RATIOS, AuthenticationManager::AUTH_LEVEL_ADMIN); | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	/** | 	/** | ||||||
| @@ -63,7 +63,7 @@ class VoteRatiosMenu implements CallbackListener, ConfiguratorMenu, TimerListene | |||||||
| 		$index      = 0; | 		$index      = 0; | ||||||
|  |  | ||||||
| 		$voteRatioCommands = $this->getVoteCommands(); | 		$voteRatioCommands = $this->getVoteCommands(); | ||||||
| 		$voteRatios        = $this->maniaControl->client->getCallVoteRatios(); | 		$voteRatios        = $this->maniaControl->getClient()->getCallVoteRatios(); | ||||||
| 		foreach ($voteRatioCommands as $voteRatioCommand => $voteRatioDescription) { | 		foreach ($voteRatioCommands as $voteRatioCommand => $voteRatioDescription) { | ||||||
| 			$voteRatioFrame = new Frame(); | 			$voteRatioFrame = new Frame(); | ||||||
| 			$frame->add($voteRatioFrame); | 			$frame->add($voteRatioFrame); | ||||||
| @@ -130,8 +130,8 @@ class VoteRatiosMenu implements CallbackListener, ConfiguratorMenu, TimerListene | |||||||
| 	 * @see \ManiaControl\Configurators\ConfiguratorMenu::saveConfigData() | 	 * @see \ManiaControl\Configurators\ConfiguratorMenu::saveConfigData() | ||||||
| 	 */ | 	 */ | ||||||
| 	public function saveConfigData(array $configData, Player $player) { | 	public function saveConfigData(array $configData, Player $player) { | ||||||
| 		if (!$this->maniaControl->authenticationManager->checkPermission($player, self::SETTING_PERMISSION_CHANGE_VOTE_RATIOS)) { | 		if (!$this->maniaControl->getAuthenticationManager()->checkPermission($player, self::SETTING_PERMISSION_CHANGE_VOTE_RATIOS)) { | ||||||
| 			$this->maniaControl->authenticationManager->sendNotAllowed($player); | 			$this->maniaControl->getAuthenticationManager()->sendNotAllowed($player); | ||||||
| 			return; | 			return; | ||||||
| 		} | 		} | ||||||
| 		if (!$configData[3] || strpos($configData[3][0]['Name'], self::ACTION_PREFIX_VOTE_RATIO) !== 0) { | 		if (!$configData[3] || strpos($configData[3][0]['Name'], self::ACTION_PREFIX_VOTE_RATIO) !== 0) { | ||||||
| @@ -162,15 +162,15 @@ class VoteRatiosMenu implements CallbackListener, ConfiguratorMenu, TimerListene | |||||||
| 			array_push($newVoteRatios, $voteRatio); | 			array_push($newVoteRatios, $voteRatio); | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
| 		$success = $this->maniaControl->client->setCallVoteRatios($newVoteRatios); | 		$success = $this->maniaControl->getClient()->setCallVoteRatios($newVoteRatios); | ||||||
| 		if ($success) { | 		if ($success) { | ||||||
| 			$this->maniaControl->chat->sendSuccess('Vote Ratios saved!', $player); | 			$this->maniaControl->getChat()->sendSuccess('Vote Ratios saved!', $player); | ||||||
| 		} else { | 		} else { | ||||||
| 			$this->maniaControl->chat->sendError('Vote Ratios saving failed!', $player); | 			$this->maniaControl->getChat()->sendError('Vote Ratios saving failed!', $player); | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
| 		// Reopen the Menu | 		// Reopen the Menu | ||||||
| 		$this->maniaControl->configurator->showMenu($player, $this); | 		$this->maniaControl->getConfigurator()->showMenu($player, $this); | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	/** | 	/** | ||||||
| @@ -180,6 +180,6 @@ class VoteRatiosMenu implements CallbackListener, ConfiguratorMenu, TimerListene | |||||||
| 	 * @param string $commandName | 	 * @param string $commandName | ||||||
| 	 */ | 	 */ | ||||||
| 	private function sendInvalidValueError(Player $player, $commandName) { | 	private function sendInvalidValueError(Player $player, $commandName) { | ||||||
| 		$this->maniaControl->chat->sendError("Invalid Value given for '{$commandName}'!", $player); | 		$this->maniaControl->getChat()->sendError("Invalid Value given for '{$commandName}'!", $player); | ||||||
| 	} | 	} | ||||||
| } | } | ||||||
|   | |||||||
| @@ -40,7 +40,7 @@ class SettingManager implements CallbackListener { | |||||||
| 		$this->initTables(); | 		$this->initTables(); | ||||||
|  |  | ||||||
| 		// Callbacks | 		// Callbacks | ||||||
| 		$this->maniaControl->callbackManager->registerCallbackListener(Callbacks::AFTERINIT, $this, 'handleAfterInit'); | 		$this->maniaControl->getCallbackManager()->registerCallbackListener(Callbacks::AFTERINIT, $this, 'handleAfterInit'); | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	/** | 	/** | ||||||
| @@ -49,7 +49,7 @@ class SettingManager implements CallbackListener { | |||||||
| 	 * @return bool | 	 * @return bool | ||||||
| 	 */ | 	 */ | ||||||
| 	private function initTables() { | 	private function initTables() { | ||||||
| 		$mysqli            = $this->maniaControl->database->mysqli; | 		$mysqli            = $this->maniaControl->getDatabase()->getMysqli(); | ||||||
| 		$settingTableQuery = "CREATE TABLE IF NOT EXISTS `" . self::TABLE_SETTINGS . "` ( | 		$settingTableQuery = "CREATE TABLE IF NOT EXISTS `" . self::TABLE_SETTINGS . "` ( | ||||||
| 				`index` INT(11) NOT NULL AUTO_INCREMENT, | 				`index` INT(11) NOT NULL AUTO_INCREMENT, | ||||||
| 				`class` VARCHAR(100) NOT NULL, | 				`class` VARCHAR(100) NOT NULL, | ||||||
| @@ -82,7 +82,7 @@ class SettingManager implements CallbackListener { | |||||||
| 	 * @return bool | 	 * @return bool | ||||||
| 	 */ | 	 */ | ||||||
| 	private function deleteUnusedSettings() { | 	private function deleteUnusedSettings() { | ||||||
| 		$mysqli       = $this->maniaControl->database->mysqli; | 		$mysqli       = $this->maniaControl->getDatabase()->getMysqli(); | ||||||
| 		$settingQuery = "DELETE FROM `" . self::TABLE_SETTINGS . "` | 		$settingQuery = "DELETE FROM `" . self::TABLE_SETTINGS . "` | ||||||
| 				WHERE `changed` < NOW() - INTERVAL 1 HOUR;"; | 				WHERE `changed` < NOW() - INTERVAL 1 HOUR;"; | ||||||
| 		$result       = $mysqli->query($settingQuery); | 		$result       = $mysqli->query($settingQuery); | ||||||
| @@ -134,7 +134,7 @@ class SettingManager implements CallbackListener { | |||||||
| 	 * @return Setting | 	 * @return Setting | ||||||
| 	 */ | 	 */ | ||||||
| 	public function getSettingObjectByIndex($settingIndex) { | 	public function getSettingObjectByIndex($settingIndex) { | ||||||
| 		$mysqli       = $this->maniaControl->database->mysqli; | 		$mysqli       = $this->maniaControl->getDatabase()->getMysqli(); | ||||||
| 		$settingQuery = "SELECT * FROM `" . self::TABLE_SETTINGS . "` | 		$settingQuery = "SELECT * FROM `" . self::TABLE_SETTINGS . "` | ||||||
| 				WHERE `index` = {$settingIndex};"; | 				WHERE `index` = {$settingIndex};"; | ||||||
| 		$result       = $mysqli->query($settingQuery); | 		$result       = $mysqli->query($settingQuery); | ||||||
| @@ -213,7 +213,7 @@ class SettingManager implements CallbackListener { | |||||||
| 		} | 		} | ||||||
|  |  | ||||||
| 		// Fetch setting | 		// Fetch setting | ||||||
| 		$mysqli       = $this->maniaControl->database->mysqli; | 		$mysqli       = $this->maniaControl->getDatabase()->getMysqli(); | ||||||
| 		$settingQuery = "SELECT * FROM `" . self::TABLE_SETTINGS . "` | 		$settingQuery = "SELECT * FROM `" . self::TABLE_SETTINGS . "` | ||||||
| 				WHERE `class` = '" . $mysqli->escape_string($settingClass) . "' | 				WHERE `class` = '" . $mysqli->escape_string($settingClass) . "' | ||||||
| 				AND `setting` = '" . $mysqli->escape_string($settingName) . "';"; | 				AND `setting` = '" . $mysqli->escape_string($settingName) . "';"; | ||||||
| @@ -280,7 +280,7 @@ class SettingManager implements CallbackListener { | |||||||
| 	 * @return bool | 	 * @return bool | ||||||
| 	 */ | 	 */ | ||||||
| 	public function saveSetting(Setting $setting, $init = false) { | 	public function saveSetting(Setting $setting, $init = false) { | ||||||
| 		$mysqli = $this->maniaControl->database->mysqli; | 		$mysqli = $this->maniaControl->getDatabase()->getMysqli(); | ||||||
| 		if ($init) { | 		if ($init) { | ||||||
| 			// Init - Keep old value if the default didn't change | 			// Init - Keep old value if the default didn't change | ||||||
| 			$valueUpdateString = '`value` = IF(`default` = VALUES(`default`), `value`, VALUES(`default`))'; | 			$valueUpdateString = '`value` = IF(`default` = VALUES(`default`), `value`, VALUES(`default`))'; | ||||||
| @@ -323,7 +323,7 @@ class SettingManager implements CallbackListener { | |||||||
|  |  | ||||||
| 		// Trigger Settings Changed Callback | 		// Trigger Settings Changed Callback | ||||||
| 		if (!$init) { | 		if (!$init) { | ||||||
| 			$this->maniaControl->callbackManager->triggerCallback(self::CB_SETTING_CHANGED, $setting); | 			$this->maniaControl->getCallbackManager()->triggerCallback(self::CB_SETTING_CHANGED, $setting); | ||||||
| 		} | 		} | ||||||
| 		return true; | 		return true; | ||||||
| 	} | 	} | ||||||
| @@ -366,7 +366,7 @@ class SettingManager implements CallbackListener { | |||||||
| 		} else { | 		} else { | ||||||
| 			$className = ClassUtil::getClass($object); | 			$className = ClassUtil::getClass($object); | ||||||
| 		} | 		} | ||||||
| 		$mysqli       = $this->maniaControl->database->mysqli; | 		$mysqli       = $this->maniaControl->getDatabase()->getMysqli(); | ||||||
| 		$settingQuery = "UPDATE `" . self::TABLE_SETTINGS . "` | 		$settingQuery = "UPDATE `" . self::TABLE_SETTINGS . "` | ||||||
| 				SET `value` = `default` | 				SET `value` = `default` | ||||||
| 				WHERE `class` = '" . $mysqli->escape_string($className) . "' | 				WHERE `class` = '" . $mysqli->escape_string($className) . "' | ||||||
| @@ -397,7 +397,7 @@ class SettingManager implements CallbackListener { | |||||||
| 			$className = ClassUtil::getClass($object); | 			$className = ClassUtil::getClass($object); | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
| 		$mysqli       = $this->maniaControl->database->mysqli; | 		$mysqli       = $this->maniaControl->getDatabase()->getMysqli(); | ||||||
| 		$settingQuery = "DELETE FROM `" . self::TABLE_SETTINGS . "` | 		$settingQuery = "DELETE FROM `" . self::TABLE_SETTINGS . "` | ||||||
| 				WHERE `class` = '" . $mysqli->escape_string($className) . "' | 				WHERE `class` = '" . $mysqli->escape_string($className) . "' | ||||||
| 				AND `setting` = '" . $mysqli->escape_string($settingName) . "';"; | 				AND `setting` = '" . $mysqli->escape_string($settingName) . "';"; | ||||||
| @@ -422,7 +422,7 @@ class SettingManager implements CallbackListener { | |||||||
| 	 */ | 	 */ | ||||||
| 	public function getSettingsByClass($object) { | 	public function getSettingsByClass($object) { | ||||||
| 		$className = ClassUtil::getClass($object); | 		$className = ClassUtil::getClass($object); | ||||||
| 		$mysqli    = $this->maniaControl->database->mysqli; | 		$mysqli    = $this->maniaControl->getDatabase()->getMysqli(); | ||||||
| 		$query     = "SELECT * FROM `" . self::TABLE_SETTINGS . "` | 		$query     = "SELECT * FROM `" . self::TABLE_SETTINGS . "` | ||||||
| 				WHERE `class` = '" . $mysqli->escape_string($className) . "' | 				WHERE `class` = '" . $mysqli->escape_string($className) . "' | ||||||
| 				ORDER BY `setting` ASC;"; | 				ORDER BY `setting` ASC;"; | ||||||
| @@ -445,7 +445,7 @@ class SettingManager implements CallbackListener { | |||||||
| 	 * @return Setting[] | 	 * @return Setting[] | ||||||
| 	 */ | 	 */ | ||||||
| 	public function getSettings() { | 	public function getSettings() { | ||||||
| 		$mysqli = $this->maniaControl->database->mysqli; | 		$mysqli = $this->maniaControl->getDatabase()->getMysqli(); | ||||||
| 		$query  = "SELECT * FROM `" . self::TABLE_SETTINGS . "` | 		$query  = "SELECT * FROM `" . self::TABLE_SETTINGS . "` | ||||||
| 				ORDER BY `class` ASC, `setting` ASC;"; | 				ORDER BY `class` ASC, `setting` ASC;"; | ||||||
| 		$result = $mysqli->query($query); | 		$result = $mysqli->query($query); | ||||||
| @@ -468,7 +468,7 @@ class SettingManager implements CallbackListener { | |||||||
| 	 * @return string[] | 	 * @return string[] | ||||||
| 	 */ | 	 */ | ||||||
| 	public function getSettingClasses($hidePluginClasses = false) { | 	public function getSettingClasses($hidePluginClasses = false) { | ||||||
| 		$mysqli = $this->maniaControl->database->mysqli; | 		$mysqli = $this->maniaControl->getDatabase()->getMysqli(); | ||||||
| 		$query  = "SELECT DISTINCT `class` FROM `" . self::TABLE_SETTINGS . "` | 		$query  = "SELECT DISTINCT `class` FROM `" . self::TABLE_SETTINGS . "` | ||||||
| 				ORDER BY `class` ASC;"; | 				ORDER BY `class` ASC;"; | ||||||
| 		$result = $mysqli->query($query); | 		$result = $mysqli->query($query); | ||||||
|   | |||||||
| @@ -44,31 +44,31 @@ class SimpleStatsList implements ManialinkPageAnswerListener, CallbackListener, | |||||||
| 	private $statsWidth = 0; | 	private $statsWidth = 0; | ||||||
|  |  | ||||||
| 	/** | 	/** | ||||||
| 	 * Create a PlayerList Instance | 	 * Construct a new simple stats list instance | ||||||
| 	 * | 	 * | ||||||
| 	 * @param ManiaControl $maniaControl | 	 * @param ManiaControl $maniaControl | ||||||
| 	 */ | 	 */ | ||||||
| 	public function __construct(ManiaControl $maniaControl) { | 	public function __construct(ManiaControl $maniaControl) { | ||||||
| 		$this->maniaControl = $maniaControl; | 		$this->maniaControl = $maniaControl; | ||||||
|  |  | ||||||
| 		$this->maniaControl->callbackManager->registerCallbackListener(CallbackManager::CB_MP_PLAYERMANIALINKPAGEANSWER, $this, 'handleManialinkPageAnswer'); | 		// Callbacks | ||||||
| 		$this->maniaControl->callbackManager->registerCallbackListener(Callbacks::ONINIT, $this, 'handleOnInit'); | 		$this->maniaControl->getCallbackManager()->registerCallbackListener(CallbackManager::CB_MP_PLAYERMANIALINKPAGEANSWER, $this, 'handleManialinkPageAnswer'); | ||||||
|  | 		$this->maniaControl->getCallbackManager()->registerCallbackListener(Callbacks::ONINIT, $this, 'handleOnInit'); | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	/** | 	/** | ||||||
| 	 * Add the menu entry | 	 * Add the menu entry | ||||||
| 	 */ | 	 */ | ||||||
| 	public function handleOnInit() { | 	public function handleOnInit() { | ||||||
| 		$this->maniaControl->commandManager->registerCommandListener('stats', $this, 'command_ShowStatsList', false, 'Shows statistics.'); | 		$this->maniaControl->getCommandManager()->registerCommandListener('stats', $this, 'command_ShowStatsList', false, 'Shows statistics.'); | ||||||
|  |  | ||||||
| 		// Action Open StatsList | 		// Action Open StatsList | ||||||
| 		$this->maniaControl->manialinkManager->registerManialinkPageAnswerListener(self::ACTION_OPEN_STATSLIST, $this, 'command_ShowStatsList'); | 		$this->maniaControl->getManialinkManager()->registerManialinkPageAnswerListener(self::ACTION_OPEN_STATSLIST, $this, 'command_ShowStatsList'); | ||||||
|  |  | ||||||
|  |  | ||||||
| 		$itemQuad = new Quad_UIConstruction_Buttons(); | 		$itemQuad = new Quad_UIConstruction_Buttons(); | ||||||
| 		$itemQuad->setSubStyle($itemQuad::SUBSTYLE_Stats); | 		$itemQuad->setSubStyle($itemQuad::SUBSTYLE_Stats); | ||||||
| 		$itemQuad->setAction(self::ACTION_OPEN_STATSLIST); | 		$itemQuad->setAction(self::ACTION_OPEN_STATSLIST); | ||||||
| 		$this->maniaControl->actionsMenu->addMenuItem($itemQuad, true, 14, 'Open Statistics'); | 		$this->maniaControl->getActionsMenu()->addMenuItem($itemQuad, true, 14, 'Open Statistics'); | ||||||
|  |  | ||||||
| 		//TODO settings if a stat get shown | 		//TODO settings if a stat get shown | ||||||
| 		$this->registerStat(PlayerManager::STAT_SERVERTIME, 10, "ST", 20, StatisticManager::STAT_TYPE_TIME); | 		$this->registerStat(PlayerManager::STAT_SERVERTIME, 10, "ST", 20, StatisticManager::STAT_TYPE_TIME); | ||||||
| @@ -119,9 +119,9 @@ class SimpleStatsList implements ManialinkPageAnswerListener, CallbackListener, | |||||||
| 	 * @param string $order | 	 * @param string $order | ||||||
| 	 */ | 	 */ | ||||||
| 	public function showStatsList(Player $player, $order = PlayerManager::STAT_SERVERTIME) { | 	public function showStatsList(Player $player, $order = PlayerManager::STAT_SERVERTIME) { | ||||||
| 		$height       = $this->maniaControl->manialinkManager->getStyleManager()->getListWidgetsHeight(); | 		$height       = $this->maniaControl->getManialinkManager()->getStyleManager()->getListWidgetsHeight(); | ||||||
| 		$quadStyle    = $this->maniaControl->manialinkManager->getStyleManager()->getDefaultMainWindowStyle(); | 		$quadStyle    = $this->maniaControl->getManialinkManager()->getStyleManager()->getDefaultMainWindowStyle(); | ||||||
| 		$quadSubstyle = $this->maniaControl->manialinkManager->getStyleManager()->getDefaultMainWindowSubStyle(); | 		$quadSubstyle = $this->maniaControl->getManialinkManager()->getStyleManager()->getDefaultMainWindowSubStyle(); | ||||||
|  |  | ||||||
|  |  | ||||||
| 		$maniaLink = new ManiaLink(ManialinkManager::MAIN_MLID); | 		$maniaLink = new ManiaLink(ManialinkManager::MAIN_MLID); | ||||||
| @@ -174,7 +174,7 @@ class SimpleStatsList implements ManialinkPageAnswerListener, CallbackListener, | |||||||
| 		$posX         = $xStart + 55; | 		$posX         = $xStart + 55; | ||||||
| 		$statRankings = array(); | 		$statRankings = array(); | ||||||
| 		foreach ($this->statArray as $key => $stat) { | 		foreach ($this->statArray as $key => $stat) { | ||||||
| 			$ranking = $this->maniaControl->statisticManager->getStatsRanking($stat["Name"]); | 			$ranking = $this->maniaControl->getStatisticManager()->getStatsRanking($stat["Name"]); | ||||||
| 			if (!empty($ranking)) { | 			if (!empty($ranking)) { | ||||||
| 				$statRankings[$stat["Name"]]  = $ranking; | 				$statRankings[$stat["Name"]]  = $ranking; | ||||||
| 				$array[$stat['HeadShortCut']] = $posX; | 				$array[$stat['HeadShortCut']] = $posX; | ||||||
| @@ -184,7 +184,7 @@ class SimpleStatsList implements ManialinkPageAnswerListener, CallbackListener, | |||||||
| 			} | 			} | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
| 		$labels = $this->maniaControl->manialinkManager->labelLine($headFrame, $array); | 		$labels = $this->maniaControl->getManialinkManager()->labelLine($headFrame, $array); | ||||||
|  |  | ||||||
| 		// Description Label | 		// Description Label | ||||||
| 		$index = 2; | 		$index = 2; | ||||||
| @@ -212,7 +212,7 @@ class SimpleStatsList implements ManialinkPageAnswerListener, CallbackListener, | |||||||
| 		} | 		} | ||||||
|  |  | ||||||
| 		foreach ($statRankings[$order] as $playerId => $value) { | 		foreach ($statRankings[$order] as $playerId => $value) { | ||||||
| 			$listPlayer = $this->maniaControl->playerManager->getPlayerByIndex($playerId); | 			$listPlayer = $this->maniaControl->getPlayerManager()->getPlayerByIndex($playerId); | ||||||
| 			if (!$listPlayer) { | 			if (!$listPlayer) { | ||||||
| 				continue; | 				continue; | ||||||
| 			} | 			} | ||||||
| @@ -249,7 +249,7 @@ class SimpleStatsList implements ManialinkPageAnswerListener, CallbackListener, | |||||||
| 			} | 			} | ||||||
|  |  | ||||||
| 			$array = array($index => $xStart + 5, $listPlayer->nickname => $xStart + 14); | 			$array = array($index => $xStart + 5, $listPlayer->nickname => $xStart + 14); | ||||||
| 			$this->maniaControl->manialinkManager->labelLine($playerFrame, $array); | 			$this->maniaControl->getManialinkManager()->labelLine($playerFrame, $array); | ||||||
|  |  | ||||||
| 			$posX = $xStart + 55; | 			$posX = $xStart + 55; | ||||||
| 			foreach ($displayArray as $key => $array) { | 			foreach ($displayArray as $key => $array) { | ||||||
| @@ -279,7 +279,7 @@ class SimpleStatsList implements ManialinkPageAnswerListener, CallbackListener, | |||||||
| 			$posY -= 4; | 			$posY -= 4; | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
| 		$this->maniaControl->manialinkManager->displayWidget($maniaLink, $player, 'SimpleStatsList'); | 		$this->maniaControl->getManialinkManager()->displayWidget($maniaLink, $player, 'SimpleStatsList'); | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	/** | 	/** | ||||||
| @@ -299,7 +299,7 @@ class SimpleStatsList implements ManialinkPageAnswerListener, CallbackListener, | |||||||
| 		switch ($action) { | 		switch ($action) { | ||||||
| 			case self::ACTION_SORT_STATS: | 			case self::ACTION_SORT_STATS: | ||||||
| 				$playerLogin = $callback[1][1]; | 				$playerLogin = $callback[1][1]; | ||||||
| 				$player      = $this->maniaControl->playerManager->getPlayer($playerLogin); | 				$player      = $this->maniaControl->getPlayerManager()->getPlayer($playerLogin); | ||||||
| 				$this->showStatsList($player, $actionArray[2]); | 				$this->showStatsList($player, $actionArray[2]); | ||||||
| 				break; | 				break; | ||||||
| 		} | 		} | ||||||
|   | |||||||
| @@ -60,48 +60,48 @@ class StatisticCollector implements CallbackListener { | |||||||
| 	private $onShootArray = array(); | 	private $onShootArray = array(); | ||||||
|  |  | ||||||
| 	/** | 	/** | ||||||
| 	 * Construct player manager | 	 * Construct a new statistic collector instance | ||||||
| 	 * | 	 * | ||||||
| 	 * @param \ManiaControl\ManiaControl $maniaControl | 	 * @param ManiaControl $maniaControl | ||||||
| 	 */ | 	 */ | ||||||
| 	public function __construct(ManiaControl $maniaControl) { | 	public function __construct(ManiaControl $maniaControl) { | ||||||
| 		$this->maniaControl = $maniaControl; | 		$this->maniaControl = $maniaControl; | ||||||
|  |  | ||||||
| 		//Register Callbacks | 		// Callbacks | ||||||
| 		$this->maniaControl->callbackManager->registerCallbackListener(CallbackManager::CB_MP_MODESCRIPTCALLBACK, $this, 'handleCallbacks'); | 		$this->maniaControl->getCallbackManager()->registerCallbackListener(CallbackManager::CB_MP_MODESCRIPTCALLBACK, $this, 'handleCallbacks'); | ||||||
| 		$this->maniaControl->callbackManager->registerCallbackListener(CallbackManager::CB_MP_MODESCRIPTCALLBACKARRAY, $this, 'handleCallbacks'); | 		$this->maniaControl->getCallbackManager()->registerCallbackListener(CallbackManager::CB_MP_MODESCRIPTCALLBACKARRAY, $this, 'handleCallbacks'); | ||||||
| 		$this->maniaControl->callbackManager->registerCallbackListener(Callbacks::ONINIT, $this, 'onInit'); | 		$this->maniaControl->getCallbackManager()->registerCallbackListener(Callbacks::ONINIT, $this, 'onInit'); | ||||||
| 		$this->maniaControl->callbackManager->registerCallbackListener(PlayerManager::CB_PLAYERDISCONNECT, $this, 'onPlayerDisconnect'); | 		$this->maniaControl->getCallbackManager()->registerCallbackListener(PlayerManager::CB_PLAYERDISCONNECT, $this, 'onPlayerDisconnect'); | ||||||
|  |  | ||||||
| 		//Initialize Settings | 		// Settings | ||||||
| 		$this->maniaControl->settingManager->initSetting($this, self::SETTING_COLLECT_STATS_ENABLED, true); | 		$this->maniaControl->getSettingManager()->initSetting($this, self::SETTING_COLLECT_STATS_ENABLED, true); | ||||||
| 		$this->maniaControl->settingManager->initSetting($this, self::SETTING_COLLECT_STATS_MINPLAYERS, 4); | 		$this->maniaControl->getSettingManager()->initSetting($this, self::SETTING_COLLECT_STATS_MINPLAYERS, 4); | ||||||
| 		$this->maniaControl->settingManager->initSetting($this, self::SETTING_ON_SHOOT_PRESTORE, 10); | 		$this->maniaControl->getSettingManager()->initSetting($this, self::SETTING_ON_SHOOT_PRESTORE, 10); | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	/** | 	/** | ||||||
| 	 * Handle ManiaControl OnInit Callback | 	 * Handle ManiaControl OnInit Callback | ||||||
| 	 */ | 	 */ | ||||||
| 	public function onInit() { | 	public function onInit() { | ||||||
| 		//Define Stats MetaData | 		// Define Stats MetaData | ||||||
| 		$this->maniaControl->statisticManager->defineStatMetaData(self::STAT_PLAYTIME, StatisticManager::STAT_TYPE_TIME); | 		$this->maniaControl->getStatisticManager()->defineStatMetaData(self::STAT_PLAYTIME, StatisticManager::STAT_TYPE_TIME); | ||||||
| 		$this->maniaControl->statisticManager->defineStatMetaData(self::STAT_MAP_WINS); | 		$this->maniaControl->getStatisticManager()->defineStatMetaData(self::STAT_MAP_WINS); | ||||||
| 		$this->maniaControl->statisticManager->defineStatMetaData(self::STAT_ON_SHOOT); | 		$this->maniaControl->getStatisticManager()->defineStatMetaData(self::STAT_ON_SHOOT); | ||||||
| 		$this->maniaControl->statisticManager->defineStatMetaData(self::STAT_ON_NEARMISS); | 		$this->maniaControl->getStatisticManager()->defineStatMetaData(self::STAT_ON_NEARMISS); | ||||||
| 		$this->maniaControl->statisticManager->defineStatMetaData(self::STAT_ON_CAPTURE); | 		$this->maniaControl->getStatisticManager()->defineStatMetaData(self::STAT_ON_CAPTURE); | ||||||
| 		$this->maniaControl->statisticManager->defineStatMetaData(self::STAT_ON_HIT); | 		$this->maniaControl->getStatisticManager()->defineStatMetaData(self::STAT_ON_HIT); | ||||||
| 		$this->maniaControl->statisticManager->defineStatMetaData(self::STAT_ON_GOT_HIT); | 		$this->maniaControl->getStatisticManager()->defineStatMetaData(self::STAT_ON_GOT_HIT); | ||||||
| 		$this->maniaControl->statisticManager->defineStatMetaData(self::STAT_ON_DEATH); | 		$this->maniaControl->getStatisticManager()->defineStatMetaData(self::STAT_ON_DEATH); | ||||||
| 		$this->maniaControl->statisticManager->defineStatMetaData(self::STAT_ON_PLAYER_REQUEST_RESPAWN); | 		$this->maniaControl->getStatisticManager()->defineStatMetaData(self::STAT_ON_PLAYER_REQUEST_RESPAWN); | ||||||
| 		$this->maniaControl->statisticManager->defineStatMetaData(self::STAT_ON_KILL); | 		$this->maniaControl->getStatisticManager()->defineStatMetaData(self::STAT_ON_KILL); | ||||||
| 		$this->maniaControl->statisticManager->defineStatMetaData(self::STAT_LASER_HIT); | 		$this->maniaControl->getStatisticManager()->defineStatMetaData(self::STAT_LASER_HIT); | ||||||
| 		$this->maniaControl->statisticManager->defineStatMetaData(self::STAT_LASER_SHOT); | 		$this->maniaControl->getStatisticManager()->defineStatMetaData(self::STAT_LASER_SHOT); | ||||||
| 		$this->maniaControl->statisticManager->defineStatMetaData(self::STAT_NUCLEUS_HIT); | 		$this->maniaControl->getStatisticManager()->defineStatMetaData(self::STAT_NUCLEUS_HIT); | ||||||
| 		$this->maniaControl->statisticManager->defineStatMetaData(self::STAT_NUCLEUS_SHOT); | 		$this->maniaControl->getStatisticManager()->defineStatMetaData(self::STAT_NUCLEUS_SHOT); | ||||||
| 		$this->maniaControl->statisticManager->defineStatMetaData(self::STAT_ROCKET_HIT); | 		$this->maniaControl->getStatisticManager()->defineStatMetaData(self::STAT_ROCKET_HIT); | ||||||
| 		$this->maniaControl->statisticManager->defineStatMetaData(self::STAT_ROCKET_SHOT); | 		$this->maniaControl->getStatisticManager()->defineStatMetaData(self::STAT_ROCKET_SHOT); | ||||||
| 		$this->maniaControl->statisticManager->defineStatMetaData(self::STAT_ARROW_HIT); | 		$this->maniaControl->getStatisticManager()->defineStatMetaData(self::STAT_ARROW_HIT); | ||||||
| 		$this->maniaControl->statisticManager->defineStatMetaData(self::STAT_ARROW_SHOT); | 		$this->maniaControl->getStatisticManager()->defineStatMetaData(self::STAT_ARROW_SHOT); | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	/** | 	/** | ||||||
| @@ -111,15 +111,15 @@ class StatisticCollector implements CallbackListener { | |||||||
| 	 */ | 	 */ | ||||||
| 	public function onEndMap(array $callback) { | 	public function onEndMap(array $callback) { | ||||||
| 		//Check for Minimum PlayerCount | 		//Check for Minimum PlayerCount | ||||||
| 		if ($this->maniaControl->playerManager->getPlayerCount() < $this->maniaControl->settingManager->getSettingValue($this, self::SETTING_COLLECT_STATS_MINPLAYERS)) { | 		if ($this->maniaControl->getPlayerManager()->getPlayerCount() < $this->maniaControl->getSettingManager()->getSettingValue($this, self::SETTING_COLLECT_STATS_MINPLAYERS)) { | ||||||
| 			return; | 			return; | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
| 		$leaders = $this->maniaControl->server->getRankingManager()->getLeaders(); | 		$leaders = $this->maniaControl->getServer()->getRankingManager()->getLeaders(); | ||||||
|  |  | ||||||
| 		foreach ($leaders as $leaderLogin) { | 		foreach ($leaders as $leaderLogin) { | ||||||
| 			$leader = $this->maniaControl->playerManager->getPlayer($leaderLogin); | 			$leader = $this->maniaControl->getPlayerManager()->getPlayer($leaderLogin); | ||||||
| 			$this->maniaControl->statisticManager->incrementStat(self::STAT_MAP_WINS, $leader); | 			$this->maniaControl->getStatisticManager()->incrementStat(self::STAT_MAP_WINS, $leader); | ||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| @@ -130,14 +130,14 @@ class StatisticCollector implements CallbackListener { | |||||||
| 	 */ | 	 */ | ||||||
| 	public function onPlayerDisconnect(Player $player) { | 	public function onPlayerDisconnect(Player $player) { | ||||||
| 		// Check if Stat Collecting is enabled | 		// Check if Stat Collecting is enabled | ||||||
| 		if (!$this->maniaControl->settingManager->getSettingValue($this, self::SETTING_COLLECT_STATS_ENABLED)) { | 		if (!$this->maniaControl->getSettingManager()->getSettingValue($this, self::SETTING_COLLECT_STATS_ENABLED)) { | ||||||
| 			return; | 			return; | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
| 		// Insert Data into Database, and destroy player | 		// Insert Data into Database, and destroy player | ||||||
| 		if (isset($this->onShootArray[$player->login])) { | 		if (isset($this->onShootArray[$player->login])) { | ||||||
| 			if ($this->onShootArray[$player->login] > 0) { | 			if ($this->onShootArray[$player->login] > 0) { | ||||||
| 				$this->maniaControl->statisticManager->insertStat(self::STAT_ON_SHOOT, $player, $this->maniaControl->server->index, $this->onShootArray[$player->login]); | 				$this->maniaControl->getStatisticManager()->insertStat(self::STAT_ON_SHOOT, $player, $this->maniaControl->getServer()->index, $this->onShootArray[$player->login]); | ||||||
| 			} | 			} | ||||||
| 			unset($this->onShootArray[$player->login]); | 			unset($this->onShootArray[$player->login]); | ||||||
| 		} | 		} | ||||||
| @@ -151,12 +151,12 @@ class StatisticCollector implements CallbackListener { | |||||||
| 	public function handleCallbacks(array $callback) { | 	public function handleCallbacks(array $callback) { | ||||||
| 		//TODO survivals | 		//TODO survivals | ||||||
| 		// Check if Stat Collecting is enabled | 		// Check if Stat Collecting is enabled | ||||||
| 		if (!$this->maniaControl->settingManager->getSettingValue($this, self::SETTING_COLLECT_STATS_ENABLED)) { | 		if (!$this->maniaControl->getSettingManager()->getSettingValue($this, self::SETTING_COLLECT_STATS_ENABLED)) { | ||||||
| 			return; | 			return; | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
| 		// Check for Minimum PlayerCount | 		// Check for Minimum PlayerCount | ||||||
| 		if ($this->maniaControl->playerManager->getPlayerCount() < $this->maniaControl->settingManager->getSettingValue($this, self::SETTING_COLLECT_STATS_MINPLAYERS)) { | 		if ($this->maniaControl->getPlayerManager()->getPlayerCount() < $this->maniaControl->getSettingManager()->getSettingValue($this, self::SETTING_COLLECT_STATS_MINPLAYERS)) { | ||||||
| 			return; | 			return; | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
| @@ -167,47 +167,47 @@ class StatisticCollector implements CallbackListener { | |||||||
| 				$this->handleOnShoot($callback[1][1][0], $callback[1][1][1]); | 				$this->handleOnShoot($callback[1][1][0], $callback[1][1][1]); | ||||||
| 				break; | 				break; | ||||||
| 			case 'LibXmlRpc_OnHit': | 			case 'LibXmlRpc_OnHit': | ||||||
| 				$shooter = $this->maniaControl->playerManager->getPlayer($callback[1][1][0]); | 				$shooter = $this->maniaControl->getPlayerManager()->getPlayer($callback[1][1][0]); | ||||||
| 				$victim  = $this->maniaControl->playerManager->getPlayer($callback[1][1][1]); | 				$victim  = $this->maniaControl->getPlayerManager()->getPlayer($callback[1][1][1]); | ||||||
| 				$weapon  = $callback[1][1][3]; | 				$weapon  = $callback[1][1][3]; | ||||||
| 				if ($shooter) { | 				if ($shooter) { | ||||||
| 					$this->maniaControl->statisticManager->incrementStat($this->getWeaponStat(intval($weapon), false), $shooter); | 					$this->maniaControl->getStatisticManager()->incrementStat($this->getWeaponStat(intval($weapon), false), $shooter); | ||||||
| 					$this->maniaControl->statisticManager->incrementStat(self::STAT_ON_HIT, $shooter); | 					$this->maniaControl->getStatisticManager()->incrementStat(self::STAT_ON_HIT, $shooter); | ||||||
| 				} | 				} | ||||||
| 				if ($victim) { | 				if ($victim) { | ||||||
| 					$this->maniaControl->statisticManager->incrementStat(self::STAT_ON_GOT_HIT, $victim); | 					$this->maniaControl->getStatisticManager()->incrementStat(self::STAT_ON_GOT_HIT, $victim); | ||||||
| 				} | 				} | ||||||
| 				break; | 				break; | ||||||
| 			case 'LibXmlRpc_OnNearMiss': | 			case 'LibXmlRpc_OnNearMiss': | ||||||
| 				$player = $this->maniaControl->playerManager->getPlayer($callback[1][1][0]); | 				$player = $this->maniaControl->getPlayerManager()->getPlayer($callback[1][1][0]); | ||||||
| 				$this->maniaControl->statisticManager->incrementStat(self::STAT_ON_NEARMISS, $player); | 				$this->maniaControl->getStatisticManager()->incrementStat(self::STAT_ON_NEARMISS, $player); | ||||||
| 				break; | 				break; | ||||||
| 			case 'LibXmlRpc_OnCapture': | 			case 'LibXmlRpc_OnCapture': | ||||||
| 				$logins = $callback[1][1][0]; | 				$logins = $callback[1][1][0]; | ||||||
| 				$logins = explode(';', $logins); | 				$logins = explode(';', $logins); | ||||||
| 				foreach ($logins as $login) { | 				foreach ($logins as $login) { | ||||||
| 					$player = $this->maniaControl->playerManager->getPlayer($login); | 					$player = $this->maniaControl->getPlayerManager()->getPlayer($login); | ||||||
| 					if (!$player) { | 					if (!$player) { | ||||||
| 						continue; | 						continue; | ||||||
| 					} | 					} | ||||||
| 					$this->maniaControl->statisticManager->incrementStat(self::STAT_ON_CAPTURE, $player); | 					$this->maniaControl->getStatisticManager()->incrementStat(self::STAT_ON_CAPTURE, $player); | ||||||
| 				} | 				} | ||||||
| 				break; | 				break; | ||||||
| 			case 'LibXmlRpc_OnArmorEmpty': | 			case 'LibXmlRpc_OnArmorEmpty': | ||||||
| 				$victim = $this->maniaControl->playerManager->getPlayer($callback[1][1][1]); | 				$victim = $this->maniaControl->getPlayerManager()->getPlayer($callback[1][1][1]); | ||||||
| 				if (isset($callback[1][1][0])) { | 				if (isset($callback[1][1][0])) { | ||||||
| 					$shooter = $this->maniaControl->playerManager->getPlayer($callback[1][1][0]); | 					$shooter = $this->maniaControl->getPlayerManager()->getPlayer($callback[1][1][0]); | ||||||
| 					if ($shooter) { | 					if ($shooter) { | ||||||
| 						$this->maniaControl->statisticManager->incrementStat(self::STAT_ON_KILL, $shooter); | 						$this->maniaControl->getStatisticManager()->incrementStat(self::STAT_ON_KILL, $shooter); | ||||||
| 					} | 					} | ||||||
| 				} | 				} | ||||||
| 				if ($victim) { | 				if ($victim) { | ||||||
| 					$this->maniaControl->statisticManager->incrementStat(self::STAT_ON_DEATH, $victim); | 					$this->maniaControl->getStatisticManager()->incrementStat(self::STAT_ON_DEATH, $victim); | ||||||
| 				} | 				} | ||||||
| 				break; | 				break; | ||||||
| 			case 'LibXmlRpc_OnPlayerRequestRespawn': | 			case 'LibXmlRpc_OnPlayerRequestRespawn': | ||||||
| 				$player = $this->maniaControl->playerManager->getPlayer($callback[1][1][0]); | 				$player = $this->maniaControl->getPlayerManager()->getPlayer($callback[1][1][0]); | ||||||
| 				$this->maniaControl->statisticManager->incrementStat(self::STAT_ON_PLAYER_REQUEST_RESPAWN, $player); | 				$this->maniaControl->getStatisticManager()->incrementStat(self::STAT_ON_PLAYER_REQUEST_RESPAWN, $player); | ||||||
| 				break; | 				break; | ||||||
| 			case 'OnShoot': | 			case 'OnShoot': | ||||||
| 				$paramsObject = json_decode($callback[1][1]); | 				$paramsObject = json_decode($callback[1][1]); | ||||||
| @@ -218,15 +218,15 @@ class StatisticCollector implements CallbackListener { | |||||||
| 			case 'OnNearMiss': | 			case 'OnNearMiss': | ||||||
| 				$paramsObject = json_decode($callback[1][1]); | 				$paramsObject = json_decode($callback[1][1]); | ||||||
| 				if ($paramsObject && isset($paramsObject->Event)) { | 				if ($paramsObject && isset($paramsObject->Event)) { | ||||||
| 					$player = $this->maniaControl->playerManager->getPlayer($paramsObject->Event->Shooter->Login); | 					$player = $this->maniaControl->getPlayerManager()->getPlayer($paramsObject->Event->Shooter->Login); | ||||||
| 					$this->maniaControl->statisticManager->incrementStat(self::STAT_ON_NEARMISS, $player); | 					$this->maniaControl->getStatisticManager()->incrementStat(self::STAT_ON_NEARMISS, $player); | ||||||
| 				} | 				} | ||||||
| 				break; | 				break; | ||||||
| 			case 'OnCapture': | 			case 'OnCapture': | ||||||
| 				$paramsObject = json_decode($callback[1][1]); | 				$paramsObject = json_decode($callback[1][1]); | ||||||
| 				if ($paramsObject && isset($paramsObject->Event)) { | 				if ($paramsObject && isset($paramsObject->Event)) { | ||||||
| 					$player = $this->maniaControl->playerManager->getPlayer($paramsObject->Event->Player->Login); | 					$player = $this->maniaControl->getPlayerManager()->getPlayer($paramsObject->Event->Player->Login); | ||||||
| 					$this->maniaControl->statisticManager->incrementStat(self::STAT_ON_CAPTURE, $player); | 					$this->maniaControl->getStatisticManager()->incrementStat(self::STAT_ON_CAPTURE, $player); | ||||||
| 				} | 				} | ||||||
| 				break; | 				break; | ||||||
| 			case 'OnHit': | 			case 'OnHit': | ||||||
| @@ -234,16 +234,16 @@ class StatisticCollector implements CallbackListener { | |||||||
| 				if ($paramsObject && isset($paramsObject->Event)) { | 				if ($paramsObject && isset($paramsObject->Event)) { | ||||||
| 					$weapon = (int)$paramsObject->Event->WeaponNum; | 					$weapon = (int)$paramsObject->Event->WeaponNum; | ||||||
| 					if (isset($paramsObject->Event->Shooter)) { | 					if (isset($paramsObject->Event->Shooter)) { | ||||||
| 						$shooter = $this->maniaControl->playerManager->getPlayer($paramsObject->Event->Shooter->Login); | 						$shooter = $this->maniaControl->getPlayerManager()->getPlayer($paramsObject->Event->Shooter->Login); | ||||||
| 						if ($shooter) { | 						if ($shooter) { | ||||||
| 							$this->maniaControl->statisticManager->incrementStat($this->getWeaponStat($weapon, false), $shooter); | 							$this->maniaControl->getStatisticManager()->incrementStat($this->getWeaponStat($weapon, false), $shooter); | ||||||
| 							$this->maniaControl->statisticManager->incrementStat(self::STAT_ON_HIT, $shooter); | 							$this->maniaControl->getStatisticManager()->incrementStat(self::STAT_ON_HIT, $shooter); | ||||||
| 						} | 						} | ||||||
| 					} | 					} | ||||||
| 					if (isset($paramsObject->Event->Victim)) { | 					if (isset($paramsObject->Event->Victim)) { | ||||||
| 						$victim = $this->maniaControl->playerManager->getPlayer($paramsObject->Event->Victim->Login); | 						$victim = $this->maniaControl->getPlayerManager()->getPlayer($paramsObject->Event->Victim->Login); | ||||||
| 						if ($victim) { | 						if ($victim) { | ||||||
| 							$this->maniaControl->statisticManager->incrementStat(self::STAT_ON_GOT_HIT, $victim); | 							$this->maniaControl->getStatisticManager()->incrementStat(self::STAT_ON_GOT_HIT, $victim); | ||||||
| 						} | 						} | ||||||
| 					} | 					} | ||||||
| 				} | 				} | ||||||
| @@ -251,22 +251,22 @@ class StatisticCollector implements CallbackListener { | |||||||
| 			case 'OnArmorEmpty': | 			case 'OnArmorEmpty': | ||||||
| 				$paramsObject = json_decode($callback[1][1]); | 				$paramsObject = json_decode($callback[1][1]); | ||||||
| 				if ($paramsObject && isset($paramsObject->Event)) { | 				if ($paramsObject && isset($paramsObject->Event)) { | ||||||
| 					$victim = $this->maniaControl->playerManager->getPlayer($paramsObject->Event->Victim->Login); | 					$victim = $this->maniaControl->getPlayerManager()->getPlayer($paramsObject->Event->Victim->Login); | ||||||
| 					$this->maniaControl->statisticManager->incrementStat(self::STAT_ON_DEATH, $victim); | 					$this->maniaControl->getStatisticManager()->incrementStat(self::STAT_ON_DEATH, $victim); | ||||||
| 					if (isset($paramsObject->Event->Shooter->Login)) { | 					if (isset($paramsObject->Event->Shooter->Login)) { | ||||||
| 						$shooter = $this->maniaControl->playerManager->getPlayer($paramsObject->Event->Shooter->Login); | 						$shooter = $this->maniaControl->getPlayerManager()->getPlayer($paramsObject->Event->Shooter->Login); | ||||||
| 						if ($shooter) { | 						if ($shooter) { | ||||||
| 							$this->maniaControl->statisticManager->incrementStat(self::STAT_ON_KILL, $shooter); | 							$this->maniaControl->getStatisticManager()->incrementStat(self::STAT_ON_KILL, $shooter); | ||||||
| 						} | 						} | ||||||
| 						$this->maniaControl->statisticManager->incrementStat(self::STAT_ON_KILL, $shooter); | 						$this->maniaControl->getStatisticManager()->incrementStat(self::STAT_ON_KILL, $shooter); | ||||||
| 					} | 					} | ||||||
| 				} | 				} | ||||||
| 				break; | 				break; | ||||||
| 			case 'OnRequestRespawn': | 			case 'OnRequestRespawn': | ||||||
| 				$paramsObject = json_decode($callback[1][1]); | 				$paramsObject = json_decode($callback[1][1]); | ||||||
| 				if ($paramsObject && isset($paramsObject->Event)) { | 				if ($paramsObject && isset($paramsObject->Event)) { | ||||||
| 					$player = $this->maniaControl->playerManager->getPlayer($paramsObject->Event->Player->Login); | 					$player = $this->maniaControl->getPlayerManager()->getPlayer($paramsObject->Event->Player->Login); | ||||||
| 					$this->maniaControl->statisticManager->incrementStat(self::STAT_ON_PLAYER_REQUEST_RESPAWN, $player); | 					$this->maniaControl->getStatisticManager()->incrementStat(self::STAT_ON_PLAYER_REQUEST_RESPAWN, $player); | ||||||
| 				} | 				} | ||||||
| 				break; | 				break; | ||||||
| 			case 'EndTurn': //TODO make it for other modes working | 			case 'EndTurn': //TODO make it for other modes working | ||||||
| @@ -274,8 +274,8 @@ class StatisticCollector implements CallbackListener { | |||||||
| 				if ($paramsObject && is_array($paramsObject->ScoresTable)) { | 				if ($paramsObject && is_array($paramsObject->ScoresTable)) { | ||||||
| 					$durationTime = (int)(($paramsObject->EndTime - $paramsObject->StartTime) / 1000); | 					$durationTime = (int)(($paramsObject->EndTime - $paramsObject->StartTime) / 1000); | ||||||
| 					foreach ($paramsObject->ScoresTable as $score) { | 					foreach ($paramsObject->ScoresTable as $score) { | ||||||
| 						$player = $this->maniaControl->playerManager->getPlayer($score->Login); | 						$player = $this->maniaControl->getPlayerManager()->getPlayer($score->Login); | ||||||
| 						$this->maniaControl->statisticManager->insertStat(self::STAT_PLAYTIME, $player, -1, $durationTime); | 						$this->maniaControl->getStatisticManager()->insertStat(self::STAT_PLAYTIME, $player, -1, $durationTime); | ||||||
| 					} | 					} | ||||||
| 				} | 				} | ||||||
| 				break; | 				break; | ||||||
| @@ -298,8 +298,8 @@ class StatisticCollector implements CallbackListener { | |||||||
| 		$this->onShootArray[$login][$weaponNumber]++; | 		$this->onShootArray[$login][$weaponNumber]++; | ||||||
|  |  | ||||||
| 		//Write Shoot Data into database | 		//Write Shoot Data into database | ||||||
| 		if (array_sum($this->onShootArray[$login]) > $this->maniaControl->settingManager->getSettingValue($this, self::SETTING_ON_SHOOT_PRESTORE)) { | 		if (array_sum($this->onShootArray[$login]) > $this->maniaControl->getSettingManager()->getSettingValue($this, self::SETTING_ON_SHOOT_PRESTORE)) { | ||||||
| 			$player = $this->maniaControl->playerManager->getPlayer($login); | 			$player = $this->maniaControl->getPlayerManager()->getPlayer($login); | ||||||
|  |  | ||||||
| 			$rocketShots  = $this->onShootArray[$login][self::WEAPON_ROCKET]; | 			$rocketShots  = $this->onShootArray[$login][self::WEAPON_ROCKET]; | ||||||
| 			$laserShots   = $this->onShootArray[$login][self::WEAPON_LASER]; | 			$laserShots   = $this->onShootArray[$login][self::WEAPON_LASER]; | ||||||
| @@ -307,23 +307,23 @@ class StatisticCollector implements CallbackListener { | |||||||
| 			$nucleusShots = $this->onShootArray[$login][self::WEAPON_NUCLEUS]; | 			$nucleusShots = $this->onShootArray[$login][self::WEAPON_NUCLEUS]; | ||||||
|  |  | ||||||
| 			if ($rocketShots > 0) { | 			if ($rocketShots > 0) { | ||||||
| 				$this->maniaControl->statisticManager->insertStat(self::STAT_ROCKET_SHOT, $player, $this->maniaControl->server->index, $rocketShots); | 				$this->maniaControl->getStatisticManager()->insertStat(self::STAT_ROCKET_SHOT, $player, $this->maniaControl->getServer()->index, $rocketShots); | ||||||
| 				$this->onShootArray[$login][self::WEAPON_ROCKET] = 0; | 				$this->onShootArray[$login][self::WEAPON_ROCKET] = 0; | ||||||
| 			} | 			} | ||||||
| 			if ($laserShots > 0) { | 			if ($laserShots > 0) { | ||||||
| 				$this->maniaControl->statisticManager->insertStat(self::STAT_LASER_SHOT, $player, $this->maniaControl->server->index, $laserShots); | 				$this->maniaControl->getStatisticManager()->insertStat(self::STAT_LASER_SHOT, $player, $this->maniaControl->getServer()->index, $laserShots); | ||||||
| 				$this->onShootArray[$login][self::WEAPON_LASER] = 0; | 				$this->onShootArray[$login][self::WEAPON_LASER] = 0; | ||||||
| 			} | 			} | ||||||
| 			if ($arrowShots > 0) { | 			if ($arrowShots > 0) { | ||||||
| 				$this->maniaControl->statisticManager->insertStat(self::STAT_ARROW_SHOT, $player, $this->maniaControl->server->index, $arrowShots); | 				$this->maniaControl->getStatisticManager()->insertStat(self::STAT_ARROW_SHOT, $player, $this->maniaControl->getServer()->index, $arrowShots); | ||||||
| 				$this->onShootArray[$login][self::WEAPON_ARROW] = 0; | 				$this->onShootArray[$login][self::WEAPON_ARROW] = 0; | ||||||
| 			} | 			} | ||||||
| 			if ($nucleusShots > 0) { | 			if ($nucleusShots > 0) { | ||||||
| 				$this->maniaControl->statisticManager->insertStat(self::STAT_NUCLEUS_SHOT, $player, $this->maniaControl->server->index, $nucleusShots); | 				$this->maniaControl->getStatisticManager()->insertStat(self::STAT_NUCLEUS_SHOT, $player, $this->maniaControl->getServer()->index, $nucleusShots); | ||||||
| 				$this->onShootArray[$login][self::WEAPON_NUCLEUS] = 0; | 				$this->onShootArray[$login][self::WEAPON_NUCLEUS] = 0; | ||||||
| 			} | 			} | ||||||
|  |  | ||||||
| 			$this->maniaControl->statisticManager->insertStat(self::STAT_ON_SHOOT, $player, $this->maniaControl->server->index, $rocketShots + $laserShots + $arrowShots + $nucleusShots); | 			$this->maniaControl->getStatisticManager()->insertStat(self::STAT_ON_SHOOT, $player, $this->maniaControl->getServer()->index, $rocketShots + $laserShots + $arrowShots + $nucleusShots); | ||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
|   | |||||||
| @@ -69,7 +69,7 @@ class StatisticManager { | |||||||
| 	 * @return bool | 	 * @return bool | ||||||
| 	 */ | 	 */ | ||||||
| 	private function initTables() { | 	private function initTables() { | ||||||
| 		$mysqli    = $this->maniaControl->database->mysqli; | 		$mysqli    = $this->maniaControl->getDatabase()->getMysqli(); | ||||||
| 		$query     = "CREATE TABLE IF NOT EXISTS `" . self::TABLE_STATMETADATA . "` ( | 		$query     = "CREATE TABLE IF NOT EXISTS `" . self::TABLE_STATMETADATA . "` ( | ||||||
| 				`index` int(11) NOT NULL AUTO_INCREMENT, | 				`index` int(11) NOT NULL AUTO_INCREMENT, | ||||||
| 				`name` varchar(100) NOT NULL, | 				`name` varchar(100) NOT NULL, | ||||||
| @@ -117,7 +117,7 @@ class StatisticManager { | |||||||
| 	 * Store Stats Meta Data from the Database | 	 * Store Stats Meta Data from the Database | ||||||
| 	 */ | 	 */ | ||||||
| 	private function storeStatMetaData() { | 	private function storeStatMetaData() { | ||||||
| 		$mysqli = $this->maniaControl->database->mysqli; | 		$mysqli = $this->maniaControl->getDatabase()->getMysqli(); | ||||||
|  |  | ||||||
| 		$query  = "SELECT * FROM `" . self::TABLE_STATMETADATA . "`;"; | 		$query  = "SELECT * FROM `" . self::TABLE_STATMETADATA . "`;"; | ||||||
| 		$result = $mysqli->query($query); | 		$result = $mysqli->query($query); | ||||||
| @@ -202,14 +202,15 @@ class StatisticManager { | |||||||
| 			return $this->getStatsRankingOfSpecialStat($statName, $serverIndex); | 			return $this->getStatsRankingOfSpecialStat($statName, $serverIndex); | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
| 		$mysqli = $this->maniaControl->database->mysqli; | 		$mysqli = $this->maniaControl->getDatabase()->getMysqli(); | ||||||
| 		$statId = $this->getStatId($statName); | 		$statId = $this->getStatId($statName); | ||||||
|  |  | ||||||
| 		$query = "SELECT playerId, serverIndex, value FROM `" . self::TABLE_STATISTICS . "` WHERE statId = {$statId}"; | 		$query = "SELECT `playerId`, `serverIndex`, `value` FROM `" . self::TABLE_STATISTICS . "` | ||||||
|  | 				WHERE `statId` = {$statId} "; | ||||||
| 		if ($minValue >= 0) { | 		if ($minValue >= 0) { | ||||||
| 			$query .= " AND value >= {$minValue}"; | 			$query .= "AND `value` >= {$minValue} "; | ||||||
| 		} | 		} | ||||||
| 		$query .= " ORDER BY value DESC;"; | 		$query .= "ORDER BY `value` DESC;"; | ||||||
|  |  | ||||||
| 		$result = $mysqli->query($query); | 		$result = $mysqli->query($query); | ||||||
| 		if (!$result) { | 		if (!$result) { | ||||||
| @@ -490,7 +491,7 @@ class StatisticManager { | |||||||
| 				return intval($hits) / intval($shots); | 				return intval($hits) / intval($shots); | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
| 		$mysqli = $this->maniaControl->database->mysqli; | 		$mysqli = $this->maniaControl->getDatabase()->getMysqli(); | ||||||
| 		$statId = $this->getStatId($statName); | 		$statId = $this->getStatId($statName); | ||||||
|  |  | ||||||
| 		if (!$statId) { | 		if (!$statId) { | ||||||
| @@ -498,9 +499,14 @@ class StatisticManager { | |||||||
| 		} | 		} | ||||||
|  |  | ||||||
| 		if ($serverIndex < 0) { | 		if ($serverIndex < 0) { | ||||||
| 			$query = "SELECT SUM(value) as value FROM `" . self::TABLE_STATISTICS . "` WHERE `statId` = " . $statId . " AND `playerId` = " . $playerId . ";"; | 			$query = "SELECT SUM(`value`) as `value` FROM `" . self::TABLE_STATISTICS . "` | ||||||
|  | 					WHERE `statId` = {$statId} | ||||||
|  | 					AND `playerId` = {$playerId};"; | ||||||
| 		} else { | 		} else { | ||||||
| 			$query = "SELECT value FROM `" . self::TABLE_STATISTICS . "` WHERE `statId` = " . $statId . " AND `playerId` = " . $playerId . " AND `serverIndex` = '" . $serverIndex . "';"; | 			$query = "SELECT `value` FROM `" . self::TABLE_STATISTICS . "` | ||||||
|  | 					WHERE `statId` = {$statId} | ||||||
|  | 					AND `playerId` = {$playerId} | ||||||
|  | 					AND `serverIndex` = {$serverIndex};"; | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
| 		$result = $mysqli->query($query); | 		$result = $mysqli->query($query); | ||||||
| @@ -554,10 +560,10 @@ class StatisticManager { | |||||||
| 		} | 		} | ||||||
|  |  | ||||||
| 		if ($serverIndex) { | 		if ($serverIndex) { | ||||||
| 			$serverIndex = $this->maniaControl->server->index; | 			$serverIndex = $this->maniaControl->getServer()->index; | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
| 		$mysqli    = $this->maniaControl->database->mysqli; | 		$mysqli    = $this->maniaControl->getDatabase()->getMysqli(); | ||||||
| 		$query     = "INSERT INTO `" . self::TABLE_STATISTICS . "` ( | 		$query     = "INSERT INTO `" . self::TABLE_STATISTICS . "` ( | ||||||
| 				`serverIndex`, | 				`serverIndex`, | ||||||
| 				`playerId`, | 				`playerId`, | ||||||
| @@ -592,7 +598,7 @@ class StatisticManager { | |||||||
| 	 * @return bool | 	 * @return bool | ||||||
| 	 */ | 	 */ | ||||||
| 	public function defineStatMetaData($statName, $type = self::STAT_TYPE_INT, $statDescription = '') { | 	public function defineStatMetaData($statName, $type = self::STAT_TYPE_INT, $statDescription = '') { | ||||||
| 		$mysqli    = $this->maniaControl->database->mysqli; | 		$mysqli    = $this->maniaControl->getDatabase()->getMysqli(); | ||||||
| 		$query     = "INSERT INTO `" . self::TABLE_STATMETADATA . "` ( | 		$query     = "INSERT INTO `" . self::TABLE_STATMETADATA . "` ( | ||||||
| 				`name`, | 				`name`, | ||||||
| 				`type`, | 				`type`, | ||||||
|   | |||||||
| @@ -38,12 +38,12 @@ class PluginUpdateManager implements CallbackListener, CommandListener, TimerLis | |||||||
| 	public function __construct(ManiaControl $maniaControl) { | 	public function __construct(ManiaControl $maniaControl) { | ||||||
| 		$this->maniaControl = $maniaControl; | 		$this->maniaControl = $maniaControl; | ||||||
|  |  | ||||||
| 		// Register for callbacks | 		// Callbacks | ||||||
| 		$this->maniaControl->callbackManager->registerCallbackListener(CallbackManager::CB_MP_PLAYERMANIALINKPAGEANSWER, $this, 'handleManialinkPageAnswer'); | 		$this->maniaControl->getCallbackManager()->registerCallbackListener(CallbackManager::CB_MP_PLAYERMANIALINKPAGEANSWER, $this, 'handleManialinkPageAnswer'); | ||||||
|  |  | ||||||
| 		// Register for chat commands | 		// Chat commands | ||||||
| 		$this->maniaControl->commandManager->registerCommandListener('checkpluginsupdate', $this, 'handle_CheckPluginsUpdate', true, 'Check for Plugin Updates.'); | 		$this->maniaControl->getCommandManager()->registerCommandListener('checkpluginsupdate', $this, 'handle_CheckPluginsUpdate', true, 'Check for Plugin Updates.'); | ||||||
| 		$this->maniaControl->commandManager->registerCommandListener('pluginsupdate', $this, 'handle_PluginsUpdate', true, 'Perform the Plugin Updates.'); | 		$this->maniaControl->getCommandManager()->registerCommandListener('pluginsupdate', $this, 'handle_PluginsUpdate', true, 'Perform the Plugin Updates.'); | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	/** | 	/** | ||||||
| @@ -53,8 +53,8 @@ class PluginUpdateManager implements CallbackListener, CommandListener, TimerLis | |||||||
| 	 * @param Player $player | 	 * @param Player $player | ||||||
| 	 */ | 	 */ | ||||||
| 	public function handle_CheckPluginsUpdate(array $chatCallback, Player $player) { | 	public function handle_CheckPluginsUpdate(array $chatCallback, Player $player) { | ||||||
| 		if (!$this->maniaControl->authenticationManager->checkPermission($player, UpdateManager::SETTING_PERMISSION_UPDATECHECK)) { | 		if (!$this->maniaControl->getAuthenticationManager()->checkPermission($player, UpdateManager::SETTING_PERMISSION_UPDATECHECK)) { | ||||||
| 			$this->maniaControl->authenticationManager->sendNotAllowed($player); | 			$this->maniaControl->getAuthenticationManager()->sendNotAllowed($player); | ||||||
| 			return; | 			return; | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
| @@ -69,22 +69,22 @@ class PluginUpdateManager implements CallbackListener, CommandListener, TimerLis | |||||||
| 	public function checkPluginsUpdate(Player $player = null) { | 	public function checkPluginsUpdate(Player $player = null) { | ||||||
| 		$message = 'Checking Plugins for newer Versions...'; | 		$message = 'Checking Plugins for newer Versions...'; | ||||||
| 		if ($player) { | 		if ($player) { | ||||||
| 			$this->maniaControl->chat->sendInformation($message, $player); | 			$this->maniaControl->getChat()->sendInformation($message, $player); | ||||||
| 		} | 		} | ||||||
| 		$this->maniaControl->log($message); | 		$this->maniaControl->log($message); | ||||||
|  |  | ||||||
| 		$this->maniaControl->pluginManager->fetchPluginList(function ($data, $error) use (&$player) { | 		$this->maniaControl->getPluginManager()->fetchPluginList(function ($data, $error) use (&$player) { | ||||||
| 			if (!$data || $error) { | 			if (!$data || $error) { | ||||||
| 				$message = 'Error while checking Plugins for newer Versions!'; | 				$message = 'Error while checking Plugins for newer Versions!'; | ||||||
| 				if ($player) { | 				if ($player) { | ||||||
| 					$this->maniaControl->chat->sendError($message, $player); | 					$this->maniaControl->getChat()->sendError($message, $player); | ||||||
| 				} | 				} | ||||||
| 				$this->maniaControl->log($message); | 				$this->maniaControl->log($message); | ||||||
| 				return; | 				return; | ||||||
| 			} | 			} | ||||||
|  |  | ||||||
| 			$pluginsData   = $this->parsePluginsData($data); | 			$pluginsData   = $this->parsePluginsData($data); | ||||||
| 			$pluginClasses = $this->maniaControl->pluginManager->getPluginClasses(); | 			$pluginClasses = $this->maniaControl->getPluginManager()->getPluginClasses(); | ||||||
| 			$pluginUpdates = array(); | 			$pluginUpdates = array(); | ||||||
|  |  | ||||||
| 			foreach ($pluginClasses as $pluginClass) { | 			foreach ($pluginClasses as $pluginClass) { | ||||||
| @@ -100,7 +100,7 @@ class PluginUpdateManager implements CallbackListener, CommandListener, TimerLis | |||||||
| 					$pluginUpdates[$pluginId] = $pluginData; | 					$pluginUpdates[$pluginId] = $pluginData; | ||||||
| 					$message                  = "There is an Update of '{$pluginData->pluginName}' available! ('{$pluginClass}' - Version {$pluginData->version})"; | 					$message                  = "There is an Update of '{$pluginData->pluginName}' available! ('{$pluginClass}' - Version {$pluginData->version})"; | ||||||
| 					if ($player) { | 					if ($player) { | ||||||
| 						$this->maniaControl->chat->sendSuccess($message, $player); | 						$this->maniaControl->getChat()->sendSuccess($message, $player); | ||||||
| 					} | 					} | ||||||
| 					$this->maniaControl->log($message); | 					$this->maniaControl->log($message); | ||||||
| 				} | 				} | ||||||
| @@ -109,14 +109,14 @@ class PluginUpdateManager implements CallbackListener, CommandListener, TimerLis | |||||||
| 			if (empty($pluginUpdates)) { | 			if (empty($pluginUpdates)) { | ||||||
| 				$message = 'Plugins Update Check completed: All Plugins are up-to-date!'; | 				$message = 'Plugins Update Check completed: All Plugins are up-to-date!'; | ||||||
| 				if ($player) { | 				if ($player) { | ||||||
| 					$this->maniaControl->chat->sendSuccess($message, $player); | 					$this->maniaControl->getChat()->sendSuccess($message, $player); | ||||||
| 				} | 				} | ||||||
| 				$this->maniaControl->log($message); | 				$this->maniaControl->log($message); | ||||||
| 			} else { | 			} else { | ||||||
| 				$updatesCount = count($pluginUpdates); | 				$updatesCount = count($pluginUpdates); | ||||||
| 				$message      = "Plugins Update Check completed: There are {$updatesCount} Updates available!"; | 				$message      = "Plugins Update Check completed: There are {$updatesCount} Updates available!"; | ||||||
| 				if ($player) { | 				if ($player) { | ||||||
| 					$this->maniaControl->chat->sendSuccess($message, $player); | 					$this->maniaControl->getChat()->sendSuccess($message, $player); | ||||||
| 				} | 				} | ||||||
| 				$this->maniaControl->log($message); | 				$this->maniaControl->log($message); | ||||||
| 			} | 			} | ||||||
| @@ -148,8 +148,8 @@ class PluginUpdateManager implements CallbackListener, CommandListener, TimerLis | |||||||
| 	 * @param Player $player | 	 * @param Player $player | ||||||
| 	 */ | 	 */ | ||||||
| 	public function handle_PluginsUpdate(array $chatCallback, Player $player) { | 	public function handle_PluginsUpdate(array $chatCallback, Player $player) { | ||||||
| 		if (!$this->maniaControl->authenticationManager->checkPermission($player, UpdateManager::SETTING_PERMISSION_UPDATE)) { | 		if (!$this->maniaControl->getAuthenticationManager()->checkPermission($player, UpdateManager::SETTING_PERMISSION_UPDATE)) { | ||||||
| 			$this->maniaControl->authenticationManager->sendNotAllowed($player); | 			$this->maniaControl->getAuthenticationManager()->sendNotAllowed($player); | ||||||
| 			return; | 			return; | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
| @@ -166,7 +166,7 @@ class PluginUpdateManager implements CallbackListener, CommandListener, TimerLis | |||||||
| 		if (empty($pluginsUpdates)) { | 		if (empty($pluginsUpdates)) { | ||||||
| 			$message = 'There are no Plugin Updates available!'; | 			$message = 'There are no Plugin Updates available!'; | ||||||
| 			if ($player) { | 			if ($player) { | ||||||
| 				$this->maniaControl->chat->sendInformation($message, $player); | 				$this->maniaControl->getChat()->sendInformation($message, $player); | ||||||
| 			} | 			} | ||||||
| 			$this->maniaControl->log($message); | 			$this->maniaControl->log($message); | ||||||
| 			return; | 			return; | ||||||
| @@ -174,15 +174,15 @@ class PluginUpdateManager implements CallbackListener, CommandListener, TimerLis | |||||||
|  |  | ||||||
| 		$message = "Starting Plugins Updating..."; | 		$message = "Starting Plugins Updating..."; | ||||||
| 		if ($player) { | 		if ($player) { | ||||||
| 			$this->maniaControl->chat->sendInformation($message, $player); | 			$this->maniaControl->getChat()->sendInformation($message, $player); | ||||||
| 		} | 		} | ||||||
| 		$this->maniaControl->log($message); | 		$this->maniaControl->log($message); | ||||||
|  |  | ||||||
| 		$performBackup = $this->maniaControl->settingManager->getSettingValue($this->maniaControl->updateManager, UpdateManager::SETTING_PERFORM_BACKUPS); | 		$performBackup = $this->maniaControl->getSettingManager()->getSettingValue($this->maniaControl->getUpdateManager(), UpdateManager::SETTING_PERFORM_BACKUPS); | ||||||
| 		if ($performBackup && !BackupUtil::performPluginsBackup()) { | 		if ($performBackup && !BackupUtil::performPluginsBackup()) { | ||||||
| 			$message = 'Creating Backup before Plugins Update failed!'; | 			$message = 'Creating Backup before Plugins Update failed!'; | ||||||
| 			if ($player) { | 			if ($player) { | ||||||
| 				$this->maniaControl->chat->sendError($message, $player); | 				$this->maniaControl->getChat()->sendError($message, $player); | ||||||
| 			} | 			} | ||||||
| 			$this->maniaControl->log($message); | 			$this->maniaControl->log($message); | ||||||
| 		} | 		} | ||||||
| @@ -209,7 +209,7 @@ class PluginUpdateManager implements CallbackListener, CommandListener, TimerLis | |||||||
| 		$pluginsUpdates = $this->parsePluginsData($pluginData); | 		$pluginsUpdates = $this->parsePluginsData($pluginData); | ||||||
|  |  | ||||||
| 		$updates       = array(); | 		$updates       = array(); | ||||||
| 		$pluginClasses = $this->maniaControl->pluginManager->getPluginClasses(); | 		$pluginClasses = $this->maniaControl->getPluginManager()->getPluginClasses(); | ||||||
| 		foreach ($pluginClasses as $pluginClass) { | 		foreach ($pluginClasses as $pluginClass) { | ||||||
| 			/** @var Plugin $pluginClass */ | 			/** @var Plugin $pluginClass */ | ||||||
| 			$pluginId = $pluginClass::getId(); | 			$pluginId = $pluginClass::getId(); | ||||||
| @@ -237,13 +237,13 @@ class PluginUpdateManager implements CallbackListener, CommandListener, TimerLis | |||||||
| 	 * @param bool             $update | 	 * @param bool             $update | ||||||
| 	 */ | 	 */ | ||||||
| 	private function installPlugin(PluginUpdateData $pluginUpdateData, Player $player = null, $update = false) { | 	private function installPlugin(PluginUpdateData $pluginUpdateData, Player $player = null, $update = false) { | ||||||
| 		$this->maniaControl->fileReader->loadFile($pluginUpdateData->url, function ($updateFileContent, $error) use ( | 		$this->maniaControl->getFileReader()->loadFile($pluginUpdateData->url, function ($updateFileContent, $error) use ( | ||||||
| 			&$pluginUpdateData, &$player, &$update | 			&$pluginUpdateData, &$player, &$update | ||||||
| 		) { | 		) { | ||||||
| 			if (!$updateFileContent || $error) { | 			if (!$updateFileContent || $error) { | ||||||
| 				$message = "Error loading Update Data for '{$pluginUpdateData->pluginName}': {$error}!"; | 				$message = "Error loading Update Data for '{$pluginUpdateData->pluginName}': {$error}!"; | ||||||
| 				if ($player) { | 				if ($player) { | ||||||
| 					$this->maniaControl->chat->sendInformation($message, $player); | 					$this->maniaControl->getChat()->sendInformation($message, $player); | ||||||
| 				} | 				} | ||||||
| 				$this->maniaControl->log($message); | 				$this->maniaControl->log($message); | ||||||
| 				return; | 				return; | ||||||
| @@ -255,7 +255,7 @@ class PluginUpdateManager implements CallbackListener, CommandListener, TimerLis | |||||||
|  |  | ||||||
| 			$message = "Now {$actionVerb} '{$pluginUpdateData->pluginName}'..."; | 			$message = "Now {$actionVerb} '{$pluginUpdateData->pluginName}'..."; | ||||||
| 			if ($player) { | 			if ($player) { | ||||||
| 				$this->maniaControl->chat->sendInformation($message, $player); | 				$this->maniaControl->getChat()->sendInformation($message, $player); | ||||||
| 			} | 			} | ||||||
| 			$this->maniaControl->log($message); | 			$this->maniaControl->log($message); | ||||||
|  |  | ||||||
| @@ -266,7 +266,7 @@ class PluginUpdateManager implements CallbackListener, CommandListener, TimerLis | |||||||
| 			if (!$bytes || $bytes <= 0) { | 			if (!$bytes || $bytes <= 0) { | ||||||
| 				$message = "Plugin {$actionNoun} failed: Couldn't save {$actionNoun} Zip!"; | 				$message = "Plugin {$actionNoun} failed: Couldn't save {$actionNoun} Zip!"; | ||||||
| 				if ($player) { | 				if ($player) { | ||||||
| 					$this->maniaControl->chat->sendError($message, $player); | 					$this->maniaControl->getChat()->sendError($message, $player); | ||||||
| 				} | 				} | ||||||
| 				trigger_error($message); | 				trigger_error($message); | ||||||
| 				return; | 				return; | ||||||
| @@ -277,7 +277,7 @@ class PluginUpdateManager implements CallbackListener, CommandListener, TimerLis | |||||||
| 			if ($result !== true) { | 			if ($result !== true) { | ||||||
| 				$message = "Plugin {$actionNoun} failed: Couldn't open {$actionNoun} Zip! ({$result})"; | 				$message = "Plugin {$actionNoun} failed: Couldn't open {$actionNoun} Zip! ({$result})"; | ||||||
| 				if ($player) { | 				if ($player) { | ||||||
| 					$this->maniaControl->chat->sendError($message, $player); | 					$this->maniaControl->getChat()->sendError($message, $player); | ||||||
| 				} | 				} | ||||||
| 				trigger_error($message); | 				trigger_error($message); | ||||||
| 				return; | 				return; | ||||||
| @@ -294,26 +294,26 @@ class PluginUpdateManager implements CallbackListener, CommandListener, TimerLis | |||||||
| 			} | 			} | ||||||
| 			$message = "Successfully {$actionVerbDone} '{$pluginUpdateData->pluginName}'!{$messageExtra}"; | 			$message = "Successfully {$actionVerbDone} '{$pluginUpdateData->pluginName}'!{$messageExtra}"; | ||||||
| 			if ($player) { | 			if ($player) { | ||||||
| 				$this->maniaControl->chat->sendSuccess($message, $player); | 				$this->maniaControl->getChat()->sendSuccess($message, $player); | ||||||
| 			} | 			} | ||||||
| 			$this->maniaControl->log($message); | 			$this->maniaControl->log($message); | ||||||
|  |  | ||||||
| 			if (!$update) { | 			if (!$update) { | ||||||
| 				$newPluginClasses = $this->maniaControl->pluginManager->loadPlugins(); | 				$newPluginClasses = $this->maniaControl->getPluginManager()->loadPlugins(); | ||||||
| 				if (empty($newPluginClasses)) { | 				if (empty($newPluginClasses)) { | ||||||
| 					$message = "Loading fresh installed Plugin '{$pluginUpdateData->pluginName}' failed!"; | 					$message = "Loading fresh installed Plugin '{$pluginUpdateData->pluginName}' failed!"; | ||||||
| 					if ($player) { | 					if ($player) { | ||||||
| 						$this->maniaControl->chat->sendError($message, $player); | 						$this->maniaControl->getChat()->sendError($message, $player); | ||||||
| 					} | 					} | ||||||
| 					$this->maniaControl->log($message); | 					$this->maniaControl->log($message); | ||||||
| 				} else { | 				} else { | ||||||
| 					$message = "Successfully loaded fresh installed Plugin '{$pluginUpdateData->pluginName}'!"; | 					$message = "Successfully loaded fresh installed Plugin '{$pluginUpdateData->pluginName}'!"; | ||||||
| 					if ($player) { | 					if ($player) { | ||||||
| 						$this->maniaControl->chat->sendSuccess($message, $player); | 						$this->maniaControl->getChat()->sendSuccess($message, $player); | ||||||
| 					} | 					} | ||||||
| 					$this->maniaControl->log($message); | 					$this->maniaControl->log($message); | ||||||
|  |  | ||||||
| 					$this->maniaControl->configurator->showMenu($player, InstallMenu::getTitle()); | 					$this->maniaControl->getConfigurator()->showMenu($player, InstallMenu::getTitle()); | ||||||
| 				} | 				} | ||||||
| 			} | 			} | ||||||
| 		}); | 		}); | ||||||
| @@ -333,7 +333,7 @@ class PluginUpdateManager implements CallbackListener, CommandListener, TimerLis | |||||||
| 		} | 		} | ||||||
|  |  | ||||||
| 		$login  = $callback[1][1]; | 		$login  = $callback[1][1]; | ||||||
| 		$player = $this->maniaControl->playerManager->getPlayer($login); | 		$player = $this->maniaControl->getPlayerManager()->getPlayer($login); | ||||||
|  |  | ||||||
| 		if ($update) { | 		if ($update) { | ||||||
| 			$pluginClass = substr($actionId, strlen(PluginMenu::ACTION_PREFIX_UPDATEPLUGIN)); | 			$pluginClass = substr($actionId, strlen(PluginMenu::ACTION_PREFIX_UPDATEPLUGIN)); | ||||||
| @@ -345,24 +345,24 @@ class PluginUpdateManager implements CallbackListener, CommandListener, TimerLis | |||||||
| 					$this->installPlugin($pluginUpdateData, $player, true); | 					$this->installPlugin($pluginUpdateData, $player, true); | ||||||
| 				} else { | 				} else { | ||||||
| 					$message = 'Error loading Plugin Update Data!'; | 					$message = 'Error loading Plugin Update Data!'; | ||||||
| 					$this->maniaControl->chat->sendError($message, $player); | 					$this->maniaControl->getChat()->sendError($message, $player); | ||||||
| 				} | 				} | ||||||
| 			} | 			} | ||||||
| 		} else { | 		} else { | ||||||
| 			$pluginId = substr($actionId, strlen(InstallMenu::ACTION_PREFIX_INSTALL_PLUGIN)); | 			$pluginId = substr($actionId, strlen(InstallMenu::ACTION_PREFIX_INSTALL_PLUGIN)); | ||||||
|  |  | ||||||
| 			$url = ManiaControl::URL_WEBSERVICE . 'plugins/' . $pluginId; | 			$url = ManiaControl::URL_WEBSERVICE . 'plugins/' . $pluginId; | ||||||
| 			$this->maniaControl->fileReader->loadFile($url, function ($data, $error) use (&$player) { | 			$this->maniaControl->getFileReader()->loadFile($url, function ($data, $error) use (&$player) { | ||||||
| 				if ($error || !$data) { | 				if ($error || !$data) { | ||||||
| 					$message = "Error loading Plugin Install Data! {$error}"; | 					$message = "Error loading Plugin Install Data! {$error}"; | ||||||
| 					$this->maniaControl->chat->sendError($message, $player); | 					$this->maniaControl->getChat()->sendError($message, $player); | ||||||
| 					return; | 					return; | ||||||
| 				} | 				} | ||||||
|  |  | ||||||
| 				$data = json_decode($data); | 				$data = json_decode($data); | ||||||
| 				if (!$data) { | 				if (!$data) { | ||||||
| 					$message = "Error loading Plugin Install Data! {$error}"; | 					$message = "Error loading Plugin Install Data! {$error}"; | ||||||
| 					$this->maniaControl->chat->sendError($message, $player); | 					$this->maniaControl->getChat()->sendError($message, $player); | ||||||
| 					return; | 					return; | ||||||
| 				} | 				} | ||||||
|  |  | ||||||
|   | |||||||
| @@ -38,6 +38,7 @@ class UpdateManager implements CallbackListener, CommandListener, TimerListener | |||||||
| 	 * Public properties | 	 * Public properties | ||||||
| 	 */ | 	 */ | ||||||
| 	/** @var PluginUpdateManager $pluginUpdateManager */ | 	/** @var PluginUpdateManager $pluginUpdateManager */ | ||||||
|  | 	/** @deprecated see getPluginUpdateManager() */ | ||||||
| 	public $pluginUpdateManager = null; | 	public $pluginUpdateManager = null; | ||||||
|  |  | ||||||
| 	/* | 	/* | ||||||
| @@ -50,35 +51,35 @@ class UpdateManager implements CallbackListener, CommandListener, TimerListener | |||||||
| 	private $coreUpdateData = null; | 	private $coreUpdateData = null; | ||||||
|  |  | ||||||
| 	/** | 	/** | ||||||
| 	 * Create a new update manager instance | 	 * Construct a new update manager instance | ||||||
| 	 * | 	 * | ||||||
| 	 * @param ManiaControl $maniaControl | 	 * @param ManiaControl $maniaControl | ||||||
| 	 */ | 	 */ | ||||||
| 	public function __construct(ManiaControl $maniaControl) { | 	public function __construct(ManiaControl $maniaControl) { | ||||||
| 		$this->maniaControl = $maniaControl; | 		$this->maniaControl = $maniaControl; | ||||||
|  |  | ||||||
| 		// Init settings | 		// Settings | ||||||
| 		$this->maniaControl->settingManager->initSetting($this, self::SETTING_ENABLE_UPDATECHECK, true); | 		$this->maniaControl->getSettingManager()->initSetting($this, self::SETTING_ENABLE_UPDATECHECK, true); | ||||||
| 		$this->maniaControl->settingManager->initSetting($this, self::SETTING_AUTO_UPDATE, true); | 		$this->maniaControl->getSettingManager()->initSetting($this, self::SETTING_AUTO_UPDATE, true); | ||||||
| 		$this->maniaControl->settingManager->initSetting($this, self::SETTING_UPDATECHECK_INTERVAL, 1); | 		$this->maniaControl->getSettingManager()->initSetting($this, self::SETTING_UPDATECHECK_INTERVAL, 1); | ||||||
| 		$this->maniaControl->settingManager->initSetting($this, self::SETTING_UPDATECHECK_CHANNEL, $this->getUpdateChannels()); | 		$this->maniaControl->getSettingManager()->initSetting($this, self::SETTING_UPDATECHECK_CHANNEL, $this->getUpdateChannels()); | ||||||
| 		$this->maniaControl->settingManager->initSetting($this, self::SETTING_PERFORM_BACKUPS, true); | 		$this->maniaControl->getSettingManager()->initSetting($this, self::SETTING_PERFORM_BACKUPS, true); | ||||||
|  |  | ||||||
| 		// Register for callbacks | 		// Callbacks | ||||||
| 		$updateInterval = $this->maniaControl->settingManager->getSettingValue($this, self::SETTING_UPDATECHECK_INTERVAL); | 		$updateInterval = $this->maniaControl->getSettingManager()->getSettingValue($this, self::SETTING_UPDATECHECK_INTERVAL); | ||||||
| 		$this->maniaControl->timerManager->registerTimerListening($this, 'hourlyUpdateCheck', 1000 * 60 * 60 * $updateInterval); | 		$this->maniaControl->getTimerManager()->registerTimerListening($this, 'hourlyUpdateCheck', 1000 * 60 * 60 * $updateInterval); | ||||||
| 		$this->maniaControl->callbackManager->registerCallbackListener(PlayerManager::CB_PLAYERCONNECT, $this, 'handlePlayerJoined'); | 		$this->maniaControl->getCallbackManager()->registerCallbackListener(PlayerManager::CB_PLAYERCONNECT, $this, 'handlePlayerJoined'); | ||||||
| 		$this->maniaControl->callbackManager->registerCallbackListener(PlayerManager::CB_PLAYERDISCONNECT, $this, 'handlePlayerDisconnect'); | 		$this->maniaControl->getCallbackManager()->registerCallbackListener(PlayerManager::CB_PLAYERDISCONNECT, $this, 'handlePlayerDisconnect'); | ||||||
|  |  | ||||||
| 		// define Permissions | 		// Permissions | ||||||
| 		$this->maniaControl->authenticationManager->definePermissionLevel(self::SETTING_PERMISSION_UPDATE, AuthenticationManager::AUTH_LEVEL_ADMIN); | 		$this->maniaControl->getAuthenticationManager()->definePermissionLevel(self::SETTING_PERMISSION_UPDATE, AuthenticationManager::AUTH_LEVEL_ADMIN); | ||||||
| 		$this->maniaControl->authenticationManager->definePermissionLevel(self::SETTING_PERMISSION_UPDATECHECK, AuthenticationManager::AUTH_LEVEL_MODERATOR); | 		$this->maniaControl->getAuthenticationManager()->definePermissionLevel(self::SETTING_PERMISSION_UPDATECHECK, AuthenticationManager::AUTH_LEVEL_MODERATOR); | ||||||
|  |  | ||||||
| 		// Register for chat commands | 		// Chat commands | ||||||
| 		$this->maniaControl->commandManager->registerCommandListener('checkupdate', $this, 'handle_CheckUpdate', true, 'Checks if there is a core update.'); | 		$this->maniaControl->getCommandManager()->registerCommandListener('checkupdate', $this, 'handle_CheckUpdate', true, 'Checks if there is a core update.'); | ||||||
| 		$this->maniaControl->commandManager->registerCommandListener('coreupdate', $this, 'handle_CoreUpdate', true, 'Performs the core update.'); | 		$this->maniaControl->getCommandManager()->registerCommandListener('coreupdate', $this, 'handle_CoreUpdate', true, 'Performs the core update.'); | ||||||
|  |  | ||||||
| 		// Plugin update manager | 		// Children | ||||||
| 		$this->pluginUpdateManager = new PluginUpdateManager($maniaControl); | 		$this->pluginUpdateManager = new PluginUpdateManager($maniaControl); | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| @@ -105,7 +106,7 @@ class UpdateManager implements CallbackListener, CommandListener, TimerListener | |||||||
| 	 * Perform Hourly Update Check | 	 * Perform Hourly Update Check | ||||||
| 	 */ | 	 */ | ||||||
| 	public function hourlyUpdateCheck() { | 	public function hourlyUpdateCheck() { | ||||||
| 		$updateCheckEnabled = $this->maniaControl->settingManager->getSettingValue($this, self::SETTING_ENABLE_UPDATECHECK); | 		$updateCheckEnabled = $this->maniaControl->getSettingManager()->getSettingValue($this, self::SETTING_ENABLE_UPDATECHECK); | ||||||
| 		if (!$updateCheckEnabled) { | 		if (!$updateCheckEnabled) { | ||||||
| 			$this->setCoreUpdateData(); | 			$this->setCoreUpdateData(); | ||||||
| 		} else { | 		} else { | ||||||
| @@ -138,7 +139,7 @@ class UpdateManager implements CallbackListener, CommandListener, TimerListener | |||||||
| 		$updateChannel = $this->getCurrentUpdateChannelSetting(); | 		$updateChannel = $this->getCurrentUpdateChannelSetting(); | ||||||
| 		$url           = ManiaControl::URL_WEBSERVICE . 'versions?current=1&channel=' . $updateChannel; | 		$url           = ManiaControl::URL_WEBSERVICE . 'versions?current=1&channel=' . $updateChannel; | ||||||
|  |  | ||||||
| 		$this->maniaControl->fileReader->loadFile($url, function ($dataJson, $error) use (&$function) { | 		$this->maniaControl->getFileReader()->loadFile($url, function ($dataJson, $error) use (&$function) { | ||||||
| 			if ($error) { | 			if ($error) { | ||||||
| 				$this->maniaControl->log('Error on UpdateCheck: ' . $error); | 				$this->maniaControl->log('Error on UpdateCheck: ' . $error); | ||||||
| 				return; | 				return; | ||||||
| @@ -159,7 +160,7 @@ class UpdateManager implements CallbackListener, CommandListener, TimerListener | |||||||
| 	 * @return string | 	 * @return string | ||||||
| 	 */ | 	 */ | ||||||
| 	public function getCurrentUpdateChannelSetting() { | 	public function getCurrentUpdateChannelSetting() { | ||||||
| 		$updateChannel = $this->maniaControl->settingManager->getSettingValue($this, self::SETTING_UPDATECHECK_CHANNEL); | 		$updateChannel = $this->maniaControl->getSettingManager()->getSettingValue($this, self::SETTING_UPDATECHECK_CHANNEL); | ||||||
| 		$updateChannel = strtolower($updateChannel); | 		$updateChannel = strtolower($updateChannel); | ||||||
| 		if (!in_array($updateChannel, $this->getUpdateChannels())) { | 		if (!in_array($updateChannel, $this->getUpdateChannels())) { | ||||||
| 			$updateChannel = self::CHANNEL_RELEASE; | 			$updateChannel = self::CHANNEL_RELEASE; | ||||||
| @@ -257,7 +258,7 @@ class UpdateManager implements CallbackListener, CommandListener, TimerListener | |||||||
| 			return false; | 			return false; | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
| 		$version = $this->maniaControl->client->getVersion(); | 		$version = $this->maniaControl->getClient()->getVersion(); | ||||||
| 		if ($updateData->minDedicatedBuild > $version->build) { | 		if ($updateData->minDedicatedBuild > $version->build) { | ||||||
| 			// Server not compatible | 			// Server not compatible | ||||||
| 			return false; | 			return false; | ||||||
| @@ -270,7 +271,7 @@ class UpdateManager implements CallbackListener, CommandListener, TimerListener | |||||||
| 	 * Check if an automatic Update should be performed | 	 * Check if an automatic Update should be performed | ||||||
| 	 */ | 	 */ | ||||||
| 	public function checkAutoUpdate() { | 	public function checkAutoUpdate() { | ||||||
| 		$autoUpdate = $this->maniaControl->settingManager->getSettingValue($this, self::SETTING_AUTO_UPDATE); | 		$autoUpdate = $this->maniaControl->getSettingManager()->getSettingValue($this, self::SETTING_AUTO_UPDATE); | ||||||
| 		if (!$autoUpdate) { | 		if (!$autoUpdate) { | ||||||
| 			// Auto update turned off | 			// Auto update turned off | ||||||
| 			return; | 			return; | ||||||
| @@ -279,7 +280,7 @@ class UpdateManager implements CallbackListener, CommandListener, TimerListener | |||||||
| 			// No update available | 			// No update available | ||||||
| 			return; | 			return; | ||||||
| 		} | 		} | ||||||
| 		if ($this->maniaControl->playerManager->getPlayerCount(false) > 0) { | 		if ($this->maniaControl->getPlayerManager()->getPlayerCount(false) > 0) { | ||||||
| 			// Server not empty | 			// Server not empty | ||||||
| 			return; | 			return; | ||||||
| 		} | 		} | ||||||
| @@ -297,7 +298,7 @@ class UpdateManager implements CallbackListener, CommandListener, TimerListener | |||||||
| 		if (!$this->coreUpdateData) { | 		if (!$this->coreUpdateData) { | ||||||
| 			$message = 'Update failed: No update Data available!'; | 			$message = 'Update failed: No update Data available!'; | ||||||
| 			if ($player) { | 			if ($player) { | ||||||
| 				$this->maniaControl->chat->sendError($message, $player); | 				$this->maniaControl->getChat()->sendError($message, $player); | ||||||
| 			} | 			} | ||||||
| 			$this->maniaControl->log($message); | 			$this->maniaControl->log($message); | ||||||
| 			return false; | 			return false; | ||||||
| @@ -309,29 +310,29 @@ class UpdateManager implements CallbackListener, CommandListener, TimerListener | |||||||
| 		if (!FileUtil::checkWritePermissions($directories)) { | 		if (!FileUtil::checkWritePermissions($directories)) { | ||||||
| 			$message = 'Update not possible: Incorrect File System Permissions!'; | 			$message = 'Update not possible: Incorrect File System Permissions!'; | ||||||
| 			if ($player) { | 			if ($player) { | ||||||
| 				$this->maniaControl->chat->sendError($message, $player); | 				$this->maniaControl->getChat()->sendError($message, $player); | ||||||
| 			} | 			} | ||||||
| 			$this->maniaControl->log($message); | 			$this->maniaControl->log($message); | ||||||
| 			return false; | 			return false; | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
| 		$performBackup = $this->maniaControl->settingManager->getSettingValue($this, self::SETTING_PERFORM_BACKUPS); | 		$performBackup = $this->maniaControl->getSettingManager()->getSettingValue($this, self::SETTING_PERFORM_BACKUPS); | ||||||
| 		if ($performBackup && !BackupUtil::performFullBackup()) { | 		if ($performBackup && !BackupUtil::performFullBackup()) { | ||||||
| 			$message = 'Creating Backup before Update failed!'; | 			$message = 'Creating Backup before Update failed!'; | ||||||
| 			if ($player) { | 			if ($player) { | ||||||
| 				$this->maniaControl->chat->sendError($message, $player); | 				$this->maniaControl->getChat()->sendError($message, $player); | ||||||
| 			} | 			} | ||||||
| 			$this->maniaControl->log($message); | 			$this->maniaControl->log($message); | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
| 		$updateData = $this->coreUpdateData; | 		$updateData = $this->coreUpdateData; | ||||||
| 		$this->maniaControl->fileReader->loadFile($updateData->url, function ($updateFileContent, $error) use ( | 		$this->maniaControl->getFileReader()->loadFile($updateData->url, function ($updateFileContent, $error) use ( | ||||||
| 			$updateData, &$player | 			$updateData, &$player | ||||||
| 		) { | 		) { | ||||||
| 			if (!$updateFileContent || $error) { | 			if (!$updateFileContent || $error) { | ||||||
| 				$message = "Update failed: Couldn't load Update zip! {$error}"; | 				$message = "Update failed: Couldn't load Update zip! {$error}"; | ||||||
| 				if ($player) { | 				if ($player) { | ||||||
| 					$this->maniaControl->chat->sendError($message, $player); | 					$this->maniaControl->getChat()->sendError($message, $player); | ||||||
| 				} | 				} | ||||||
| 				$this->maniaControl->log($message); | 				$this->maniaControl->log($message); | ||||||
| 				return; | 				return; | ||||||
| @@ -344,7 +345,7 @@ class UpdateManager implements CallbackListener, CommandListener, TimerListener | |||||||
| 			if (!$bytes || $bytes <= 0) { | 			if (!$bytes || $bytes <= 0) { | ||||||
| 				$message = "Update failed: Couldn't save Update zip!"; | 				$message = "Update failed: Couldn't save Update zip!"; | ||||||
| 				if ($player) { | 				if ($player) { | ||||||
| 					$this->maniaControl->chat->sendError($message, $player); | 					$this->maniaControl->getChat()->sendError($message, $player); | ||||||
| 				} | 				} | ||||||
| 				$this->maniaControl->log($message); | 				$this->maniaControl->log($message); | ||||||
| 				return; | 				return; | ||||||
| @@ -355,7 +356,7 @@ class UpdateManager implements CallbackListener, CommandListener, TimerListener | |||||||
| 			if ($result !== true) { | 			if ($result !== true) { | ||||||
| 				$message = "Update failed: Couldn't open Update Zip. ({$result})"; | 				$message = "Update failed: Couldn't open Update Zip. ({$result})"; | ||||||
| 				if ($player) { | 				if ($player) { | ||||||
| 					$this->maniaControl->chat->sendError($message, $player); | 					$this->maniaControl->getChat()->sendError($message, $player); | ||||||
| 				} | 				} | ||||||
| 				$this->maniaControl->log($message); | 				$this->maniaControl->log($message); | ||||||
| 				return; | 				return; | ||||||
| @@ -371,7 +372,7 @@ class UpdateManager implements CallbackListener, CommandListener, TimerListener | |||||||
|  |  | ||||||
| 			$message = 'Update finished!'; | 			$message = 'Update finished!'; | ||||||
| 			if ($player) { | 			if ($player) { | ||||||
| 				$this->maniaControl->chat->sendSuccess($message, $player); | 				$this->maniaControl->getChat()->sendSuccess($message, $player); | ||||||
| 			} | 			} | ||||||
| 			$this->maniaControl->log($message); | 			$this->maniaControl->log($message); | ||||||
|  |  | ||||||
| @@ -404,14 +405,14 @@ class UpdateManager implements CallbackListener, CommandListener, TimerListener | |||||||
| 			return; | 			return; | ||||||
| 		} | 		} | ||||||
| 		// Announce available update | 		// Announce available update | ||||||
| 		if (!$this->maniaControl->authenticationManager->checkPermission($player, self::SETTING_PERMISSION_UPDATE)) { | 		if (!$this->maniaControl->getAuthenticationManager()->checkPermission($player, self::SETTING_PERMISSION_UPDATE)) { | ||||||
| 			return; | 			return; | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
| 		if ($this->isNightlyUpdateChannel()) { | 		if ($this->isNightlyUpdateChannel()) { | ||||||
| 			$this->maniaControl->chat->sendSuccess('New Nightly Build (' . $this->coreUpdateData->releaseDate . ') available!', $player->login); | 			$this->maniaControl->getChat()->sendSuccess('New Nightly Build (' . $this->coreUpdateData->releaseDate . ') available!', $player->login); | ||||||
| 		} else { | 		} else { | ||||||
| 			$this->maniaControl->chat->sendInformation('New ManiaControl Version ' . $this->coreUpdateData->version . ' available!', $player->login); | 			$this->maniaControl->getChat()->sendInformation('New ManiaControl Version ' . $this->coreUpdateData->version . ' available!', $player->login); | ||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| @@ -431,19 +432,19 @@ class UpdateManager implements CallbackListener, CommandListener, TimerListener | |||||||
| 	 * @param Player $player | 	 * @param Player $player | ||||||
| 	 */ | 	 */ | ||||||
| 	public function handle_CheckUpdate(array $chatCallback, Player $player) { | 	public function handle_CheckUpdate(array $chatCallback, Player $player) { | ||||||
| 		if (!$this->maniaControl->authenticationManager->checkPermission($player, self::SETTING_PERMISSION_UPDATECHECK)) { | 		if (!$this->maniaControl->getAuthenticationManager()->checkPermission($player, self::SETTING_PERMISSION_UPDATECHECK)) { | ||||||
| 			$this->maniaControl->authenticationManager->sendNotAllowed($player); | 			$this->maniaControl->getAuthenticationManager()->sendNotAllowed($player); | ||||||
| 			return; | 			return; | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
| 		$this->checkCoreUpdateAsync(function (UpdateData $updateData = null) use (&$player) { | 		$this->checkCoreUpdateAsync(function (UpdateData $updateData = null) use (&$player) { | ||||||
| 			if (!$this->checkUpdateData($updateData)) { | 			if (!$this->checkUpdateData($updateData)) { | ||||||
| 				$this->maniaControl->chat->sendInformation('No Update available!', $player->login); | 				$this->maniaControl->getChat()->sendInformation('No Update available!', $player->login); | ||||||
| 				return; | 				return; | ||||||
| 			} | 			} | ||||||
|  |  | ||||||
| 			if (!$this->checkUpdateDataBuildVersion($updateData)) { | 			if (!$this->checkUpdateDataBuildVersion($updateData)) { | ||||||
| 				$this->maniaControl->chat->sendError("Please update Your Server to '{$updateData->minDedicatedBuild}' in order to receive further Updates!", $player->login); | 				$this->maniaControl->getChat()->sendError("Please update Your Server to '{$updateData->minDedicatedBuild}' in order to receive further Updates!", $player->login); | ||||||
| 				return; | 				return; | ||||||
| 			} | 			} | ||||||
|  |  | ||||||
| @@ -452,16 +453,16 @@ class UpdateManager implements CallbackListener, CommandListener, TimerListener | |||||||
| 				$buildDate = $this->getNightlyBuildDate(); | 				$buildDate = $this->getNightlyBuildDate(); | ||||||
| 				if ($buildDate) { | 				if ($buildDate) { | ||||||
| 					if ($updateData->isNewerThan($buildDate)) { | 					if ($updateData->isNewerThan($buildDate)) { | ||||||
| 						$this->maniaControl->chat->sendInformation("No new Build available! (Current Build: '{$buildDate}')", $player->login); | 						$this->maniaControl->getChat()->sendInformation("No new Build available! (Current Build: '{$buildDate}')", $player->login); | ||||||
| 						return; | 						return; | ||||||
| 					} else { | 					} else { | ||||||
| 						$this->maniaControl->chat->sendSuccess("New Nightly Build ({$updateData->releaseDate}) available! (Current Build: '{$buildDate}')", $player->login); | 						$this->maniaControl->getChat()->sendSuccess("New Nightly Build ({$updateData->releaseDate}) available! (Current Build: '{$buildDate}')", $player->login); | ||||||
| 					} | 					} | ||||||
| 				} else { | 				} else { | ||||||
| 					$this->maniaControl->chat->sendSuccess("New Nightly Build ('{$updateData->releaseDate}') available!", $player->login); | 					$this->maniaControl->getChat()->sendSuccess("New Nightly Build ('{$updateData->releaseDate}') available!", $player->login); | ||||||
| 				} | 				} | ||||||
| 			} else { | 			} else { | ||||||
| 				$this->maniaControl->chat->sendSuccess('Update for Version ' . $updateData->version . ' available!', $player->login); | 				$this->maniaControl->getChat()->sendSuccess('Update for Version ' . $updateData->version . ' available!', $player->login); | ||||||
| 			} | 			} | ||||||
|  |  | ||||||
| 			$this->coreUpdateData = $updateData; | 			$this->coreUpdateData = $updateData; | ||||||
| @@ -475,18 +476,18 @@ class UpdateManager implements CallbackListener, CommandListener, TimerListener | |||||||
| 	 * @param Player $player | 	 * @param Player $player | ||||||
| 	 */ | 	 */ | ||||||
| 	public function handle_CoreUpdate(array $chatCallback, Player $player) { | 	public function handle_CoreUpdate(array $chatCallback, Player $player) { | ||||||
| 		if (!$this->maniaControl->authenticationManager->checkPermission($player, self::SETTING_PERMISSION_UPDATE)) { | 		if (!$this->maniaControl->getAuthenticationManager()->checkPermission($player, self::SETTING_PERMISSION_UPDATE)) { | ||||||
| 			$this->maniaControl->authenticationManager->sendNotAllowed($player); | 			$this->maniaControl->getAuthenticationManager()->sendNotAllowed($player); | ||||||
| 			return; | 			return; | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
| 		$this->checkCoreUpdateAsync(function (UpdateData $updateData = null) use (&$player) { | 		$this->checkCoreUpdateAsync(function (UpdateData $updateData = null) use (&$player) { | ||||||
| 			if (!$updateData) { | 			if (!$updateData) { | ||||||
| 				$this->maniaControl->chat->sendError('Update is currently not possible!', $player); | 				$this->maniaControl->getChat()->sendError('Update is currently not possible!', $player); | ||||||
| 				return; | 				return; | ||||||
| 			} | 			} | ||||||
| 			if (!$this->checkUpdateDataBuildVersion($updateData)) { | 			if (!$this->checkUpdateDataBuildVersion($updateData)) { | ||||||
| 				$this->maniaControl->chat->sendError("The Next ManiaControl Update requires a newer Dedicated Server Version!", $player); | 				$this->maniaControl->getChat()->sendError("The Next ManiaControl Update requires a newer Dedicated Server Version!", $player); | ||||||
| 				return; | 				return; | ||||||
| 			} | 			} | ||||||
|  |  | ||||||
|   | |||||||
| @@ -79,25 +79,26 @@ class ChatMessagePlugin implements CommandListener, Plugin { | |||||||
| 	public function load(ManiaControl $maniaControl) { | 	public function load(ManiaControl $maniaControl) { | ||||||
| 		$this->maniaControl = $maniaControl; | 		$this->maniaControl = $maniaControl; | ||||||
|  |  | ||||||
| 		$this->maniaControl->commandManager->registerCommandListener('me', $this, 'chat_me', false, 'Can be used to express your feelings/ideas.'); | 		// Chat commands | ||||||
| 		$this->maniaControl->commandManager->registerCommandListener('hi', $this, 'chat_hi', false, 'Writes an hello message to the chat.'); | 		$this->maniaControl->getCommandManager()->registerCommandListener('me', $this, 'chat_me', false, 'Can be used to express your feelings/ideas.'); | ||||||
| 		$this->maniaControl->commandManager->registerCommandListener(array('bb', 'bye'), $this, 'chat_bye', false, 'Writes a goodbye message to the chat.'); | 		$this->maniaControl->getCommandManager()->registerCommandListener('hi', $this, 'chat_hi', false, 'Writes an hello message to the chat.'); | ||||||
| 		$this->maniaControl->commandManager->registerCommandListener('thx', $this, 'chat_thx', false, 'Writes a thanks message to the chat.'); | 		$this->maniaControl->getCommandManager()->registerCommandListener(array('bb', 'bye'), $this, 'chat_bye', false, 'Writes a goodbye message to the chat.'); | ||||||
| 		$this->maniaControl->commandManager->registerCommandListener('gg', $this, 'chat_gg', false, 'Writes a good game message to the chat.'); | 		$this->maniaControl->getCommandManager()->registerCommandListener('thx', $this, 'chat_thx', false, 'Writes a thanks message to the chat.'); | ||||||
| 		$this->maniaControl->commandManager->registerCommandListener('gl', $this, 'chat_gl', false, 'Writes a good luck message to the chat.'); | 		$this->maniaControl->getCommandManager()->registerCommandListener('gg', $this, 'chat_gg', false, 'Writes a good game message to the chat.'); | ||||||
| 		$this->maniaControl->commandManager->registerCommandListener('hf', $this, 'chat_hf', false, 'Writes an have fun message to the chat.'); | 		$this->maniaControl->getCommandManager()->registerCommandListener('gl', $this, 'chat_gl', false, 'Writes a good luck message to the chat.'); | ||||||
| 		$this->maniaControl->commandManager->registerCommandListener('glhf', $this, 'chat_glhf', false, 'Writes a good luck, have fun message to the chat.'); | 		$this->maniaControl->getCommandManager()->registerCommandListener('hf', $this, 'chat_hf', false, 'Writes an have fun message to the chat.'); | ||||||
| 		$this->maniaControl->commandManager->registerCommandListener('ns', $this, 'chat_ns', false, 'Writes a nice shot message to the chat.'); | 		$this->maniaControl->getCommandManager()->registerCommandListener('glhf', $this, 'chat_glhf', false, 'Writes a good luck, have fun message to the chat.'); | ||||||
| 		$this->maniaControl->commandManager->registerCommandListener('n1', $this, 'chat_n1', false, 'Writes a nice one message to the chat.'); | 		$this->maniaControl->getCommandManager()->registerCommandListener('ns', $this, 'chat_ns', false, 'Writes a nice shot message to the chat.'); | ||||||
| 		$this->maniaControl->commandManager->registerCommandListener('lol', $this, 'chat_lol', false, 'Writes a lol message to the chat.'); | 		$this->maniaControl->getCommandManager()->registerCommandListener('n1', $this, 'chat_n1', false, 'Writes a nice one message to the chat.'); | ||||||
| 		$this->maniaControl->commandManager->registerCommandListener('lool', $this, 'chat_lool', false, 'Writes a lool message to the chat.'); | 		$this->maniaControl->getCommandManager()->registerCommandListener('lol', $this, 'chat_lol', false, 'Writes a lol message to the chat.'); | ||||||
| 		$this->maniaControl->commandManager->registerCommandListener('brb', $this, 'chat_brb', false, 'Writes a be right back message to the chat.'); | 		$this->maniaControl->getCommandManager()->registerCommandListener('lool', $this, 'chat_lool', false, 'Writes a lool message to the chat.'); | ||||||
| 		$this->maniaControl->commandManager->registerCommandListener('bgm', $this, 'chat_bgm', false, 'Writes a bad game for me message to the chat.'); | 		$this->maniaControl->getCommandManager()->registerCommandListener('brb', $this, 'chat_brb', false, 'Writes a be right back message to the chat.'); | ||||||
| 		$this->maniaControl->commandManager->registerCommandListener('afk', $this, 'chat_afk', false, 'Writes an away from keyboard message to the chat.'); | 		$this->maniaControl->getCommandManager()->registerCommandListener('bgm', $this, 'chat_bgm', false, 'Writes a bad game for me message to the chat.'); | ||||||
| 		$this->maniaControl->commandManager->registerCommandListener(array('bm', 'bootme'), $this, 'chat_bootme', false, 'Gets you away from this server quickly!'); | 		$this->maniaControl->getCommandManager()->registerCommandListener('afk', $this, 'chat_afk', false, 'Writes an away from keyboard message to the chat.'); | ||||||
| 		$this->maniaControl->commandManager->registerCommandListener(array('rq', 'ragequit'), $this, 'chat_ragequit', false, 'Gets you away from this server in rage!'); | 		$this->maniaControl->getCommandManager()->registerCommandListener(array('bm', 'bootme'), $this, 'chat_bootme', false, 'Gets you away from this server quickly!'); | ||||||
|  | 		$this->maniaControl->getCommandManager()->registerCommandListener(array('rq', 'ragequit'), $this, 'chat_ragequit', false, 'Gets you away from this server in rage!'); | ||||||
| 		//TODO block command listener for muted people | 		//TODO block command listener for muted people | ||||||
| 		$this->maniaControl->settingManager->initSetting($this, self::SETTING_AFK_FORCE_SPEC, true); | 		$this->maniaControl->getSettingManager()->initSetting($this, self::SETTING_AFK_FORCE_SPEC, true); | ||||||
|  |  | ||||||
| 		return true; | 		return true; | ||||||
| 	} | 	} | ||||||
| @@ -118,7 +119,7 @@ class ChatMessagePlugin implements CommandListener, Plugin { | |||||||
| 		$message = substr($chat[1][2], 4); | 		$message = substr($chat[1][2], 4); | ||||||
|  |  | ||||||
| 		$msg = '$<' . $player->nickname . '$>$s$i$fa0 ' . $message; | 		$msg = '$<' . $player->nickname . '$>$s$i$fa0 ' . $message; | ||||||
| 		$this->maniaControl->chat->sendChat($msg, null, false); | 		$this->maniaControl->getChat()->sendChat($msg, null, false); | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	/** | 	/** | ||||||
| @@ -135,7 +136,7 @@ class ChatMessagePlugin implements CommandListener, Plugin { | |||||||
| 		} else { | 		} else { | ||||||
| 			$msg = '$ff0[$<' . $player->nickname . '$>] $ff0$iHello All!'; | 			$msg = '$ff0[$<' . $player->nickname . '$>] $ff0$iHello All!'; | ||||||
| 		} | 		} | ||||||
| 		$this->maniaControl->chat->sendChat($msg, null, false); | 		$this->maniaControl->getChat()->sendChat($msg, null, false); | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	/** | 	/** | ||||||
| @@ -147,7 +148,7 @@ class ChatMessagePlugin implements CommandListener, Plugin { | |||||||
| 	 */ | 	 */ | ||||||
| 	private function getTarget($login) { | 	private function getTarget($login) { | ||||||
| 		$player = null; | 		$player = null; | ||||||
| 		foreach ($this->maniaControl->playerManager->getPlayers() as $player) { | 		foreach ($this->maniaControl->getPlayerManager()->getPlayers() as $player) { | ||||||
| 			if ($login == $player || $login == $player->login || $login == $player->pid || $login == $player->nickname) { | 			if ($login == $player || $login == $player->login || $login == $player->pid || $login == $player->nickname) { | ||||||
| 				return $player->nickname; | 				return $player->nickname; | ||||||
| 			} | 			} | ||||||
| @@ -176,7 +177,7 @@ class ChatMessagePlugin implements CommandListener, Plugin { | |||||||
| 			$msg = '$ff0[$<' . $player->nickname . '$>] $ff0$iI have to go... Bye All!'; | 			$msg = '$ff0[$<' . $player->nickname . '$>] $ff0$iI have to go... Bye All!'; | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
| 		$this->maniaControl->chat->sendChat($msg, null, false); | 		$this->maniaControl->getChat()->sendChat($msg, null, false); | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	/** | 	/** | ||||||
| @@ -194,7 +195,7 @@ class ChatMessagePlugin implements CommandListener, Plugin { | |||||||
| 			$msg = '$ff0[$<' . $player->nickname . '$>] $ff0$iThanks All!'; | 			$msg = '$ff0[$<' . $player->nickname . '$>] $ff0$iThanks All!'; | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
| 		$this->maniaControl->chat->sendChat($msg, null, false); | 		$this->maniaControl->getChat()->sendChat($msg, null, false); | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	/** | 	/** | ||||||
| @@ -207,12 +208,12 @@ class ChatMessagePlugin implements CommandListener, Plugin { | |||||||
| 		$command = explode(" ", $chat[1][2]); | 		$command = explode(" ", $chat[1][2]); | ||||||
|  |  | ||||||
| 		if (isset($command[1])) { | 		if (isset($command[1])) { | ||||||
| 			$msg = '$ff0[$<' . $player->nickname . '$>] $ff0$iGood Game $z$<' . $this->getTarget($command[1]) . '$>$i!'; | 			$msg = '$ff0[' . $player->getEscapedNickname(). '] $ff0$iGood Game $z$<' . $this->getTarget($command[1]) . '$>$i!'; | ||||||
| 		} else { | 		} else { | ||||||
| 			$msg = '$ff0[$<' . $player->nickname . '$>] $ff0$iGood Game All!'; | 			$msg = '$ff0[' . $player->getEscapedNickname() . '] $ff0$iGood Game All!'; | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
| 		$this->maniaControl->chat->sendChat($msg, null, false); | 		$this->maniaControl->getChat()->sendChat($msg, null, false); | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	/** | 	/** | ||||||
| @@ -230,7 +231,7 @@ class ChatMessagePlugin implements CommandListener, Plugin { | |||||||
| 			$msg = '$ff0[$<' . $player->nickname . '$>] $ff0$iGood Luck All!'; | 			$msg = '$ff0[$<' . $player->nickname . '$>] $ff0$iGood Luck All!'; | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
| 		$this->maniaControl->chat->sendChat($msg, null, false); | 		$this->maniaControl->getChat()->sendChat($msg, null, false); | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	/** | 	/** | ||||||
| @@ -243,12 +244,12 @@ class ChatMessagePlugin implements CommandListener, Plugin { | |||||||
| 		$command = explode(" ", $chat[1][2]); | 		$command = explode(" ", $chat[1][2]); | ||||||
|  |  | ||||||
| 		if (isset($command[1])) { | 		if (isset($command[1])) { | ||||||
| 			$msg = '$ff0[$<' . $player->nickname . '$>] $ff0$iHave Fun $z$<' . $this->getTarget($command[1]) . '$>$i!'; | 			$msg = '$ff0[' . $player->getEscapedNickname(). '] $ff0$iHave Fun $z$<' . $this->getTarget($command[1]) . '$>$i!'; | ||||||
| 		} else { | 		} else { | ||||||
| 			$msg = '$ff0[$<' . $player->nickname . '$>] $ff0$iHave Fun All!'; | 			$msg = '$ff0[' . $player->getEscapedNickname(). '] $ff0$iHave Fun All!'; | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
| 		$this->maniaControl->chat->sendChat($msg, null, false); | 		$this->maniaControl->getChat()->sendChat($msg, null, false); | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	/** | 	/** | ||||||
| @@ -266,7 +267,7 @@ class ChatMessagePlugin implements CommandListener, Plugin { | |||||||
| 			$msg = '$ff0[$<' . $player->nickname . '$>] $ff0$iGood Luck and Have Fun All!'; | 			$msg = '$ff0[$<' . $player->nickname . '$>] $ff0$iGood Luck and Have Fun All!'; | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
| 		$this->maniaControl->chat->sendChat($msg, null, false); | 		$this->maniaControl->getChat()->sendChat($msg, null, false); | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	/** | 	/** | ||||||
| @@ -284,7 +285,7 @@ class ChatMessagePlugin implements CommandListener, Plugin { | |||||||
| 			$msg = '$ff0[$<' . $player->nickname . '$>] $ff0$iNice Shot!'; | 			$msg = '$ff0[$<' . $player->nickname . '$>] $ff0$iNice Shot!'; | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
| 		$this->maniaControl->chat->sendChat($msg, null, false); | 		$this->maniaControl->getChat()->sendChat($msg, null, false); | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	/** | 	/** | ||||||
| @@ -302,7 +303,7 @@ class ChatMessagePlugin implements CommandListener, Plugin { | |||||||
| 			$msg = '$ff0[$<' . $player->nickname . '$>] $ff0$iNice One!'; | 			$msg = '$ff0[$<' . $player->nickname . '$>] $ff0$iNice One!'; | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
| 		$this->maniaControl->chat->sendChat($msg, null, false); | 		$this->maniaControl->getChat()->sendChat($msg, null, false); | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	/** | 	/** | ||||||
| @@ -313,7 +314,7 @@ class ChatMessagePlugin implements CommandListener, Plugin { | |||||||
| 	 */ | 	 */ | ||||||
| 	public function chat_lol(array $chat, Player $player) { | 	public function chat_lol(array $chat, Player $player) { | ||||||
| 		$msg = '$ff0[$<' . $player->nickname . '$>] $ff0$iLoL!'; | 		$msg = '$ff0[$<' . $player->nickname . '$>] $ff0$iLoL!'; | ||||||
| 		$this->maniaControl->chat->sendChat($msg, null, false); | 		$this->maniaControl->getChat()->sendChat($msg, null, false); | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	/** | 	/** | ||||||
| @@ -324,7 +325,7 @@ class ChatMessagePlugin implements CommandListener, Plugin { | |||||||
| 	 */ | 	 */ | ||||||
| 	public function chat_lool(array $chat, Player $player) { | 	public function chat_lool(array $chat, Player $player) { | ||||||
| 		$msg = '$ff0[$<' . $player->nickname . '$>] $ff0$iLooOOooL!'; | 		$msg = '$ff0[$<' . $player->nickname . '$>] $ff0$iLooOOooL!'; | ||||||
| 		$this->maniaControl->chat->sendChat($msg, null, false); | 		$this->maniaControl->getChat()->sendChat($msg, null, false); | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	/** | 	/** | ||||||
| @@ -335,7 +336,7 @@ class ChatMessagePlugin implements CommandListener, Plugin { | |||||||
| 	 */ | 	 */ | ||||||
| 	public function chat_brb(array $chat, Player $player) { | 	public function chat_brb(array $chat, Player $player) { | ||||||
| 		$msg = '$ff0[$<' . $player->nickname . '$>] $ff0$iBe Right Back!'; | 		$msg = '$ff0[$<' . $player->nickname . '$>] $ff0$iBe Right Back!'; | ||||||
| 		$this->maniaControl->chat->sendChat($msg, null, false); | 		$this->maniaControl->getChat()->sendChat($msg, null, false); | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	/** | 	/** | ||||||
| @@ -346,7 +347,7 @@ class ChatMessagePlugin implements CommandListener, Plugin { | |||||||
| 	 */ | 	 */ | ||||||
| 	public function chat_bgm(array $chat, Player $player) { | 	public function chat_bgm(array $chat, Player $player) { | ||||||
| 		$msg = '$ff0[$<' . $player->nickname . '$>] $ff0$iBad Game for me :('; | 		$msg = '$ff0[$<' . $player->nickname . '$>] $ff0$iBad Game for me :('; | ||||||
| 		$this->maniaControl->chat->sendChat($msg, null, false); | 		$this->maniaControl->getChat()->sendChat($msg, null, false); | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	/** | 	/** | ||||||
| @@ -357,13 +358,13 @@ class ChatMessagePlugin implements CommandListener, Plugin { | |||||||
| 	 */ | 	 */ | ||||||
| 	public function chat_bootme(array $chat, Player $player) { | 	public function chat_bootme(array $chat, Player $player) { | ||||||
| 		$msg = '$i$ff0 $<' . $player->nickname . '$>$s$39f chooses to boot back to the real world!'; | 		$msg = '$i$ff0 $<' . $player->nickname . '$>$s$39f chooses to boot back to the real world!'; | ||||||
| 		$this->maniaControl->chat->sendChat($msg, null, true); | 		$this->maniaControl->getChat()->sendChat($msg, null, true); | ||||||
|  |  | ||||||
| 		$message = '$39F Thanks for Playing, see you around!$z'; | 		$message = '$39F Thanks for Playing, see you around!$z'; | ||||||
| 		try { | 		try { | ||||||
| 			$this->maniaControl->client->kick($player->login, $message); | 			$this->maniaControl->getClient()->kick($player->login, $message); | ||||||
| 		} catch (UnknownPlayerException $exception) { | 		} catch (UnknownPlayerException $exception) { | ||||||
| 			$this->maniaControl->chat->sendException($exception, $player); | 			$this->maniaControl->getChat()->sendException($exception, $player); | ||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| @@ -376,11 +377,11 @@ class ChatMessagePlugin implements CommandListener, Plugin { | |||||||
| 	public function chat_ragequit(array $chat, Player $player) { | 	public function chat_ragequit(array $chat, Player $player) { | ||||||
| 		try { | 		try { | ||||||
| 			$message = '$39F Thanks for Playing, please come back soon!$z '; | 			$message = '$39F Thanks for Playing, please come back soon!$z '; | ||||||
| 			$this->maniaControl->client->kick($player->login, $message); | 			$this->maniaControl->getClient()->kick($player->login, $message); | ||||||
| 			$msg = '$i$ff0 $<' . $player->nickname . '$>$s$f00 said: "@"#!" and ragequitted!'; | 			$msg = '$i$ff0 $<' . $player->nickname . '$>$s$f00 said: "@"#!" and ragequitted!'; | ||||||
| 			$this->maniaControl->chat->sendChat($msg, null, true); | 			$this->maniaControl->getChat()->sendChat($msg, null, true); | ||||||
| 		} catch (UnknownPlayerException $e) { | 		} catch (UnknownPlayerException $e) { | ||||||
| 			$this->maniaControl->chat->sendError('Error occurred: ' . $e->getMessage(), $player); | 			$this->maniaControl->getChat()->sendError('Error occurred: ' . $e->getMessage(), $player); | ||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| @@ -392,9 +393,9 @@ class ChatMessagePlugin implements CommandListener, Plugin { | |||||||
| 	 */ | 	 */ | ||||||
| 	public function chat_afk(array $chat, Player $player) { | 	public function chat_afk(array $chat, Player $player) { | ||||||
| 		$msg = '$ff0[$<' . $player->nickname . '$>] $ff0$iAway From Keyboard!'; | 		$msg = '$ff0[$<' . $player->nickname . '$>] $ff0$iAway From Keyboard!'; | ||||||
| 		$this->maniaControl->chat->sendChat($msg, null, false); | 		$this->maniaControl->getChat()->sendChat($msg, null, false); | ||||||
|  |  | ||||||
| 		if (!$this->maniaControl->settingManager->getSettingValue($this, self::SETTING_AFK_FORCE_SPEC)) { | 		if (!$this->maniaControl->getSettingManager()->getSettingValue($this, self::SETTING_AFK_FORCE_SPEC)) { | ||||||
| 			return; | 			return; | ||||||
| 		} | 		} | ||||||
| 		if ($player->isSpectator) { | 		if ($player->isSpectator) { | ||||||
| @@ -403,11 +404,11 @@ class ChatMessagePlugin implements CommandListener, Plugin { | |||||||
|  |  | ||||||
| 		try { | 		try { | ||||||
| 			// Force into spec | 			// Force into spec | ||||||
| 			$this->maniaControl->client->forceSpectator($player->login, 3); | 			$this->maniaControl->getClient()->forceSpectator($player->login, 3); | ||||||
| 			// Free player slot | 			// Free player slot | ||||||
| 			$this->maniaControl->client->spectatorReleasePlayerSlot($player->login); | 			$this->maniaControl->getClient()->spectatorReleasePlayerSlot($player->login); | ||||||
| 		} catch (UnknownPlayerException $exception) { | 		} catch (UnknownPlayerException $exception) { | ||||||
| 			$this->maniaControl->chat->sendException($exception, $player); | 			$this->maniaControl->getChat()->sendException($exception, $player); | ||||||
| 		} catch (PlayerStateException $exception) { | 		} catch (PlayerStateException $exception) { | ||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
|   | |||||||
| @@ -132,33 +132,36 @@ class CustomVotesPlugin implements CommandListener, CallbackListener, ManialinkP | |||||||
| 	public function load(ManiaControl $maniaControl) { | 	public function load(ManiaControl $maniaControl) { | ||||||
| 		$this->maniaControl = $maniaControl; | 		$this->maniaControl = $maniaControl; | ||||||
|  |  | ||||||
| 		$this->maniaControl->commandManager->registerCommandListener('vote', $this, 'chat_vote', false, 'Starts a new vote.'); | 		// Commands | ||||||
| 		$this->maniaControl->timerManager->registerTimerListening($this, 'handle1Second', 1000); | 		$this->maniaControl->getCommandManager()->registerCommandListener('vote', $this, 'chat_vote', false, 'Starts a new vote.'); | ||||||
| 		$this->maniaControl->callbackManager->registerCallbackListener(Commands::CB_VOTE_CANCELLED, $this, 'handleVoteCancelled'); |  | ||||||
| 		$this->maniaControl->manialinkManager->registerManialinkPageAnswerListener(self::ACTION_POSITIVE_VOTE, $this, 'handlePositiveVote'); |  | ||||||
| 		$this->maniaControl->manialinkManager->registerManialinkPageAnswerListener(self::ACTION_NEGATIVE_VOTE, $this, 'handleNegativeVote'); |  | ||||||
|  |  | ||||||
| 		$this->maniaControl->callbackManager->registerCallbackListener(CallbackManager::CB_MP_PLAYERMANIALINKPAGEANSWER, $this, 'handleManialinkPageAnswer'); | 		// Callbacks | ||||||
| 		$this->maniaControl->callbackManager->registerCallbackListener(self::CB_CUSTOM_VOTE_FINISHED, $this, 'handleVoteFinished'); | 		$this->maniaControl->getManialinkManager()->registerManialinkPageAnswerListener(self::ACTION_POSITIVE_VOTE, $this, 'handlePositiveVote'); | ||||||
| 		$this->maniaControl->callbackManager->registerCallbackListener(PlayerManager::CB_PLAYERCONNECT, $this, 'handlePlayerConnect'); | 		$this->maniaControl->getManialinkManager()->registerManialinkPageAnswerListener(self::ACTION_NEGATIVE_VOTE, $this, 'handleNegativeVote'); | ||||||
| 		$this->maniaControl->callbackManager->registerCallbackListener(Server::CB_TEAM_MODE_CHANGED, $this, 'constructMenu'); | 		$this->maniaControl->getTimerManager()->registerTimerListening($this, 'handle1Second', 1000); | ||||||
|  | 		$this->maniaControl->getCallbackManager()->registerCallbackListener(Commands::CB_VOTE_CANCELLED, $this, 'handleVoteCancelled'); | ||||||
|  |  | ||||||
| 		//Settings | 		$this->maniaControl->getCallbackManager()->registerCallbackListener(CallbackManager::CB_MP_PLAYERMANIALINKPAGEANSWER, $this, 'handleManialinkPageAnswer'); | ||||||
| 		$this->maniaControl->settingManager->initSetting($this, self::SETTING_VOTE_ICON_POSX, 156.); | 		$this->maniaControl->getCallbackManager()->registerCallbackListener(self::CB_CUSTOM_VOTE_FINISHED, $this, 'handleVoteFinished'); | ||||||
| 		$this->maniaControl->settingManager->initSetting($this, self::SETTING_VOTE_ICON_POSY, -38.6); | 		$this->maniaControl->getCallbackManager()->registerCallbackListener(PlayerManager::CB_PLAYERCONNECT, $this, 'handlePlayerConnect'); | ||||||
| 		$this->maniaControl->settingManager->initSetting($this, self::SETTING_VOTE_ICON_WIDTH, 6); | 		$this->maniaControl->getCallbackManager()->registerCallbackListener(Server::CB_TEAM_MODE_CHANGED, $this, 'constructMenu'); | ||||||
| 		$this->maniaControl->settingManager->initSetting($this, self::SETTING_VOTE_ICON_HEIGHT, 6); |  | ||||||
|  |  | ||||||
| 		$this->maniaControl->settingManager->initSetting($this, self::SETTING_WIDGET_POSX, -80); //160 -15 | 		// Settings | ||||||
| 		$this->maniaControl->settingManager->initSetting($this, self::SETTING_WIDGET_POSY, 80); //-15 | 		$this->maniaControl->getSettingManager()->initSetting($this, self::SETTING_VOTE_ICON_POSX, 156.); | ||||||
| 		$this->maniaControl->settingManager->initSetting($this, self::SETTING_WIDGET_WIDTH, 50); //30 | 		$this->maniaControl->getSettingManager()->initSetting($this, self::SETTING_VOTE_ICON_POSY, -38.6); | ||||||
| 		$this->maniaControl->settingManager->initSetting($this, self::SETTING_WIDGET_HEIGHT, 20); //25 | 		$this->maniaControl->getSettingManager()->initSetting($this, self::SETTING_VOTE_ICON_WIDTH, 6); | ||||||
|  | 		$this->maniaControl->getSettingManager()->initSetting($this, self::SETTING_VOTE_ICON_HEIGHT, 6); | ||||||
|  |  | ||||||
| 		$this->maniaControl->settingManager->initSetting($this, self::SETTING_DEFAULT_RATIO, 0.75); | 		$this->maniaControl->getSettingManager()->initSetting($this, self::SETTING_WIDGET_POSX, -80); //160 -15 | ||||||
| 		$this->maniaControl->settingManager->initSetting($this, self::SETTING_DEFAULT_PLAYER_RATIO, 0.65); | 		$this->maniaControl->getSettingManager()->initSetting($this, self::SETTING_WIDGET_POSY, 80); //-15 | ||||||
| 		$this->maniaControl->settingManager->initSetting($this, self::SETTING_SPECTATOR_ALLOW_VOTE, false); | 		$this->maniaControl->getSettingManager()->initSetting($this, self::SETTING_WIDGET_WIDTH, 50); //30 | ||||||
| 		$this->maniaControl->settingManager->initSetting($this, self::SETTING_SPECTATOR_ALLOW_START_VOTE, true); | 		$this->maniaControl->getSettingManager()->initSetting($this, self::SETTING_WIDGET_HEIGHT, 20); //25 | ||||||
| 		$this->maniaControl->settingManager->initSetting($this, self::SETTING_VOTE_TIME, 40); |  | ||||||
|  | 		$this->maniaControl->getSettingManager()->initSetting($this, self::SETTING_DEFAULT_RATIO, 0.75); | ||||||
|  | 		$this->maniaControl->getSettingManager()->initSetting($this, self::SETTING_DEFAULT_PLAYER_RATIO, 0.65); | ||||||
|  | 		$this->maniaControl->getSettingManager()->initSetting($this, self::SETTING_SPECTATOR_ALLOW_VOTE, false); | ||||||
|  | 		$this->maniaControl->getSettingManager()->initSetting($this, self::SETTING_SPECTATOR_ALLOW_START_VOTE, true); | ||||||
|  | 		$this->maniaControl->getSettingManager()->initSetting($this, self::SETTING_VOTE_TIME, 40); | ||||||
|  |  | ||||||
| 		//Define Votes | 		//Define Votes | ||||||
| 		$this->defineVote("teambalance", "Vote for Team Balance"); | 		$this->defineVote("teambalance", "Vote for Team Balance"); | ||||||
| @@ -176,7 +179,7 @@ class CustomVotesPlugin implements CommandListener, CallbackListener, ManialinkP | |||||||
| 		$this->defineVote("replay", "Vote to replay current map"); | 		$this->defineVote("replay", "Vote to replay current map"); | ||||||
|  |  | ||||||
| 		foreach ($this->voteCommands as $name => $voteCommand) { | 		foreach ($this->voteCommands as $name => $voteCommand) { | ||||||
| 			$this->maniaControl->commandManager->registerCommandListener($name, $this, 'handleChatVote', false, $voteCommand->name); | 			$this->maniaControl->getCommandManager()->registerCommandListener($name, $this, 'handleChatVote', false, $voteCommand->name); | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
| 		/* Disable Standard Votes */ | 		/* Disable Standard Votes */ | ||||||
| @@ -186,7 +189,7 @@ class CustomVotesPlugin implements CommandListener, CallbackListener, ManialinkP | |||||||
| 		$ratioArray[] = new VoteRatio(VoteRatio::COMMAND_TEAM_BALANCE, -1.); | 		$ratioArray[] = new VoteRatio(VoteRatio::COMMAND_TEAM_BALANCE, -1.); | ||||||
| 		$ratioArray[] = new VoteRatio(VoteRatio::COMMAND_NEXT_MAP, -1.); | 		$ratioArray[] = new VoteRatio(VoteRatio::COMMAND_NEXT_MAP, -1.); | ||||||
|  |  | ||||||
| 		$this->maniaControl->client->setCallVoteRatios($ratioArray, false); | 		$this->maniaControl->getClient()->setCallVoteRatios($ratioArray, false); | ||||||
|  |  | ||||||
| 		$this->constructMenu(); | 		$this->constructMenu(); | ||||||
| 		return true; | 		return true; | ||||||
| @@ -204,7 +207,7 @@ class CustomVotesPlugin implements CommandListener, CallbackListener, ManialinkP | |||||||
| 	 */ | 	 */ | ||||||
| 	public function defineVote($voteIndex, $voteName, $idBased = false, $startText = '', $neededRatio = -1) { | 	public function defineVote($voteIndex, $voteName, $idBased = false, $startText = '', $neededRatio = -1) { | ||||||
| 		if ($neededRatio < 0) { | 		if ($neededRatio < 0) { | ||||||
| 			$neededRatio = $this->maniaControl->settingManager->getSettingValue($this, self::SETTING_DEFAULT_RATIO); | 			$neededRatio = $this->maniaControl->getSettingManager()->getSettingValue($this, self::SETTING_DEFAULT_RATIO); | ||||||
| 		} | 		} | ||||||
| 		$voteCommand                    = new VoteCommand($voteIndex, $voteName, $idBased, $neededRatio); | 		$voteCommand                    = new VoteCommand($voteIndex, $voteName, $idBased, $neededRatio); | ||||||
| 		$voteCommand->startText         = $startText; | 		$voteCommand->startText         = $startText; | ||||||
| @@ -227,7 +230,7 @@ class CustomVotesPlugin implements CommandListener, CallbackListener, ManialinkP | |||||||
|  |  | ||||||
| 		//Check if Pause exists in current GameMode | 		//Check if Pause exists in current GameMode | ||||||
| 		try { | 		try { | ||||||
| 			$scriptInfos = $this->maniaControl->client->getModeScriptInfo(); | 			$scriptInfos = $this->maniaControl->getClient()->getModeScriptInfo(); | ||||||
|  |  | ||||||
| 			$pauseExists = false; | 			$pauseExists = false; | ||||||
| 			foreach ($scriptInfos->commandDescs as $param) { | 			foreach ($scriptInfos->commandDescs as $param) { | ||||||
| @@ -253,7 +256,7 @@ class CustomVotesPlugin implements CommandListener, CallbackListener, ManialinkP | |||||||
| 		$itemQuad->setAction(self::ACTION_START_VOTE . 'skipmap'); | 		$itemQuad->setAction(self::ACTION_START_VOTE . 'skipmap'); | ||||||
| 		$this->addVoteMenuItem($itemQuad, 15, 'Vote for a Map Skip'); | 		$this->addVoteMenuItem($itemQuad, 15, 'Vote for a Map Skip'); | ||||||
|  |  | ||||||
| 		if ($this->maniaControl->server->isTeamMode()) { | 		if ($this->maniaControl->getServer()->isTeamMode()) { | ||||||
| 			//Menu TeamBalance | 			//Menu TeamBalance | ||||||
| 			$itemQuad = new Quad_Icons128x32_1(); | 			$itemQuad = new Quad_Icons128x32_1(); | ||||||
| 			$itemQuad->setSubStyle($itemQuad::SUBSTYLE_RT_Team); | 			$itemQuad->setSubStyle($itemQuad::SUBSTYLE_RT_Team); | ||||||
| @@ -285,18 +288,18 @@ class CustomVotesPlugin implements CommandListener, CallbackListener, ManialinkP | |||||||
| 	 * @param bool $login | 	 * @param bool $login | ||||||
| 	 */ | 	 */ | ||||||
| 	private function showIcon($login = false) { | 	private function showIcon($login = false) { | ||||||
| 		$posX              = $this->maniaControl->settingManager->getSettingValue($this, self::SETTING_VOTE_ICON_POSX); | 		$posX              = $this->maniaControl->getSettingManager()->getSettingValue($this, self::SETTING_VOTE_ICON_POSX); | ||||||
| 		$posY              = $this->maniaControl->settingManager->getSettingValue($this, self::SETTING_VOTE_ICON_POSY); | 		$posY              = $this->maniaControl->getSettingManager()->getSettingValue($this, self::SETTING_VOTE_ICON_POSY); | ||||||
| 		$width             = $this->maniaControl->settingManager->getSettingValue($this, self::SETTING_VOTE_ICON_WIDTH); | 		$width             = $this->maniaControl->getSettingManager()->getSettingValue($this, self::SETTING_VOTE_ICON_WIDTH); | ||||||
| 		$height            = $this->maniaControl->settingManager->getSettingValue($this, self::SETTING_VOTE_ICON_HEIGHT); | 		$height            = $this->maniaControl->getSettingManager()->getSettingValue($this, self::SETTING_VOTE_ICON_HEIGHT); | ||||||
| 		$shootManiaOffset  = $this->maniaControl->manialinkManager->getStyleManager()->getDefaultIconOffsetSM(); | 		$shootManiaOffset  = $this->maniaControl->getManialinkManager()->getStyleManager()->getDefaultIconOffsetSM(); | ||||||
| 		$quadStyle         = $this->maniaControl->manialinkManager->getStyleManager()->getDefaultQuadStyle(); | 		$quadStyle         = $this->maniaControl->getManialinkManager()->getStyleManager()->getDefaultQuadStyle(); | ||||||
| 		$quadSubstyle      = $this->maniaControl->manialinkManager->getStyleManager()->getDefaultQuadSubstyle(); | 		$quadSubstyle      = $this->maniaControl->getManialinkManager()->getStyleManager()->getDefaultQuadSubstyle(); | ||||||
| 		$itemMarginFactorX = 1.3; | 		$itemMarginFactorX = 1.3; | ||||||
| 		$itemMarginFactorY = 1.2; | 		$itemMarginFactorY = 1.2; | ||||||
|  |  | ||||||
| 		//If game is shootmania lower the icons position by 20 | 		//If game is shootmania lower the icons position by 20 | ||||||
| 		if ($this->maniaControl->mapManager->getCurrentMap() | 		if ($this->maniaControl->getMapManager()->getCurrentMap() | ||||||
| 		                                   ->getGame() === 'sm' | 		                                   ->getGame() === 'sm' | ||||||
| 		) { | 		) { | ||||||
| 			$posY -= $shootManiaOffset; | 			$posY -= $shootManiaOffset; | ||||||
| @@ -376,7 +379,7 @@ class CustomVotesPlugin implements CommandListener, CallbackListener, ManialinkP | |||||||
|  |  | ||||||
|  |  | ||||||
| 		// Send manialink | 		// Send manialink | ||||||
| 		$this->maniaControl->manialinkManager->sendManialink($maniaLink, $login); | 		$this->maniaControl->getManialinkManager()->sendManialink($maniaLink, $login); | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	/** | 	/** | ||||||
| @@ -384,7 +387,7 @@ class CustomVotesPlugin implements CommandListener, CallbackListener, ManialinkP | |||||||
| 	 */ | 	 */ | ||||||
| 	public function unload() { | 	public function unload() { | ||||||
| 		//Enable Standard Votes | 		//Enable Standard Votes | ||||||
| 		$defaultRatio = $this->maniaControl->client->getCallVoteRatio(); | 		$defaultRatio = $this->maniaControl->getClient()->getCallVoteRatio(); | ||||||
|  |  | ||||||
| 		$ratioArray[] = new VoteRatio(VoteRatio::COMMAND_BAN, $defaultRatio); | 		$ratioArray[] = new VoteRatio(VoteRatio::COMMAND_BAN, $defaultRatio); | ||||||
| 		$ratioArray[] = new VoteRatio(VoteRatio::COMMAND_KICK, $defaultRatio); | 		$ratioArray[] = new VoteRatio(VoteRatio::COMMAND_KICK, $defaultRatio); | ||||||
| @@ -392,10 +395,10 @@ class CustomVotesPlugin implements CommandListener, CallbackListener, ManialinkP | |||||||
| 		$ratioArray[] = new VoteRatio(VoteRatio::COMMAND_TEAM_BALANCE, $defaultRatio); | 		$ratioArray[] = new VoteRatio(VoteRatio::COMMAND_TEAM_BALANCE, $defaultRatio); | ||||||
| 		$ratioArray[] = new VoteRatio(VoteRatio::COMMAND_NEXT_MAP, $defaultRatio); | 		$ratioArray[] = new VoteRatio(VoteRatio::COMMAND_NEXT_MAP, $defaultRatio); | ||||||
|  |  | ||||||
| 		$this->maniaControl->client->setCallVoteRatios($ratioArray, false); | 		$this->maniaControl->getClient()->setCallVoteRatios($ratioArray, false); | ||||||
|  |  | ||||||
| 		$this->destroyVote(); | 		$this->destroyVote(); | ||||||
| 		$this->maniaControl->manialinkManager->hideManialink(self::MLID_ICON); | 		$this->maniaControl->getManialinkManager()->hideManialink(self::MLID_ICON); | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	/** | 	/** | ||||||
| @@ -403,11 +406,11 @@ class CustomVotesPlugin implements CommandListener, CallbackListener, ManialinkP | |||||||
| 	 */ | 	 */ | ||||||
| 	private function destroyVote() { | 	private function destroyVote() { | ||||||
| 		$emptyManialink = new ManiaLink(self::MLID_WIDGET); | 		$emptyManialink = new ManiaLink(self::MLID_WIDGET); | ||||||
| 		$this->maniaControl->manialinkManager->sendManialink($emptyManialink); | 		$this->maniaControl->getManialinkManager()->sendManialink($emptyManialink); | ||||||
|  |  | ||||||
| 		//Remove the Listener for the Stop Callback if a stop callback is defined | 		// Remove the Listener for the Stop Callback if a stop callback is defined | ||||||
| 		if ($this->currentVote && $this->currentVote->stopCallback) { | 		if ($this->currentVote && $this->currentVote->stopCallback) { | ||||||
| 			$this->maniaControl->callbackManager->unregisterCallbackListening($this->currentVote->stopCallback, $this); | 			$this->maniaControl->getCallbackManager()->unregisterCallbackListening($this->currentVote->stopCallback, $this); | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
| 		$this->currentVote = null; | 		$this->currentVote = null; | ||||||
| @@ -446,51 +449,51 @@ class CustomVotesPlugin implements CommandListener, CallbackListener, ManialinkP | |||||||
| 	 */ | 	 */ | ||||||
| 	public function startVote(Player $player, $voteIndex, $function = null) { | 	public function startVote(Player $player, $voteIndex, $function = null) { | ||||||
| 		//Player is muted | 		//Player is muted | ||||||
| 		if ($this->maniaControl->playerManager->getPlayerActions()->isPlayerMuted($player)) { | 		if ($this->maniaControl->getPlayerManager()->getPlayerActions()->isPlayerMuted($player)) { | ||||||
| 			$this->maniaControl->chat->sendError('Muted Players are not allowed to start a vote.', $player->login); | 			$this->maniaControl->getChat()->sendError('Muted Players are not allowed to start a vote.', $player); | ||||||
| 			return; | 			return; | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
| 		// Spectators are not allowed to start a vote | 		// Spectators are not allowed to start a vote | ||||||
| 		if ($player->isSpectator && !$this->maniaControl->settingManager->getSettingValue($this, self::SETTING_SPECTATOR_ALLOW_START_VOTE)) { | 		if ($player->isSpectator && !$this->maniaControl->getSettingManager()->getSettingValue($this, self::SETTING_SPECTATOR_ALLOW_START_VOTE)) { | ||||||
| 			$this->maniaControl->chat->sendError('Spectators are not allowed to start a vote.', $player->login); | 			$this->maniaControl->getChat()->sendError('Spectators are not allowed to start a vote.', $player); | ||||||
| 			return; | 			return; | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
| 		//Vote does not exist | 		//Vote does not exist | ||||||
| 		if (!isset($this->voteCommands[$voteIndex])) { | 		if (!isset($this->voteCommands[$voteIndex])) { | ||||||
| 			$this->maniaControl->chat->sendError('Undefined vote.', $player->login); | 			$this->maniaControl->getChat()->sendError('Undefined vote.', $player); | ||||||
| 			return; | 			return; | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
| 		//A vote is currently running | 		//A vote is currently running | ||||||
| 		if (isset($this->currentVote)) { | 		if (isset($this->currentVote)) { | ||||||
| 			$this->maniaControl->chat->sendError('There is currently another vote running.', $player->login); | 			$this->maniaControl->getChat()->sendError('There is currently another vote running.', $player); | ||||||
| 			return; | 			return; | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
| 		$maxTime = $this->maniaControl->settingManager->getSettingValue($this, self::SETTING_VOTE_TIME); | 		$maxTime = $this->maniaControl->getSettingManager()->getSettingValue($this, self::SETTING_VOTE_TIME); | ||||||
|  |  | ||||||
| 		/** @var VoteCommand $voteCommand */ | 		/** @var VoteCommand $voteCommand */ | ||||||
| 		$voteCommand = $this->voteCommands[$voteIndex]; | 		$voteCommand = $this->voteCommands[$voteIndex]; | ||||||
|  |  | ||||||
| 		$this->currentVote                    = new CurrentVote($voteCommand, $player, time() + $maxTime); | 		$this->currentVote                    = new CurrentVote($voteCommand, $player, time() + $maxTime); | ||||||
| 		$this->currentVote->neededRatio       = floatval($this->maniaControl->settingManager->getSettingValue($this, self::SETTING_DEFAULT_RATIO)); | 		$this->currentVote->neededRatio       = floatval($this->maniaControl->getSettingManager()->getSettingValue($this, self::SETTING_DEFAULT_RATIO)); | ||||||
| 		$this->currentVote->neededPlayerRatio = floatval($this->maniaControl->settingManager->getSettingValue($this, self::SETTING_DEFAULT_PLAYER_RATIO)); | 		$this->currentVote->neededPlayerRatio = floatval($this->maniaControl->getSettingManager()->getSettingValue($this, self::SETTING_DEFAULT_PLAYER_RATIO)); | ||||||
| 		$this->currentVote->function          = $function; | 		$this->currentVote->function          = $function; | ||||||
|  |  | ||||||
| 		if ($voteCommand->getStopCallback()) { | 		if ($voteCommand->getStopCallback()) { | ||||||
| 			$this->maniaControl->callbackManager->registerCallbackListener($voteCommand->getStopCallback(), $this, 'handleStopCallback'); | 			$this->maniaControl->getCallbackManager()->registerCallbackListener($voteCommand->getStopCallback(), $this, 'handleStopCallback'); | ||||||
| 			$this->currentVote->stopCallback = $voteCommand->getStopCallback(); | 			$this->currentVote->stopCallback = $voteCommand->getStopCallback(); | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
| 		if ($this->currentVote->voteCommand->startText) { | 		if ($this->currentVote->voteCommand->startText) { | ||||||
| 			$message = $this->currentVote->voteCommand->startText; | 			$message = $this->currentVote->voteCommand->startText; | ||||||
| 		} else { | 		} else { | ||||||
| 			$message = '$fff$<' . $player->nickname . '$>$s$f8f started a $fff$<' . $this->currentVote->voteCommand->name . '$>$f8f!'; | 			$message = '$fff' . $player->getEscapedNickname() . '$s$f8f started a $fff$<' . $this->currentVote->voteCommand->name . '$>$f8f!'; | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
| 		$this->maniaControl->chat->sendSuccess($message); | 		$this->maniaControl->getChat()->sendSuccess($message); | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	/** | 	/** | ||||||
| @@ -523,37 +526,37 @@ class CustomVotesPlugin implements CommandListener, CallbackListener, ManialinkP | |||||||
|  |  | ||||||
| 			switch ($voteName) { | 			switch ($voteName) { | ||||||
| 				case 'teambalance': | 				case 'teambalance': | ||||||
| 					$this->maniaControl->client->autoTeamBalance(); | 					$this->maniaControl->getClient()->autoTeamBalance(); | ||||||
| 					$this->maniaControl->chat->sendInformation('$f8fVote to $fffbalance the Teams$f8f has been successful!'); | 					$this->maniaControl->getChat()->sendInformation('$f8fVote to $fffbalance the Teams$f8f has been successful!'); | ||||||
| 					break; | 					break; | ||||||
| 				case 'skipmap': | 				case 'skipmap': | ||||||
| 				case 'skip': | 				case 'skip': | ||||||
| 				case 'nextmap': | 				case 'nextmap': | ||||||
| 					try { | 					try { | ||||||
| 						$this->maniaControl->mapManager->getMapActions()->skipMap(); | 						$this->maniaControl->getMapManager()->getMapActions()->skipMap(); | ||||||
| 					} catch (ChangeInProgressException $e) { | 					} catch (ChangeInProgressException $e) { | ||||||
| 					} | 					} | ||||||
| 					$this->maniaControl->chat->sendInformation('$f8fVote to $fffskip the Map$f8f has been successful!'); | 					$this->maniaControl->getChat()->sendInformation('$f8fVote to $fffskip the Map$f8f has been successful!'); | ||||||
| 					break; | 					break; | ||||||
| 				case 'restartmap': | 				case 'restartmap': | ||||||
| 					try { | 					try { | ||||||
| 						$this->maniaControl->client->restartMap(); | 						$this->maniaControl->getClient()->restartMap(); | ||||||
| 					} catch (ChangeInProgressException $e) { | 					} catch (ChangeInProgressException $e) { | ||||||
| 					} | 					} | ||||||
| 					$this->maniaControl->chat->sendInformation('$f8fVote to $fffrestart the Map$f8f has been successful!'); | 					$this->maniaControl->getChat()->sendInformation('$f8fVote to $fffrestart the Map$f8f has been successful!'); | ||||||
| 					break; | 					break; | ||||||
| 				case 'pausegame': | 				case 'pausegame': | ||||||
| 					$this->maniaControl->client->sendModeScriptCommands(array('Command_ForceWarmUp' => true)); | 					$this->maniaControl->getClient()->sendModeScriptCommands(array('Command_ForceWarmUp' => true)); | ||||||
| 					$this->maniaControl->chat->sendInformation('$f8fVote to $fffpause the current Game$f8f has been successful!'); | 					$this->maniaControl->getChat()->sendInformation('$f8fVote to $fffpause the current Game$f8f has been successful!'); | ||||||
| 					break; | 					break; | ||||||
| 				case 'replay': | 				case 'replay': | ||||||
| 					$this->maniaControl->mapManager->getMapQueue()->addFirstMapToMapQueue($this->currentVote->voter, $this->maniaControl->mapManager->getCurrentMap()); | 					$this->maniaControl->getMapManager()->getMapQueue()->addFirstMapToMapQueue($this->currentVote->voter, $this->maniaControl->getMapManager()->getCurrentMap()); | ||||||
| 					$this->maniaControl->chat->sendInformation('$f8fVote to $fffreplay the Map$f8f has been successful!'); | 					$this->maniaControl->getChat()->sendInformation('$f8fVote to $fffreplay the Map$f8f has been successful!'); | ||||||
| 					break; | 					break; | ||||||
| 			} | 			} | ||||||
| 		} else { | 		} else { | ||||||
| 			//FIXME bugreport, no fail message on vote fail sometimes | 			//FIXME bugreport, no fail message on vote fail sometimes | ||||||
| 			$this->maniaControl->chat->sendError('Vote Failed!'); | 			$this->maniaControl->getChat()->sendError('Vote Failed!'); | ||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| @@ -572,7 +575,7 @@ class CustomVotesPlugin implements CommandListener, CallbackListener, ManialinkP | |||||||
| 		$voteIndex = $actionArray[2]; | 		$voteIndex = $actionArray[2]; | ||||||
| 		if (isset($this->voteCommands[$voteIndex])) { | 		if (isset($this->voteCommands[$voteIndex])) { | ||||||
| 			$login  = $callback[1][1]; | 			$login  = $callback[1][1]; | ||||||
| 			$player = $this->maniaControl->playerManager->getPlayer($login); | 			$player = $this->maniaControl->getPlayerManager()->getPlayer($login); | ||||||
| 			$this->startVote($player, $voteIndex); | 			$this->startVote($player, $voteIndex); | ||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
| @@ -609,7 +612,7 @@ class CustomVotesPlugin implements CommandListener, CallbackListener, ManialinkP | |||||||
| 	 * @param Player $player | 	 * @param Player $player | ||||||
| 	 */ | 	 */ | ||||||
| 	public function handlePositiveVote(array $callback, Player $player) { | 	public function handlePositiveVote(array $callback, Player $player) { | ||||||
| 		if (!isset($this->currentVote) || $player->isSpectator && !$this->maniaControl->settingManager->getSettingValue($this, self::SETTING_SPECTATOR_ALLOW_VOTE)) { | 		if (!isset($this->currentVote) || $player->isSpectator && !$this->maniaControl->getSettingManager()->getSettingValue($this, self::SETTING_SPECTATOR_ALLOW_VOTE)) { | ||||||
| 			return; | 			return; | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
| @@ -623,7 +626,7 @@ class CustomVotesPlugin implements CommandListener, CallbackListener, ManialinkP | |||||||
| 	 * @param Player $player | 	 * @param Player $player | ||||||
| 	 */ | 	 */ | ||||||
| 	public function handleNegativeVote(array $callback, Player $player) { | 	public function handleNegativeVote(array $callback, Player $player) { | ||||||
| 		if (!isset($this->currentVote) || $player->isSpectator && !$this->maniaControl->settingManager->getSettingValue($this, self::SETTING_SPECTATOR_ALLOW_VOTE)) { | 		if (!isset($this->currentVote) || $player->isSpectator && !$this->maniaControl->getSettingManager()->getSettingValue($this, self::SETTING_SPECTATOR_ALLOW_VOTE)) { | ||||||
| 			return; | 			return; | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
| @@ -647,7 +650,7 @@ class CustomVotesPlugin implements CommandListener, CallbackListener, ManialinkP | |||||||
| 		$timeUntilExpire = $this->currentVote->expireTime - time(); | 		$timeUntilExpire = $this->currentVote->expireTime - time(); | ||||||
| 		$this->showVoteWidget($timeUntilExpire, $votePercentage); | 		$this->showVoteWidget($timeUntilExpire, $votePercentage); | ||||||
|  |  | ||||||
| 		$playerCount      = $this->maniaControl->playerManager->getPlayerCount(); | 		$playerCount      = $this->maniaControl->getPlayerManager()->getPlayerCount(); | ||||||
| 		$playersVoteRatio = 0; | 		$playersVoteRatio = 0; | ||||||
| 		if ($playerCount > 0 && $voteCount > 0) { | 		if ($playerCount > 0 && $voteCount > 0) { | ||||||
| 			$playersVoteRatio = floatval($voteCount) / floatval($playerCount); | 			$playersVoteRatio = floatval($voteCount) / floatval($playerCount); | ||||||
| @@ -656,7 +659,7 @@ class CustomVotesPlugin implements CommandListener, CallbackListener, ManialinkP | |||||||
| 		//Check if vote is over | 		//Check if vote is over | ||||||
| 		if ($timeUntilExpire <= 0 || (($playersVoteRatio >= $this->currentVote->neededPlayerRatio) && (($votePercentage >= $this->currentVote->neededRatio) || ($votePercentage <= 1 - $this->currentVote->neededRatio)))) { | 		if ($timeUntilExpire <= 0 || (($playersVoteRatio >= $this->currentVote->neededPlayerRatio) && (($votePercentage >= $this->currentVote->neededRatio) || ($votePercentage <= 1 - $this->currentVote->neededRatio)))) { | ||||||
| 			// Trigger callback | 			// Trigger callback | ||||||
| 			$this->maniaControl->callbackManager->triggerCallback(self::CB_CUSTOM_VOTE_FINISHED, $this->currentVote->voteCommand->index, $votePercentage); | 			$this->maniaControl->getCallbackManager()->triggerCallback(self::CB_CUSTOM_VOTE_FINISHED, $this->currentVote->voteCommand->index, $votePercentage); | ||||||
|  |  | ||||||
| 			//reset vote | 			//reset vote | ||||||
| 			$this->destroyVote(); | 			$this->destroyVote(); | ||||||
| @@ -670,15 +673,15 @@ class CustomVotesPlugin implements CommandListener, CallbackListener, ManialinkP | |||||||
| 	 * @param float $votePercentage | 	 * @param float $votePercentage | ||||||
| 	 */ | 	 */ | ||||||
| 	private function showVoteWidget($timeUntilExpire, $votePercentage) { | 	private function showVoteWidget($timeUntilExpire, $votePercentage) { | ||||||
| 		$posX    = $this->maniaControl->settingManager->getSettingValue($this, self::SETTING_WIDGET_POSX); | 		$posX    = $this->maniaControl->getSettingManager()->getSettingValue($this, self::SETTING_WIDGET_POSX); | ||||||
| 		$posY    = $this->maniaControl->settingManager->getSettingValue($this, self::SETTING_WIDGET_POSY); | 		$posY    = $this->maniaControl->getSettingManager()->getSettingValue($this, self::SETTING_WIDGET_POSY); | ||||||
| 		$width   = $this->maniaControl->settingManager->getSettingValue($this, self::SETTING_WIDGET_WIDTH); | 		$width   = $this->maniaControl->getSettingManager()->getSettingValue($this, self::SETTING_WIDGET_WIDTH); | ||||||
| 		$height  = $this->maniaControl->settingManager->getSettingValue($this, self::SETTING_WIDGET_HEIGHT); | 		$height  = $this->maniaControl->getSettingManager()->getSettingValue($this, self::SETTING_WIDGET_HEIGHT); | ||||||
| 		$maxTime = $this->maniaControl->settingManager->getSettingValue($this, self::SETTING_VOTE_TIME); | 		$maxTime = $this->maniaControl->getSettingManager()->getSettingValue($this, self::SETTING_VOTE_TIME); | ||||||
|  |  | ||||||
| 		$quadStyle    = $this->maniaControl->manialinkManager->getStyleManager()->getDefaultQuadStyle(); | 		$quadStyle    = $this->maniaControl->getManialinkManager()->getStyleManager()->getDefaultQuadStyle(); | ||||||
| 		$quadSubstyle = $this->maniaControl->manialinkManager->getStyleManager()->getDefaultQuadSubstyle(); | 		$quadSubstyle = $this->maniaControl->getManialinkManager()->getStyleManager()->getDefaultQuadSubstyle(); | ||||||
| 		$labelStyle   = $this->maniaControl->manialinkManager->getStyleManager()->getDefaultLabelStyle(); | 		$labelStyle   = $this->maniaControl->getManialinkManager()->getStyleManager()->getDefaultLabelStyle(); | ||||||
|  |  | ||||||
| 		$maniaLink = new ManiaLink(self::MLID_WIDGET); | 		$maniaLink = new ManiaLink(self::MLID_WIDGET); | ||||||
|  |  | ||||||
| @@ -790,7 +793,7 @@ class CustomVotesPlugin implements CommandListener, CallbackListener, ManialinkP | |||||||
| 		$script->addFeature($keyActionNegative); | 		$script->addFeature($keyActionNegative); | ||||||
|  |  | ||||||
| 		// Send manialink | 		// Send manialink | ||||||
| 		$this->maniaControl->manialinkManager->sendManialink($maniaLink); | 		$this->maniaControl->getManialinkManager()->sendManialink($maniaLink); | ||||||
| 	} | 	} | ||||||
| } | } | ||||||
|  |  | ||||||
|   | |||||||
| @@ -79,9 +79,9 @@ class DedimaniaPlugin implements CallbackListener, CommandListener, TimerListene | |||||||
| 	 * @see \ManiaControl\Plugins\Plugin::prepare() | 	 * @see \ManiaControl\Plugins\Plugin::prepare() | ||||||
| 	 */ | 	 */ | ||||||
| 	public static function prepare(ManiaControl $maniaControl) { | 	public static function prepare(ManiaControl $maniaControl) { | ||||||
| 		$servers = $maniaControl->server->getAllServers(); | 		$servers = $maniaControl->getServer()->getAllServers(); | ||||||
| 		foreach ($servers as $server) { | 		foreach ($servers as $server) { | ||||||
| 			$maniaControl->settingManager->initSetting(get_class(), self::SETTING_DEDIMANIA_CODE . $server->login . '$l', ''); | 			$maniaControl->getSettingManager()->initSetting(get_class(), self::SETTING_DEDIMANIA_CODE . $server->login . '$l', ''); | ||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| @@ -130,38 +130,40 @@ class DedimaniaPlugin implements CallbackListener, CommandListener, TimerListene | |||||||
| 			throw new \Exception("You need to activate the PHP extension xmlrpc to run this Plugin!"); | 			throw new \Exception("You need to activate the PHP extension xmlrpc to run this Plugin!"); | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
| 		$this->maniaControl->settingManager->initSetting($this, self::SETTING_WIDGET_ENABLE, true); | 		// Settings | ||||||
| 		$this->maniaControl->settingManager->initSetting($this, self::SETTING_WIDGET_TITLE, 'Dedimania'); | 		$this->maniaControl->getSettingManager()->initSetting($this, self::SETTING_WIDGET_ENABLE, true); | ||||||
| 		$this->maniaControl->settingManager->initSetting($this, self::SETTING_WIDGET_POSX, -139); | 		$this->maniaControl->getSettingManager()->initSetting($this, self::SETTING_WIDGET_TITLE, 'Dedimania'); | ||||||
| 		$this->maniaControl->settingManager->initSetting($this, self::SETTING_WIDGET_POSY, 7); | 		$this->maniaControl->getSettingManager()->initSetting($this, self::SETTING_WIDGET_POSX, -139); | ||||||
| 		$this->maniaControl->settingManager->initSetting($this, self::SETTING_WIDGET_WIDTH, 40); | 		$this->maniaControl->getSettingManager()->initSetting($this, self::SETTING_WIDGET_POSY, 7); | ||||||
| 		$this->maniaControl->settingManager->initSetting($this, self::SETTING_WIDGET_LINE_HEIGHT, 4); | 		$this->maniaControl->getSettingManager()->initSetting($this, self::SETTING_WIDGET_WIDTH, 40); | ||||||
| 		$this->maniaControl->settingManager->initSetting($this, self::SETTING_WIDGET_LINE_COUNT, 12); | 		$this->maniaControl->getSettingManager()->initSetting($this, self::SETTING_WIDGET_LINE_HEIGHT, 4); | ||||||
|  | 		$this->maniaControl->getSettingManager()->initSetting($this, self::SETTING_WIDGET_LINE_COUNT, 12); | ||||||
|  |  | ||||||
| 		$this->maniaControl->callbackManager->registerCallbackListener(Callbacks::BEGINMAP, $this, 'handleBeginMap'); | 		// Callbacks | ||||||
| 		$this->maniaControl->callbackManager->registerCallbackListener(Callbacks::ENDMAP, $this, 'handleMapEnd'); | 		$this->maniaControl->getCallbackManager()->registerCallbackListener(Callbacks::BEGINMAP, $this, 'handleBeginMap'); | ||||||
| 		$this->maniaControl->callbackManager->registerCallbackListener(CallbackManager::CB_MP_PLAYERMANIALINKPAGEANSWER, $this, 'handleManialinkPageAnswer'); | 		$this->maniaControl->getCallbackManager()->registerCallbackListener(Callbacks::ENDMAP, $this, 'handleMapEnd'); | ||||||
| 		$this->maniaControl->callbackManager->registerCallbackListener(PlayerManager::CB_PLAYERCONNECT, $this, 'handlePlayerConnect'); | 		$this->maniaControl->getCallbackManager()->registerCallbackListener(CallbackManager::CB_MP_PLAYERMANIALINKPAGEANSWER, $this, 'handleManialinkPageAnswer'); | ||||||
| 		$this->maniaControl->callbackManager->registerCallbackListener(PlayerManager::CB_PLAYERDISCONNECT, $this, 'handlePlayerDisconnect'); | 		$this->maniaControl->getCallbackManager()->registerCallbackListener(PlayerManager::CB_PLAYERCONNECT, $this, 'handlePlayerConnect'); | ||||||
| 		$this->maniaControl->callbackManager->registerCallbackListener(RecordCallback::CHECKPOINT, $this, 'handleCheckpointCallback'); | 		$this->maniaControl->getCallbackManager()->registerCallbackListener(PlayerManager::CB_PLAYERDISCONNECT, $this, 'handlePlayerDisconnect'); | ||||||
| 		$this->maniaControl->callbackManager->registerCallbackListener(RecordCallback::LAPFINISH, $this, 'handleLapFinishCallback'); | 		$this->maniaControl->getCallbackManager()->registerCallbackListener(RecordCallback::CHECKPOINT, $this, 'handleCheckpointCallback'); | ||||||
| 		$this->maniaControl->callbackManager->registerCallbackListener(RecordCallback::FINISH, $this, 'handleFinishCallback'); | 		$this->maniaControl->getCallbackManager()->registerCallbackListener(RecordCallback::LAPFINISH, $this, 'handleLapFinishCallback'); | ||||||
|  | 		$this->maniaControl->getCallbackManager()->registerCallbackListener(RecordCallback::FINISH, $this, 'handleFinishCallback'); | ||||||
|  |  | ||||||
| 		$this->maniaControl->timerManager->registerTimerListening($this, 'updateEverySecond', 1000); | 		$this->maniaControl->getTimerManager()->registerTimerListening($this, 'updateEverySecond', 1000); | ||||||
| 		$this->maniaControl->timerManager->registerTimerListening($this, 'handleEveryMinute', 1000 * 60); | 		$this->maniaControl->getTimerManager()->registerTimerListening($this, 'handleEveryMinute', 1000 * 60); | ||||||
| 		$this->maniaControl->timerManager->registerTimerListening($this, 'updatePlayerList', 1000 * 60 * 3); | 		$this->maniaControl->getTimerManager()->registerTimerListening($this, 'updatePlayerList', 1000 * 60 * 3); | ||||||
|  |  | ||||||
| 		$this->maniaControl->commandManager->registerCommandListener(array('dedirecs', 'dedirecords'), $this, 'showDediRecordsList', false, 'Shows a list of Dedimania records of the current map.'); | 		$this->maniaControl->getCommandManager()->registerCommandListener(array('dedirecs', 'dedirecords'), $this, 'showDediRecordsList', false, 'Shows a list of Dedimania records of the current map.'); | ||||||
|  |  | ||||||
| 		// Open session | 		// Open session | ||||||
| 		$serverInfo    = $this->maniaControl->server->getInfo(); | 		$serverInfo    = $this->maniaControl->getServer()->getInfo(); | ||||||
| 		$serverVersion = $this->maniaControl->client->getVersion(); | 		$packMask      = $this->maniaControl->getServer()->titleId; | ||||||
| 		$packMask      = $this->maniaControl->server->titleId; | 		$serverVersion = $this->maniaControl->getClient()->getVersion(); | ||||||
| 		if ($packMask !== 'Trackmania_2@nadeolabs') { | 		if ($packMask !== 'Trackmania_2@nadeolabs') { | ||||||
| 			$packMask = substr($this->maniaControl->server->titleId, 2); | 			$packMask = substr($this->maniaControl->getServer()->titleId, 2); | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
| 		$dedimaniaCode = $this->maniaControl->settingManager->getSettingValue($this, self::SETTING_DEDIMANIA_CODE . $serverInfo->login . '$l'); | 		$dedimaniaCode = $this->maniaControl->getSettingManager()->getSettingValue($this, self::SETTING_DEDIMANIA_CODE . $serverInfo->login . '$l'); | ||||||
| 		if (!$dedimaniaCode) { | 		if (!$dedimaniaCode) { | ||||||
| 			throw new \Exception("No Dedimania Code Specified, check the settings!"); | 			throw new \Exception("No Dedimania Code Specified, check the settings!"); | ||||||
| 		} | 		} | ||||||
| @@ -192,7 +194,7 @@ class DedimaniaPlugin implements CallbackListener, CommandListener, TimerListene | |||||||
|  |  | ||||||
|  |  | ||||||
| 		//$this->maniaControl->fileReader->postDataTest($this->request, self::DEDIMANIA_URL, function ($data, $error) { | 		//$this->maniaControl->fileReader->postDataTest($this->request, self::DEDIMANIA_URL, function ($data, $error) { | ||||||
| 		$this->maniaControl->fileReader->postData(self::DEDIMANIA_URL, function ($data, $error) { | 		$this->maniaControl->getFileReader()->postData(self::DEDIMANIA_URL, function ($data, $error) { | ||||||
| 			$this->maniaControl->log("Try to connect on Dedimania"); | 			$this->maniaControl->log("Try to connect on Dedimania"); | ||||||
|  |  | ||||||
| 			if (!$data || $error) { | 			if (!$data || $error) { | ||||||
| @@ -291,7 +293,7 @@ class DedimaniaPlugin implements CallbackListener, CommandListener, TimerListene | |||||||
| 		$content = $this->encode_request(self::DEDIMANIA_GET_RECORDS, $data); | 		$content = $this->encode_request(self::DEDIMANIA_GET_RECORDS, $data); | ||||||
| 		//var_dump("get recs"); | 		//var_dump("get recs"); | ||||||
| 		//$this->maniaControl->fileReader->postDataTest($this->request,self::DEDIMANIA_URL, function ($data, $error) { | 		//$this->maniaControl->fileReader->postDataTest($this->request,self::DEDIMANIA_URL, function ($data, $error) { | ||||||
| 		$this->maniaControl->fileReader->postData(self::DEDIMANIA_URL, function ($data, $error) { | 		$this->maniaControl->getFileReader()->postData(self::DEDIMANIA_URL, function ($data, $error) { | ||||||
| 			if ($error) { | 			if ($error) { | ||||||
| 				$this->maniaControl->log('Dedimania Error: ' . $error); | 				$this->maniaControl->log('Dedimania Error: ' . $error); | ||||||
| 			} | 			} | ||||||
| @@ -309,7 +311,7 @@ class DedimaniaPlugin implements CallbackListener, CommandListener, TimerListene | |||||||
|  |  | ||||||
| 			$responseData = $methodResponse[0]; | 			$responseData = $methodResponse[0]; | ||||||
| 			if (!isset($responseData['Players']) || !isset($responseData['Records'])) { | 			if (!isset($responseData['Players']) || !isset($responseData['Records'])) { | ||||||
| 				$this->maniaControl->errorHandler->triggerDebugNotice('Invalid Dedimania response!', $responseData); | 				$this->maniaControl->getErrorHandler()->triggerDebugNotice('Invalid Dedimania response!', $responseData); | ||||||
| 				return; | 				return; | ||||||
| 			} | 			} | ||||||
|  |  | ||||||
| @@ -328,7 +330,7 @@ class DedimaniaPlugin implements CallbackListener, CommandListener, TimerListene | |||||||
| 			} | 			} | ||||||
|  |  | ||||||
| 			$this->updateManialink = true; | 			$this->updateManialink = true; | ||||||
| 			$this->maniaControl->callbackManager->triggerCallback(self::CB_DEDIMANIA_UPDATED, $this->dedimaniaData->records); | 			$this->maniaControl->getCallbackManager()->triggerCallback(self::CB_DEDIMANIA_UPDATED, $this->dedimaniaData->records); | ||||||
| 		}, $content, true); | 		}, $content, true); | ||||||
|  |  | ||||||
| 		return true; | 		return true; | ||||||
| @@ -338,17 +340,17 @@ class DedimaniaPlugin implements CallbackListener, CommandListener, TimerListene | |||||||
| 	 * Build server info Structure for callbacks | 	 * Build server info Structure for callbacks | ||||||
| 	 */ | 	 */ | ||||||
| 	private function getServerInfo() { | 	private function getServerInfo() { | ||||||
| 		$server = $this->maniaControl->client->getServerOptions(); | 		$server = $this->maniaControl->getClient()->getServerOptions(); | ||||||
| 		if (!$server) { | 		if (!$server) { | ||||||
| 			return null; | 			return null; | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
| 		if ($this->maniaControl->playerManager->getPlayerCount(false) <= 0) { | 		if ($this->maniaControl->getPlayerManager()->getPlayerCount(false) <= 0) { | ||||||
| 			return null; | 			return null; | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
| 		$playerCount    = $this->maniaControl->playerManager->getPlayerCount(); | 		$playerCount    = $this->maniaControl->getPlayerManager()->getPlayerCount(); | ||||||
| 		$spectatorCount = $this->maniaControl->playerManager->getSpectatorCount(); | 		$spectatorCount = $this->maniaControl->getPlayerManager()->getSpectatorCount(); | ||||||
|  |  | ||||||
| 		return array('SrvName' => $server->name, 'Comment' => $server->comment, 'Private' => (strlen($server->password) > 0), 'NumPlayers' => $playerCount, 'MaxPlayers' => $server->currentMaxPlayers, 'NumSpecs' => $spectatorCount, 'MaxSpecs' => $server->currentMaxSpectators); | 		return array('SrvName' => $server->name, 'Comment' => $server->comment, 'Private' => (strlen($server->password) > 0), 'NumPlayers' => $playerCount, 'MaxPlayers' => $server->currentMaxPlayers, 'NumSpecs' => $spectatorCount, 'MaxSpecs' => $server->currentMaxSpectators); | ||||||
| 	} | 	} | ||||||
| @@ -357,7 +359,7 @@ class DedimaniaPlugin implements CallbackListener, CommandListener, TimerListene | |||||||
| 	 * Build simple player list for callbacks | 	 * Build simple player list for callbacks | ||||||
| 	 */ | 	 */ | ||||||
| 	private function getPlayerList() { | 	private function getPlayerList() { | ||||||
| 		$players = $this->maniaControl->playerManager->getPlayers(); | 		$players = $this->maniaControl->getPlayerManager()->getPlayers(); | ||||||
|  |  | ||||||
| 		if (empty($players)) { | 		if (empty($players)) { | ||||||
| 			return null; | 			return null; | ||||||
| @@ -375,7 +377,7 @@ class DedimaniaPlugin implements CallbackListener, CommandListener, TimerListene | |||||||
| 	 * @return array | 	 * @return array | ||||||
| 	 */ | 	 */ | ||||||
| 	private function getMapInfo() { | 	private function getMapInfo() { | ||||||
| 		$map = $this->maniaControl->mapManager->getCurrentMap(); | 		$map = $this->maniaControl->getMapManager()->getCurrentMap(); | ||||||
| 		if (!$map) { | 		if (!$map) { | ||||||
| 			return null; | 			return null; | ||||||
| 		} | 		} | ||||||
| @@ -395,7 +397,7 @@ class DedimaniaPlugin implements CallbackListener, CommandListener, TimerListene | |||||||
| 	 * @return String | 	 * @return String | ||||||
| 	 */ | 	 */ | ||||||
| 	private function getGameModeString() { | 	private function getGameModeString() { | ||||||
| 		$gameMode = $this->maniaControl->server->getGameMode(); | 		$gameMode = $this->maniaControl->getServer()->getGameMode(); | ||||||
| 		if ($gameMode === null) { | 		if ($gameMode === null) { | ||||||
| 			trigger_error("Couldn't retrieve game mode."); | 			trigger_error("Couldn't retrieve game mode."); | ||||||
| 			return null; | 			return null; | ||||||
| @@ -403,7 +405,7 @@ class DedimaniaPlugin implements CallbackListener, CommandListener, TimerListene | |||||||
| 		switch ($gameMode) { | 		switch ($gameMode) { | ||||||
| 			case 0: | 			case 0: | ||||||
| 			{ | 			{ | ||||||
| 				$scriptNameResponse = $this->maniaControl->client->getScriptName(); | 				$scriptNameResponse = $this->maniaControl->getClient()->getScriptName(); | ||||||
| 				$scriptName         = str_replace('.Script.txt', '', $scriptNameResponse['CurrentValue']); | 				$scriptName         = str_replace('.Script.txt', '', $scriptNameResponse['CurrentValue']); | ||||||
| 				switch ($scriptName) { | 				switch ($scriptName) { | ||||||
| 					case 'Rounds': | 					case 'Rounds': | ||||||
| @@ -447,9 +449,9 @@ class DedimaniaPlugin implements CallbackListener, CommandListener, TimerListene | |||||||
| 			var_dump("Dedimania Debug: Update Manialink"); | 			var_dump("Dedimania Debug: Update Manialink"); | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
| 		if ($this->maniaControl->settingManager->getSettingValue($this, self::SETTING_WIDGET_ENABLE)) { | 		if ($this->maniaControl->getSettingManager()->getSettingValue($this, self::SETTING_WIDGET_ENABLE)) { | ||||||
| 			$manialink = $this->buildManialink(); | 			$manialink = $this->buildManialink(); | ||||||
| 			$this->maniaControl->manialinkManager->sendManialink($manialink); | 			$this->maniaControl->getManialinkManager()->sendManialink($manialink); | ||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| @@ -461,15 +463,15 @@ class DedimaniaPlugin implements CallbackListener, CommandListener, TimerListene | |||||||
| 	private function buildManialink() { | 	private function buildManialink() { | ||||||
| 		$records = $this->dedimaniaData->records; | 		$records = $this->dedimaniaData->records; | ||||||
|  |  | ||||||
| 		$title        = $this->maniaControl->settingManager->getSettingValue($this, self::SETTING_WIDGET_TITLE); | 		$title        = $this->maniaControl->getSettingManager()->getSettingValue($this, self::SETTING_WIDGET_TITLE); | ||||||
| 		$posX         = $this->maniaControl->settingManager->getSettingValue($this, self::SETTING_WIDGET_POSX); | 		$posX         = $this->maniaControl->getSettingManager()->getSettingValue($this, self::SETTING_WIDGET_POSX); | ||||||
| 		$posY         = $this->maniaControl->settingManager->getSettingValue($this, self::SETTING_WIDGET_POSY); | 		$posY         = $this->maniaControl->getSettingManager()->getSettingValue($this, self::SETTING_WIDGET_POSY); | ||||||
| 		$width        = $this->maniaControl->settingManager->getSettingValue($this, self::SETTING_WIDGET_WIDTH); | 		$width        = $this->maniaControl->getSettingManager()->getSettingValue($this, self::SETTING_WIDGET_WIDTH); | ||||||
| 		$lines        = $this->maniaControl->settingManager->getSettingValue($this, self::SETTING_WIDGET_LINE_COUNT); | 		$lines        = $this->maniaControl->getSettingManager()->getSettingValue($this, self::SETTING_WIDGET_LINE_COUNT); | ||||||
| 		$lineHeight   = $this->maniaControl->settingManager->getSettingValue($this, self::SETTING_WIDGET_LINE_HEIGHT); | 		$lineHeight   = $this->maniaControl->getSettingManager()->getSettingValue($this, self::SETTING_WIDGET_LINE_HEIGHT); | ||||||
| 		$labelStyle   = $this->maniaControl->manialinkManager->getStyleManager()->getDefaultLabelStyle(); | 		$labelStyle   = $this->maniaControl->getManialinkManager()->getStyleManager()->getDefaultLabelStyle(); | ||||||
| 		$quadStyle    = $this->maniaControl->manialinkManager->getStyleManager()->getDefaultQuadStyle(); | 		$quadStyle    = $this->maniaControl->getManialinkManager()->getStyleManager()->getDefaultQuadStyle(); | ||||||
| 		$quadSubstyle = $this->maniaControl->manialinkManager->getStyleManager()->getDefaultQuadSubstyle(); | 		$quadSubstyle = $this->maniaControl->getManialinkManager()->getStyleManager()->getDefaultQuadSubstyle(); | ||||||
|  |  | ||||||
|  |  | ||||||
| 		$manialink = new ManiaLink(self::MLID_DEDIMANIA); | 		$manialink = new ManiaLink(self::MLID_DEDIMANIA); | ||||||
| @@ -567,7 +569,7 @@ class DedimaniaPlugin implements CallbackListener, CommandListener, TimerListene | |||||||
| 		$content = $this->encode_request(self::DEDIMANIA_CHECK_SESSION, array($this->dedimaniaData->sessionId)); | 		$content = $this->encode_request(self::DEDIMANIA_CHECK_SESSION, array($this->dedimaniaData->sessionId)); | ||||||
| 		//var_dump("check session"); //TODO remove | 		//var_dump("check session"); //TODO remove | ||||||
| 		//$this->maniaControl->fileReader->postDataTest($this->request, self::DEDIMANIA_URL, function ($data, $error) { | 		//$this->maniaControl->fileReader->postDataTest($this->request, self::DEDIMANIA_URL, function ($data, $error) { | ||||||
| 		$this->maniaControl->fileReader->postData(self::DEDIMANIA_URL, function ($data, $error) { | 		$this->maniaControl->getFileReader()->postData(self::DEDIMANIA_URL, function ($data, $error) { | ||||||
| 			if ($error) { | 			if ($error) { | ||||||
| 				$this->maniaControl->log("Dedimania Error: " . $error); | 				$this->maniaControl->log("Dedimania Error: " . $error); | ||||||
| 			} | 			} | ||||||
| @@ -611,7 +613,7 @@ class DedimaniaPlugin implements CallbackListener, CommandListener, TimerListene | |||||||
| 		$data    = array($this->dedimaniaData->sessionId, $player->login, $player->rawNickname, $player->path, $player->isSpectator); | 		$data    = array($this->dedimaniaData->sessionId, $player->login, $player->rawNickname, $player->path, $player->isSpectator); | ||||||
| 		$content = $this->encode_request(self::DEDIMANIA_PLAYERCONNECT, $data); | 		$content = $this->encode_request(self::DEDIMANIA_PLAYERCONNECT, $data); | ||||||
|  |  | ||||||
| 		$this->maniaControl->fileReader->postData(self::DEDIMANIA_URL, function ($data, $error) use (&$player) { | 		$this->maniaControl->getFileReader()->postData(self::DEDIMANIA_URL, function ($data, $error) use (&$player) { | ||||||
| 			if ($error) { | 			if ($error) { | ||||||
| 				$this->maniaControl->log("Dedimania Error: " . $error); | 				$this->maniaControl->log("Dedimania Error: " . $error); | ||||||
| 			} | 			} | ||||||
| @@ -632,13 +634,13 @@ class DedimaniaPlugin implements CallbackListener, CommandListener, TimerListene | |||||||
| 			$this->dedimaniaData->addPlayer($dediPlayer); | 			$this->dedimaniaData->addPlayer($dediPlayer); | ||||||
|  |  | ||||||
| 			// Fetch records if he is the first who joined the server | 			// Fetch records if he is the first who joined the server | ||||||
| 			if ($this->maniaControl->playerManager->getPlayerCount(false) === 1) { | 			if ($this->maniaControl->getPlayerManager()->getPlayerCount(false) === 1) { | ||||||
| 				$this->fetchDedimaniaRecords(true); | 				$this->fetchDedimaniaRecords(true); | ||||||
| 			} | 			} | ||||||
|  |  | ||||||
| 			if ($this->maniaControl->settingManager->getSettingValue($this, self::SETTING_WIDGET_ENABLE)) { | 			if ($this->maniaControl->getSettingManager()->getSettingValue($this, self::SETTING_WIDGET_ENABLE)) { | ||||||
| 				$manialink = $this->buildManialink(); | 				$manialink = $this->buildManialink(); | ||||||
| 				$this->maniaControl->manialinkManager->sendManialink($manialink, $player->login); | 				$this->maniaControl->getManialinkManager()->sendManialink($manialink, $player->login); | ||||||
| 			} | 			} | ||||||
| 		}, $content, true); | 		}, $content, true); | ||||||
| 	} | 	} | ||||||
| @@ -658,7 +660,7 @@ class DedimaniaPlugin implements CallbackListener, CommandListener, TimerListene | |||||||
| 		$data    = array($this->dedimaniaData->sessionId, $player->login, ''); | 		$data    = array($this->dedimaniaData->sessionId, $player->login, ''); | ||||||
| 		$content = $this->encode_request(self::DEDIMANIA_PLAYERDISCONNECT, $data); | 		$content = $this->encode_request(self::DEDIMANIA_PLAYERDISCONNECT, $data); | ||||||
|  |  | ||||||
| 		$this->maniaControl->fileReader->postData(self::DEDIMANIA_URL, function ($data, $error) { | 		$this->maniaControl->getFileReader()->postData(self::DEDIMANIA_URL, function ($data, $error) { | ||||||
| 			if ($error) { | 			if ($error) { | ||||||
| 				$this->maniaControl->log("Dedimania Error: " . $error); | 				$this->maniaControl->log("Dedimania Error: " . $error); | ||||||
| 			} | 			} | ||||||
| @@ -728,7 +730,7 @@ class DedimaniaPlugin implements CallbackListener, CommandListener, TimerListene | |||||||
| 			var_dump("Dedimania Debug: Submitting Times at End-Map", $content); | 			var_dump("Dedimania Debug: Submitting Times at End-Map", $content); | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
| 		$this->maniaControl->fileReader->postData(self::DEDIMANIA_URL, function ($data, $error) { | 		$this->maniaControl->getFileReader()->postData(self::DEDIMANIA_URL, function ($data, $error) { | ||||||
| 			if ($error) { | 			if ($error) { | ||||||
| 				$this->maniaControl->log("Dedimania Error: " . $error); | 				$this->maniaControl->log("Dedimania Error: " . $error); | ||||||
| 			} | 			} | ||||||
| @@ -778,7 +780,7 @@ class DedimaniaPlugin implements CallbackListener, CommandListener, TimerListene | |||||||
| 		$data    = array($this->dedimaniaData->sessionId, $serverInfo, $votesInfo, $playerList); | 		$data    = array($this->dedimaniaData->sessionId, $serverInfo, $votesInfo, $playerList); | ||||||
| 		$content = $this->encode_request(self::DEDIMANIA_UPDATE_SERVER_PLAYERS, $data); | 		$content = $this->encode_request(self::DEDIMANIA_UPDATE_SERVER_PLAYERS, $data); | ||||||
|  |  | ||||||
| 		$this->maniaControl->fileReader->postData(self::DEDIMANIA_URL, function ($data, $error) { | 		$this->maniaControl->getFileReader()->postData(self::DEDIMANIA_URL, function ($data, $error) { | ||||||
| 			if ($error) { | 			if ($error) { | ||||||
| 				$this->maniaControl->log("Dedimania Error: " . $error); | 				$this->maniaControl->log("Dedimania Error: " . $error); | ||||||
| 			} | 			} | ||||||
| @@ -799,7 +801,7 @@ class DedimaniaPlugin implements CallbackListener, CommandListener, TimerListene | |||||||
| 	 * Build Votes Info Array for Callbacks | 	 * Build Votes Info Array for Callbacks | ||||||
| 	 */ | 	 */ | ||||||
| 	private function getVotesInfo() { | 	private function getVotesInfo() { | ||||||
| 		$map = $this->maniaControl->mapManager->getCurrentMap(); | 		$map = $this->maniaControl->getMapManager()->getCurrentMap(); | ||||||
| 		if (!$map) { | 		if (!$map) { | ||||||
| 			return null; | 			return null; | ||||||
| 		} | 		} | ||||||
| @@ -853,7 +855,7 @@ class DedimaniaPlugin implements CallbackListener, CommandListener, TimerListene | |||||||
| 			return; | 			return; | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
| 		$map = $this->maniaControl->mapManager->getCurrentMap(); | 		$map = $this->maniaControl->getMapManager()->getCurrentMap(); | ||||||
| 		if (!$map) { | 		if (!$map) { | ||||||
| 			return; | 			return; | ||||||
| 		} | 		} | ||||||
| @@ -873,7 +875,7 @@ class DedimaniaPlugin implements CallbackListener, CommandListener, TimerListene | |||||||
| 					break; | 					break; | ||||||
| 				} | 				} | ||||||
|  |  | ||||||
| 				$this->maniaControl->callbackManager->triggerCallback(self::CB_DEDIMANIA_CHANGED, $newRecord); | 				$this->maniaControl->getCallbackManager()->triggerCallback(self::CB_DEDIMANIA_CHANGED, $newRecord); | ||||||
|  |  | ||||||
| 				// Announce record | 				// Announce record | ||||||
| 				if ($oldRecord->nullRecord || $newRecord->rank < $oldRecord->rank) { | 				if ($oldRecord->nullRecord || $newRecord->rank < $oldRecord->rank) { | ||||||
| @@ -887,7 +889,7 @@ class DedimaniaPlugin implements CallbackListener, CommandListener, TimerListene | |||||||
| 				if (!$oldRecord->nullRecord) { | 				if (!$oldRecord->nullRecord) { | ||||||
| 					$message .= ' ($<$ff0' . $oldRecord->rank . '.$> $<$fff-' . Formatter::formatTime(($oldRecord->best - $callback->lapTime)) . '$>)'; | 					$message .= ' ($<$ff0' . $oldRecord->rank . '.$> $<$fff-' . Formatter::formatTime(($oldRecord->best - $callback->lapTime)) . '$>)'; | ||||||
| 				} | 				} | ||||||
| 				$this->maniaControl->chat->sendInformation($message . '!'); | 				$this->maniaControl->getChat()->sendInformation($message . '!'); | ||||||
|  |  | ||||||
| 				$this->updateManialink = true; | 				$this->updateManialink = true; | ||||||
| 			} | 			} | ||||||
| @@ -1023,7 +1025,7 @@ class DedimaniaPlugin implements CallbackListener, CommandListener, TimerListene | |||||||
| 	 */ | 	 */ | ||||||
| 	private function updateDedimaniaRecordRanks() { | 	private function updateDedimaniaRecordRanks() { | ||||||
| 		if ($this->dedimaniaData->getRecordCount() === 0) { | 		if ($this->dedimaniaData->getRecordCount() === 0) { | ||||||
| 			$this->maniaControl->callbackManager->triggerCallback(self::CB_DEDIMANIA_UPDATED, $this->dedimaniaData->records); | 			$this->maniaControl->getCallbackManager()->triggerCallback(self::CB_DEDIMANIA_UPDATED, $this->dedimaniaData->records); | ||||||
| 			return; | 			return; | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
| @@ -1035,7 +1037,7 @@ class DedimaniaPlugin implements CallbackListener, CommandListener, TimerListene | |||||||
| 			$record->rank = $rank; | 			$record->rank = $rank; | ||||||
| 			$rank++; | 			$rank++; | ||||||
| 		} | 		} | ||||||
| 		$this->maniaControl->callbackManager->triggerCallback(self::CB_DEDIMANIA_UPDATED, $this->dedimaniaData->records); | 		$this->maniaControl->getCallbackManager()->triggerCallback(self::CB_DEDIMANIA_UPDATED, $this->dedimaniaData->records); | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	/** | 	/** | ||||||
| @@ -1045,23 +1047,23 @@ class DedimaniaPlugin implements CallbackListener, CommandListener, TimerListene | |||||||
| 	 */ | 	 */ | ||||||
| 	private function setRecordReplays(RecordData &$record) { | 	private function setRecordReplays(RecordData &$record) { | ||||||
| 		// Set validation replay | 		// Set validation replay | ||||||
| 		$validationReplay = $this->maniaControl->server->getValidationReplay($record->login); | 		$validationReplay = $this->maniaControl->getServer()->getValidationReplay($record->login); | ||||||
| 		if ($validationReplay) { | 		if ($validationReplay) { | ||||||
| 			$record->vReplay = $validationReplay; | 			$record->vReplay = $validationReplay; | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
| 		// Set ghost replay | 		// Set ghost replay | ||||||
| 		if ($record->rank <= 1) { | 		if ($record->rank <= 1) { | ||||||
| 			$dataDirectory = $this->maniaControl->server->getDirectory()->getGameDataFolder(); | 			$dataDirectory = $this->maniaControl->getServer()->getDirectory()->getGameDataFolder(); | ||||||
| 			if (!isset($this->dedimaniaData->directoryAccessChecked)) { | 			if (!isset($this->dedimaniaData->directoryAccessChecked)) { | ||||||
| 				$access = $this->maniaControl->server->checkAccess($dataDirectory); | 				$access = $this->maniaControl->getServer()->checkAccess($dataDirectory); | ||||||
| 				if (!$access) { | 				if (!$access) { | ||||||
| 					trigger_error("No access to the servers data directory. Can't retrieve ghost replays."); | 					trigger_error("No access to the servers data directory. Can't retrieve ghost replays."); | ||||||
| 				} | 				} | ||||||
| 				$this->dedimaniaData->directoryAccessChecked = $access; | 				$this->dedimaniaData->directoryAccessChecked = $access; | ||||||
| 			} | 			} | ||||||
| 			if ($this->dedimaniaData->directoryAccessChecked) { | 			if ($this->dedimaniaData->directoryAccessChecked) { | ||||||
| 				$ghostReplay = $this->maniaControl->server->getGhostReplay($record->login); | 				$ghostReplay = $this->maniaControl->getServer()->getGhostReplay($record->login); | ||||||
| 				if ($ghostReplay) { | 				if ($ghostReplay) { | ||||||
| 					$record->top1GReplay = $ghostReplay; | 					$record->top1GReplay = $ghostReplay; | ||||||
| 				} | 				} | ||||||
| @@ -1078,7 +1080,7 @@ class DedimaniaPlugin implements CallbackListener, CommandListener, TimerListene | |||||||
| 		$actionId = $callback[1][2]; | 		$actionId = $callback[1][2]; | ||||||
|  |  | ||||||
| 		$login  = $callback[1][1]; | 		$login  = $callback[1][1]; | ||||||
| 		$player = $this->maniaControl->playerManager->getPlayer($login); | 		$player = $this->maniaControl->getPlayerManager()->getPlayer($login); | ||||||
|  |  | ||||||
| 		if ($actionId === self::ACTION_SHOW_DEDIRECORDSLIST) { | 		if ($actionId === self::ACTION_SHOW_DEDIRECORDSLIST) { | ||||||
| 			$this->showDediRecordsList(array(), $player); | 			$this->showDediRecordsList(array(), $player); | ||||||
| @@ -1092,13 +1094,13 @@ class DedimaniaPlugin implements CallbackListener, CommandListener, TimerListene | |||||||
| 	 * @param Player $player | 	 * @param Player $player | ||||||
| 	 */ | 	 */ | ||||||
| 	public function showDediRecordsList(array $chat, Player $player) { | 	public function showDediRecordsList(array $chat, Player $player) { | ||||||
| 		$width  = $this->maniaControl->manialinkManager->getStyleManager()->getListWidgetsWidth(); | 		$width  = $this->maniaControl->getManialinkManager()->getStyleManager()->getListWidgetsWidth(); | ||||||
| 		$height = $this->maniaControl->manialinkManager->getStyleManager()->getListWidgetsHeight(); | 		$height = $this->maniaControl->getManialinkManager()->getStyleManager()->getListWidgetsHeight(); | ||||||
|  |  | ||||||
| 		// get PlayerList | 		// get PlayerList | ||||||
| 		$records = $this->dedimaniaData->records; | 		$records = $this->dedimaniaData->records; | ||||||
| 		if (!$records) { | 		if (!$records) { | ||||||
| 			$this->maniaControl->chat->sendInformation('There are no Dedimania records on this map!'); | 			$this->maniaControl->getChat()->sendInformation('There are no Dedimania records on this map!'); | ||||||
| 			return; | 			return; | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
| @@ -1109,7 +1111,7 @@ class DedimaniaPlugin implements CallbackListener, CommandListener, TimerListene | |||||||
| 		$script->addFeature($paging); | 		$script->addFeature($paging); | ||||||
|  |  | ||||||
| 		// Main frame | 		// Main frame | ||||||
| 		$frame = $this->maniaControl->manialinkManager->getStyleManager()->getDefaultListFrame($script, $paging); | 		$frame = $this->maniaControl->getManialinkManager()->getStyleManager()->getDefaultListFrame($script, $paging); | ||||||
| 		$maniaLink->add($frame); | 		$maniaLink->add($frame); | ||||||
|  |  | ||||||
| 		// Start offsets | 		// Start offsets | ||||||
| @@ -1117,15 +1119,15 @@ class DedimaniaPlugin implements CallbackListener, CommandListener, TimerListene | |||||||
| 		$posY = $height / 2; | 		$posY = $height / 2; | ||||||
|  |  | ||||||
| 		// Predefine Description Label | 		// Predefine Description Label | ||||||
| 		$descriptionLabel = $this->maniaControl->manialinkManager->getStyleManager()->getDefaultDescriptionLabel(); | 		$descriptionLabel = $this->maniaControl->getManialinkManager()->getStyleManager()->getDefaultDescriptionLabel(); | ||||||
| 		$frame->add($descriptionLabel); | 		$frame->add($descriptionLabel); | ||||||
|  |  | ||||||
| 		// Headline | 		// Headline | ||||||
| 		$headFrame = new Frame(); | 		$headFrame = new Frame(); | ||||||
| 		$frame->add($headFrame); | 		$frame->add($headFrame); | ||||||
| 		$headFrame->setY($posY - 5); | 		$headFrame->setY($posY - 5); | ||||||
| 		$array = array("Rank" => $posX + 5, "Nickname" => $posX + 18, "Login" => $posX + 70, "Time" => $posX + 101); | 		$array = array('Rank' => $posX + 5, 'Nickname' => $posX + 18, 'Login' => $posX + 70, 'Time' => $posX + 101); | ||||||
| 		$this->maniaControl->manialinkManager->labelLine($headFrame, $array); | 		$this->maniaControl->getManialinkManager()->labelLine($headFrame, $array); | ||||||
|  |  | ||||||
| 		$index     = 0; | 		$index     = 0; | ||||||
| 		$posY      = $height / 2 - 10; | 		$posY      = $height / 2 - 10; | ||||||
| @@ -1154,7 +1156,7 @@ class DedimaniaPlugin implements CallbackListener, CommandListener, TimerListene | |||||||
| 				$listRecord->nickName = $listRecord->login; | 				$listRecord->nickName = $listRecord->login; | ||||||
| 			} | 			} | ||||||
| 			$array = array($listRecord->rank => $posX + 5, '$fff' . $listRecord->nickName => $posX + 18, $listRecord->login => $posX + 70, Formatter::formatTime($listRecord->best) => $posX + 101); | 			$array = array($listRecord->rank => $posX + 5, '$fff' . $listRecord->nickName => $posX + 18, $listRecord->login => $posX + 70, Formatter::formatTime($listRecord->best) => $posX + 101); | ||||||
| 			$this->maniaControl->manialinkManager->labelLine($recordFrame, $array); | 			$this->maniaControl->getManialinkManager()->labelLine($recordFrame, $array); | ||||||
|  |  | ||||||
| 			$recordFrame->setY($posY); | 			$recordFrame->setY($posY); | ||||||
|  |  | ||||||
| @@ -1163,7 +1165,7 @@ class DedimaniaPlugin implements CallbackListener, CommandListener, TimerListene | |||||||
| 		} | 		} | ||||||
|  |  | ||||||
| 		// Render and display xml | 		// Render and display xml | ||||||
| 		$this->maniaControl->manialinkManager->displayWidget($maniaLink, $player, 'DediRecordsList'); | 		$this->maniaControl->getManialinkManager()->displayWidget($maniaLink, $player, 'DediRecordsList'); | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	/** | 	/** | ||||||
|   | |||||||
| @@ -104,28 +104,28 @@ class DonationPlugin implements CallbackListener, CommandListener, Plugin { | |||||||
| 		$this->maniaControl = $maniaControl; | 		$this->maniaControl = $maniaControl; | ||||||
|  |  | ||||||
| 		// Register for commands | 		// Register for commands | ||||||
| 		$this->maniaControl->commandManager->registerCommandListener('donate', $this, 'command_Donate', false, 'Donate some planets to the server.'); | 		$this->maniaControl->getCommandManager()->registerCommandListener('donate', $this, 'command_Donate', false, 'Donate some planets to the server.'); | ||||||
| 		$this->maniaControl->commandManager->registerCommandListener('pay', $this, 'command_Pay', true, 'Pays planets from the server to a player.'); | 		$this->maniaControl->getCommandManager()->registerCommandListener('pay', $this, 'command_Pay', true, 'Pays planets from the server to a player.'); | ||||||
| 		$this->maniaControl->commandManager->registerCommandListener(array('getplanets', 'planets'), $this, 'command_GetPlanets', true, 'Checks the planets-balance of the server.'); | 		$this->maniaControl->getCommandManager()->registerCommandListener(array('getplanets', 'planets'), $this, 'command_GetPlanets', true, 'Checks the planets-balance of the server.'); | ||||||
| 		$this->maniaControl->commandManager->registerCommandListener('topdons', $this, 'command_TopDons', false, 'Provides an overview of who donated the most planets.'); | 		$this->maniaControl->getCommandManager()->registerCommandListener('topdons', $this, 'command_TopDons', false, 'Provides an overview of who donated the most planets.'); | ||||||
|  |  | ||||||
| 		// Register for callbacks | 		// Register for callbacks | ||||||
| 		$this->maniaControl->callbackManager->registerCallbackListener(PlayerManager::CB_PLAYERCONNECT, $this, 'handlePlayerConnect'); | 		$this->maniaControl->getCallbackManager()->registerCallbackListener(PlayerManager::CB_PLAYERCONNECT, $this, 'handlePlayerConnect'); | ||||||
| 		$this->maniaControl->callbackManager->registerCallbackListener(CallbackManager::CB_MP_PLAYERMANIALINKPAGEANSWER, $this, 'handleManialinkPageAnswer'); | 		$this->maniaControl->getCallbackManager()->registerCallbackListener(CallbackManager::CB_MP_PLAYERMANIALINKPAGEANSWER, $this, 'handleManialinkPageAnswer'); | ||||||
|  |  | ||||||
| 		// Define player stats | 		// Define player stats | ||||||
| 		$this->maniaControl->statisticManager->defineStatMetaData(self::STAT_PLAYER_DONATIONS); | 		$this->maniaControl->getStatisticManager()->defineStatMetaData(self::STAT_PLAYER_DONATIONS); | ||||||
|  |  | ||||||
| 		$this->maniaControl->settingManager->initSetting($this, self::SETTING_DONATE_WIDGET_ACTIVATED, true); | 		$this->maniaControl->getSettingManager()->initSetting($this, self::SETTING_DONATE_WIDGET_ACTIVATED, true); | ||||||
| 		$this->maniaControl->settingManager->initSetting($this, self::SETTING_DONATE_WIDGET_POSX, 156.); | 		$this->maniaControl->getSettingManager()->initSetting($this, self::SETTING_DONATE_WIDGET_POSX, 156.); | ||||||
| 		$this->maniaControl->settingManager->initSetting($this, self::SETTING_DONATE_WIDGET_POSY, -31.4); | 		$this->maniaControl->getSettingManager()->initSetting($this, self::SETTING_DONATE_WIDGET_POSY, -31.4); | ||||||
| 		$this->maniaControl->settingManager->initSetting($this, self::SETTING_DONATE_WIDGET_WIDTH, 6); | 		$this->maniaControl->getSettingManager()->initSetting($this, self::SETTING_DONATE_WIDGET_WIDTH, 6); | ||||||
| 		$this->maniaControl->settingManager->initSetting($this, self::SETTING_DONATE_WIDGET_HEIGHT, 6); | 		$this->maniaControl->getSettingManager()->initSetting($this, self::SETTING_DONATE_WIDGET_HEIGHT, 6); | ||||||
| 		$this->maniaControl->settingManager->initSetting($this, self::SETTING_DONATION_VALUES, "20,50,100,500,1000,2000"); | 		$this->maniaControl->getSettingManager()->initSetting($this, self::SETTING_DONATION_VALUES, "20,50,100,500,1000,2000"); | ||||||
| 		$this->maniaControl->settingManager->initSetting($this, self::SETTING_MIN_AMOUNT_SHOWN, 100); | 		$this->maniaControl->getSettingManager()->initSetting($this, self::SETTING_MIN_AMOUNT_SHOWN, 100); | ||||||
|  |  | ||||||
| 		// Register Stat in Simple StatsList | 		// Register Stat in Simple StatsList | ||||||
| 		$this->maniaControl->statisticManager->getSimpleStatsList()->registerStat(self::STAT_PLAYER_DONATIONS, 90, "DP", 15); | 		$this->maniaControl->getStatisticManager()->getSimpleStatsList()->registerStat(self::STAT_PLAYER_DONATIONS, 90, "DP", 15); | ||||||
|  |  | ||||||
| 		$this->displayWidget(); | 		$this->displayWidget(); | ||||||
| 		return true; | 		return true; | ||||||
| @@ -135,7 +135,7 @@ class DonationPlugin implements CallbackListener, CommandListener, Plugin { | |||||||
| 	 * Display the widget | 	 * Display the widget | ||||||
| 	 */ | 	 */ | ||||||
| 	public function displayWidget() { | 	public function displayWidget() { | ||||||
| 		if ($this->maniaControl->settingManager->getSettingValue($this, self::SETTING_DONATE_WIDGET_ACTIVATED)) { | 		if ($this->maniaControl->getSettingManager()->getSettingValue($this, self::SETTING_DONATE_WIDGET_ACTIVATED)) { | ||||||
| 			$this->displayDonateWidget(); | 			$this->displayDonateWidget(); | ||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
| @@ -146,19 +146,19 @@ class DonationPlugin implements CallbackListener, CommandListener, Plugin { | |||||||
| 	 * @param string $login | 	 * @param string $login | ||||||
| 	 */ | 	 */ | ||||||
| 	public function displayDonateWidget($login = null) { | 	public function displayDonateWidget($login = null) { | ||||||
| 		$posX              = $this->maniaControl->settingManager->getSettingValue($this, self::SETTING_DONATE_WIDGET_POSX); | 		$posX              = $this->maniaControl->getSettingManager()->getSettingValue($this, self::SETTING_DONATE_WIDGET_POSX); | ||||||
| 		$posY              = $this->maniaControl->settingManager->getSettingValue($this, self::SETTING_DONATE_WIDGET_POSY); | 		$posY              = $this->maniaControl->getSettingManager()->getSettingValue($this, self::SETTING_DONATE_WIDGET_POSY); | ||||||
| 		$width             = $this->maniaControl->settingManager->getSettingValue($this, self::SETTING_DONATE_WIDGET_WIDTH); | 		$width             = $this->maniaControl->getSettingManager()->getSettingValue($this, self::SETTING_DONATE_WIDGET_WIDTH); | ||||||
| 		$height            = $this->maniaControl->settingManager->getSettingValue($this, self::SETTING_DONATE_WIDGET_HEIGHT); | 		$height            = $this->maniaControl->getSettingManager()->getSettingValue($this, self::SETTING_DONATE_WIDGET_HEIGHT); | ||||||
| 		$values            = $this->maniaControl->settingManager->getSettingValue($this, self::SETTING_DONATION_VALUES); | 		$values            = $this->maniaControl->getSettingManager()->getSettingValue($this, self::SETTING_DONATION_VALUES); | ||||||
| 		$shootManiaOffset  = $this->maniaControl->manialinkManager->getStyleManager()->getDefaultIconOffsetSM(); | 		$shootManiaOffset  = $this->maniaControl->getManialinkManager()->getStyleManager()->getDefaultIconOffsetSM(); | ||||||
| 		$quadStyle         = $this->maniaControl->manialinkManager->getStyleManager()->getDefaultQuadStyle(); | 		$quadStyle         = $this->maniaControl->getManialinkManager()->getStyleManager()->getDefaultQuadStyle(); | ||||||
| 		$quadSubstyle      = $this->maniaControl->manialinkManager->getStyleManager()->getDefaultQuadSubstyle(); | 		$quadSubstyle      = $this->maniaControl->getManialinkManager()->getStyleManager()->getDefaultQuadSubstyle(); | ||||||
| 		$itemMarginFactorX = 1.3; | 		$itemMarginFactorX = 1.3; | ||||||
| 		$itemMarginFactorY = 1.2; | 		$itemMarginFactorY = 1.2; | ||||||
|  |  | ||||||
| 		//If game is shootmania lower the icons position by 20 | 		//If game is shootmania lower the icons position by 20 | ||||||
| 		if ($this->maniaControl->mapManager->getCurrentMap() | 		if ($this->maniaControl->getMapManager()->getCurrentMap() | ||||||
| 		                                   ->getGame() === 'sm' | 		                                   ->getGame() === 'sm' | ||||||
| 		) { | 		) { | ||||||
| 			$posY -= $shootManiaOffset; | 			$posY -= $shootManiaOffset; | ||||||
| @@ -238,14 +238,14 @@ class DonationPlugin implements CallbackListener, CommandListener, Plugin { | |||||||
| 		} | 		} | ||||||
|  |  | ||||||
| 		// Send manialink | 		// Send manialink | ||||||
| 		$this->maniaControl->manialinkManager->sendManialink($maniaLink, $login); | 		$this->maniaControl->getManialinkManager()->sendManialink($maniaLink, $login); | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	/** | 	/** | ||||||
| 	 * @see \ManiaControl\Plugins\Plugin::unload() | 	 * @see \ManiaControl\Plugins\Plugin::unload() | ||||||
| 	 */ | 	 */ | ||||||
| 	public function unload() { | 	public function unload() { | ||||||
| 		$this->maniaControl->manialinkManager->hideManialink(self::MLID_DONATE_WIDGET); | 		$this->maniaControl->getManialinkManager()->hideManialink(self::MLID_DONATE_WIDGET); | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	/** | 	/** | ||||||
| @@ -260,7 +260,7 @@ class DonationPlugin implements CallbackListener, CommandListener, Plugin { | |||||||
| 			return; | 			return; | ||||||
| 		} | 		} | ||||||
| 		$login       = $callback[1][1]; | 		$login       = $callback[1][1]; | ||||||
| 		$player      = $this->maniaControl->playerManager->getPlayer($login); | 		$player      = $this->maniaControl->getPlayerManager()->getPlayer($login); | ||||||
| 		$actionArray = explode(".", $callback[1][2]); | 		$actionArray = explode(".", $callback[1][2]); | ||||||
| 		$this->handleDonation($player, intval($actionArray[2])); | 		$this->handleDonation($player, intval($actionArray[2])); | ||||||
| 	} | 	} | ||||||
| @@ -277,42 +277,42 @@ class DonationPlugin implements CallbackListener, CommandListener, Plugin { | |||||||
| 		if ($amount > 1000000) { | 		if ($amount > 1000000) { | ||||||
| 			// Prevent too huge donation amounts that would cause xmlrpc parsing errors | 			// Prevent too huge donation amounts that would cause xmlrpc parsing errors | ||||||
| 			$message = "You can only donate 1.000.000 Planets at a time!"; | 			$message = "You can only donate 1.000.000 Planets at a time!"; | ||||||
| 			$this->maniaControl->chat->sendError($message, $player); | 			$this->maniaControl->getChat()->sendError($message, $player); | ||||||
| 			return; | 			return; | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
| 		if (!$receiverName) { | 		if (!$receiverName) { | ||||||
| 			$serverName = $this->maniaControl->client->getServerName(); | 			$serverName = $this->maniaControl->getClient()->getServerName(); | ||||||
| 			$message    = 'Donate ' . $amount . ' Planets to $<' . $serverName . '$>?'; | 			$message    = 'Donate ' . $amount . ' Planets to $<' . $serverName . '$>?'; | ||||||
| 		} else { | 		} else { | ||||||
| 			$message = 'Donate ' . $amount . ' Planets to $<' . $receiverName . '$>?'; | 			$message = 'Donate ' . $amount . ' Planets to $<' . $receiverName . '$>?'; | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
| 		//Send and Handle the Bill | 		//Send and Handle the Bill | ||||||
| 		$this->maniaControl->billManager->sendBill(function ($data, $status) use (&$player, $amount, $receiver) { | 		$this->maniaControl->getBillManager()->sendBill(function ($data, $status) use (&$player, $amount, $receiver) { | ||||||
| 			switch ($status) { | 			switch ($status) { | ||||||
| 				case BillManager::DONATED_TO_SERVER: | 				case BillManager::DONATED_TO_SERVER: | ||||||
| 					if ($this->maniaControl->settingManager->getSettingValue($this, DonationPlugin::SETTING_ANNOUNCE_SERVER_DONATION, true) && $amount >= $this->maniaControl->settingManager->getSettingValue($this, DonationPlugin::SETTING_MIN_AMOUNT_SHOWN, true)) { | 					if ($this->maniaControl->getSettingManager()->getSettingValue($this, DonationPlugin::SETTING_ANNOUNCE_SERVER_DONATION, true) && $amount >= $this->maniaControl->getSettingManager()->getSettingValue($this, DonationPlugin::SETTING_MIN_AMOUNT_SHOWN, true)) { | ||||||
| 						$login   = null; | 						$login   = null; | ||||||
| 						$message = '$<' . $player->nickname . '$> donated ' . $amount . ' Planets! Thanks.'; | 						$message = $player->getEscapedNickname() . ' donated ' . $amount . ' Planets! Thanks.'; | ||||||
| 					} else { | 					} else { | ||||||
| 						$login   = $player->login; | 						$login   = $player->login; | ||||||
| 						$message = 'Donation successful! Thanks.'; | 						$message = 'Donation successful! Thanks.'; | ||||||
| 					} | 					} | ||||||
| 					$this->maniaControl->chat->sendSuccess($message, $login); | 					$this->maniaControl->getChat()->sendSuccess($message, $login); | ||||||
| 					$this->maniaControl->statisticManager->insertStat(DonationPlugin::STAT_PLAYER_DONATIONS, $player, $this->maniaControl->server->index, $amount); | 					$this->maniaControl->getStatisticManager()->insertStat(DonationPlugin::STAT_PLAYER_DONATIONS, $player, $this->maniaControl->getServer()->index, $amount); | ||||||
| 					break; | 					break; | ||||||
| 				case BillManager::DONATED_TO_RECEIVER: | 				case BillManager::DONATED_TO_RECEIVER: | ||||||
| 					$message = "Successfully donated {$amount} to '{$receiver}'!"; | 					$message = "Successfully donated {$amount} to '{$receiver}'!"; | ||||||
| 					$this->maniaControl->chat->sendSuccess($message, $player->login); | 					$this->maniaControl->getChat()->sendSuccess($message, $player); | ||||||
| 					break; | 					break; | ||||||
| 				case BillManager::PLAYER_REFUSED_DONATION: | 				case BillManager::PLAYER_REFUSED_DONATION: | ||||||
| 					$message = 'Transaction cancelled.'; | 					$message = 'Transaction cancelled.'; | ||||||
| 					$this->maniaControl->chat->sendError($message, $player->login); | 					$this->maniaControl->getChat()->sendError($message, $player); | ||||||
| 					break; | 					break; | ||||||
| 				case BillManager::ERROR_WHILE_TRANSACTION: | 				case BillManager::ERROR_WHILE_TRANSACTION: | ||||||
| 					$message = $data; | 					$message = $data; | ||||||
| 					$this->maniaControl->chat->sendError($message, $player->login); | 					$this->maniaControl->getChat()->sendError($message, $player); | ||||||
| 					break; | 					break; | ||||||
| 			} | 			} | ||||||
| 		}, $player, $amount, $message); | 		}, $player, $amount, $message); | ||||||
| @@ -325,7 +325,7 @@ class DonationPlugin implements CallbackListener, CommandListener, Plugin { | |||||||
| 	 */ | 	 */ | ||||||
| 	public function handlePlayerConnect(Player $player) { | 	public function handlePlayerConnect(Player $player) { | ||||||
| 		// Display Map Widget | 		// Display Map Widget | ||||||
| 		if ($this->maniaControl->settingManager->getSettingValue($this, self::SETTING_DONATE_WIDGET_ACTIVATED)) { | 		if ($this->maniaControl->getSettingManager()->getSettingValue($this, self::SETTING_DONATE_WIDGET_ACTIVATED)) { | ||||||
| 			$this->displayDonateWidget($player->login); | 			$this->displayDonateWidget($player->login); | ||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
| @@ -350,11 +350,11 @@ class DonationPlugin implements CallbackListener, CommandListener, Plugin { | |||||||
| 		} | 		} | ||||||
| 		if (count($params) >= 3) { | 		if (count($params) >= 3) { | ||||||
| 			$receiver       = $params[2]; | 			$receiver       = $params[2]; | ||||||
| 			$receiverPlayer = $this->maniaControl->playerManager->getPlayer($receiver); | 			$receiverPlayer = $this->maniaControl->getPlayerManager()->getPlayer($receiver); | ||||||
| 			$receiverName   = ($receiverPlayer ? $receiverPlayer->nickname : $receiver); | 			$receiverName   = ($receiverPlayer ? $receiverPlayer->nickname : $receiver); | ||||||
| 		} else { | 		} else { | ||||||
| 			$receiver     = ''; | 			$receiver     = ''; | ||||||
| 			$receiverName = $this->maniaControl->client->getServerName(); | 			$receiverName = $this->maniaControl->getClient()->getServerName(); | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
| 		$this->handleDonation($player, $amount, $receiver, $receiverName); | 		$this->handleDonation($player, $amount, $receiver, $receiverName); | ||||||
| @@ -367,7 +367,7 @@ class DonationPlugin implements CallbackListener, CommandListener, Plugin { | |||||||
| 	 */ | 	 */ | ||||||
| 	private function sendDonateUsageExample(Player $player) { | 	private function sendDonateUsageExample(Player $player) { | ||||||
| 		$message = "Usage Example: '/donate 100'"; | 		$message = "Usage Example: '/donate 100'"; | ||||||
| 		$this->maniaControl->chat->sendChat($message, $player->login); | 		$this->maniaControl->getChat()->sendChat($message, $player); | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	/** | 	/** | ||||||
| @@ -377,8 +377,8 @@ class DonationPlugin implements CallbackListener, CommandListener, Plugin { | |||||||
| 	 * @param Player $player | 	 * @param Player $player | ||||||
| 	 */ | 	 */ | ||||||
| 	public function command_Pay(array $chatCallback, Player $player) { | 	public function command_Pay(array $chatCallback, Player $player) { | ||||||
| 		if (!$this->maniaControl->authenticationManager->checkRight($player, AuthenticationManager::AUTH_LEVEL_SUPERADMIN)) { | 		if (!$this->maniaControl->getAuthenticationManager()->checkRight($player, AuthenticationManager::AUTH_LEVEL_SUPERADMIN)) { | ||||||
| 			$this->maniaControl->authenticationManager->sendNotAllowed($player); | 			$this->maniaControl->getAuthenticationManager()->sendNotAllowed($player); | ||||||
| 			return; | 			return; | ||||||
| 		} | 		} | ||||||
| 		$text   = $chatCallback[1][2]; | 		$text   = $chatCallback[1][2]; | ||||||
| @@ -397,21 +397,21 @@ class DonationPlugin implements CallbackListener, CommandListener, Plugin { | |||||||
| 		} else { | 		} else { | ||||||
| 			$receiver = $player->login; | 			$receiver = $player->login; | ||||||
| 		} | 		} | ||||||
| 		$message = 'Payout from $<' . $this->maniaControl->client->getServerName() . '$>.'; | 		$message = 'Payout from $<' . $this->maniaControl->getClient()->getServerName() . '$>.'; | ||||||
|  |  | ||||||
| 		$this->maniaControl->billManager->sendPlanets(function ($data, $status) use (&$player, $amount, $receiver) { | 		$this->maniaControl->getBillManager()->sendPlanets(function ($data, $status) use (&$player, $amount, $receiver) { | ||||||
| 			switch ($status) { | 			switch ($status) { | ||||||
| 				case BillManager::PAYED_FROM_SERVER: | 				case BillManager::PAYED_FROM_SERVER: | ||||||
| 					$message = "Successfully payed out {$amount} to '{$receiver}'!"; | 					$message = "Successfully payed out {$amount} to '{$receiver}'!"; | ||||||
| 					$this->maniaControl->chat->sendSuccess($message, $player->login); | 					$this->maniaControl->getChat()->sendSuccess($message, $player); | ||||||
| 					break; | 					break; | ||||||
| 				case BillManager::PLAYER_REFUSED_DONATION: | 				case BillManager::PLAYER_REFUSED_DONATION: | ||||||
| 					$message = 'Transaction cancelled.'; | 					$message = 'Transaction cancelled.'; | ||||||
| 					$this->maniaControl->chat->sendError($message, $player->login); | 					$this->maniaControl->getChat()->sendError($message, $player); | ||||||
| 					break; | 					break; | ||||||
| 				case BillManager::ERROR_WHILE_TRANSACTION: | 				case BillManager::ERROR_WHILE_TRANSACTION: | ||||||
| 					$message = $data; | 					$message = $data; | ||||||
| 					$this->maniaControl->chat->sendError($message, $player->login); | 					$this->maniaControl->getChat()->sendError($message, $player); | ||||||
| 					break; | 					break; | ||||||
| 			} | 			} | ||||||
| 		}, $receiver, $amount, $message); | 		}, $receiver, $amount, $message); | ||||||
| @@ -424,7 +424,7 @@ class DonationPlugin implements CallbackListener, CommandListener, Plugin { | |||||||
| 	 */ | 	 */ | ||||||
| 	private function sendPayUsageExample(Player $player) { | 	private function sendPayUsageExample(Player $player) { | ||||||
| 		$message = "Usage Example: '//pay 100 login'"; | 		$message = "Usage Example: '//pay 100 login'"; | ||||||
| 		$this->maniaControl->chat->sendChat($message, $player->login); | 		$this->maniaControl->getChat()->sendChat($message, $player); | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	/** | 	/** | ||||||
| @@ -434,13 +434,13 @@ class DonationPlugin implements CallbackListener, CommandListener, Plugin { | |||||||
| 	 * @param Player $player | 	 * @param Player $player | ||||||
| 	 */ | 	 */ | ||||||
| 	public function command_GetPlanets(array $chatCallback, Player $player) { | 	public function command_GetPlanets(array $chatCallback, Player $player) { | ||||||
| 		if (!$this->maniaControl->authenticationManager->checkRight($player, AuthenticationManager::AUTH_LEVEL_ADMIN)) { | 		if (!$this->maniaControl->getAuthenticationManager()->checkRight($player, AuthenticationManager::AUTH_LEVEL_ADMIN)) { | ||||||
| 			$this->maniaControl->authenticationManager->sendNotAllowed($player); | 			$this->maniaControl->getAuthenticationManager()->sendNotAllowed($player); | ||||||
| 			return; | 			return; | ||||||
| 		} | 		} | ||||||
| 		$planets = $this->maniaControl->client->getServerPlanets(); | 		$planets = $this->maniaControl->getClient()->getServerPlanets(); | ||||||
| 		$message = "This Server has {$planets} Planets!"; | 		$message = "This Server has {$planets} Planets!"; | ||||||
| 		$this->maniaControl->chat->sendInformation($message, $player->login); | 		$this->maniaControl->getChat()->sendInformation($message, $player); | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	/** | 	/** | ||||||
| @@ -459,10 +459,10 @@ class DonationPlugin implements CallbackListener, CommandListener, Plugin { | |||||||
| 	 * @param Player $player | 	 * @param Player $player | ||||||
| 	 */ | 	 */ | ||||||
| 	private function showTopDonsList(Player $player) { | 	private function showTopDonsList(Player $player) { | ||||||
| 		$stats = $this->maniaControl->statisticManager->getStatsRanking(self::STAT_PLAYER_DONATIONS); | 		$stats = $this->maniaControl->getStatisticManager()->getStatsRanking(self::STAT_PLAYER_DONATIONS); | ||||||
|  |  | ||||||
| 		$width  = $this->maniaControl->manialinkManager->getStyleManager()->getListWidgetsWidth(); | 		$width  = $this->maniaControl->getManialinkManager()->getStyleManager()->getListWidgetsWidth(); | ||||||
| 		$height = $this->maniaControl->manialinkManager->getStyleManager()->getListWidgetsHeight(); | 		$height = $this->maniaControl->getManialinkManager()->getStyleManager()->getListWidgetsHeight(); | ||||||
|  |  | ||||||
| 		// create manialink | 		// create manialink | ||||||
| 		$maniaLink = new ManiaLink(ManialinkManager::MAIN_MLID); | 		$maniaLink = new ManiaLink(ManialinkManager::MAIN_MLID); | ||||||
| @@ -471,7 +471,7 @@ class DonationPlugin implements CallbackListener, CommandListener, Plugin { | |||||||
| 		$script->addFeature($paging); | 		$script->addFeature($paging); | ||||||
|  |  | ||||||
| 		// Main frame | 		// Main frame | ||||||
| 		$frame = $this->maniaControl->manialinkManager->getStyleManager()->getDefaultListFrame($script, $paging); | 		$frame = $this->maniaControl->getManialinkManager()->getStyleManager()->getDefaultListFrame($script, $paging); | ||||||
| 		$maniaLink->add($frame); | 		$maniaLink->add($frame); | ||||||
|  |  | ||||||
| 		// Start offsets | 		// Start offsets | ||||||
| @@ -479,7 +479,7 @@ class DonationPlugin implements CallbackListener, CommandListener, Plugin { | |||||||
| 		$posY = $height / 2; | 		$posY = $height / 2; | ||||||
|  |  | ||||||
| 		//Predefine description Label | 		//Predefine description Label | ||||||
| 		$descriptionLabel = $this->maniaControl->manialinkManager->getStyleManager()->getDefaultDescriptionLabel(); | 		$descriptionLabel = $this->maniaControl->getManialinkManager()->getStyleManager()->getDefaultDescriptionLabel(); | ||||||
| 		$frame->add($descriptionLabel); | 		$frame->add($descriptionLabel); | ||||||
|  |  | ||||||
| 		// Headline | 		// Headline | ||||||
| @@ -487,7 +487,7 @@ class DonationPlugin implements CallbackListener, CommandListener, Plugin { | |||||||
| 		$frame->add($headFrame); | 		$frame->add($headFrame); | ||||||
| 		$headFrame->setY($posY - 5); | 		$headFrame->setY($posY - 5); | ||||||
| 		$array = array('$oId' => $posX + 5, '$oNickname' => $posX + 18, '$oDonated planets' => $posX + 70); | 		$array = array('$oId' => $posX + 5, '$oNickname' => $posX + 18, '$oDonated planets' => $posX + 70); | ||||||
| 		$this->maniaControl->manialinkManager->labelLine($headFrame, $array); | 		$this->maniaControl->getManialinkManager()->labelLine($headFrame, $array); | ||||||
|  |  | ||||||
| 		$index     = 1; | 		$index     = 1; | ||||||
| 		$posY      = $posY - 10; | 		$posY      = $posY - 10; | ||||||
| @@ -513,9 +513,9 @@ class DonationPlugin implements CallbackListener, CommandListener, Plugin { | |||||||
| 				$lineQuad->setZ(0.001); | 				$lineQuad->setZ(0.001); | ||||||
| 			} | 			} | ||||||
|  |  | ||||||
| 			$donatingPlayer = $this->maniaControl->playerManager->getPlayerByIndex($playerIndex); | 			$donatingPlayer = $this->maniaControl->getPlayerManager()->getPlayerByIndex($playerIndex); | ||||||
| 			$array          = array($index => $posX + 5, $donatingPlayer->nickname => $posX + 18, $donations => $posX + 70); | 			$array          = array($index => $posX + 5, $donatingPlayer->nickname => $posX + 18, $donations => $posX + 70); | ||||||
| 			$this->maniaControl->manialinkManager->labelLine($playerFrame, $array); | 			$this->maniaControl->getManialinkManager()->labelLine($playerFrame, $array); | ||||||
|  |  | ||||||
| 			$posY -= 4; | 			$posY -= 4; | ||||||
| 			$index++; | 			$index++; | ||||||
| @@ -526,6 +526,6 @@ class DonationPlugin implements CallbackListener, CommandListener, Plugin { | |||||||
| 		} | 		} | ||||||
|  |  | ||||||
| 		// Render and display xml | 		// Render and display xml | ||||||
| 		$this->maniaControl->manialinkManager->displayWidget($maniaLink, $player, 'TopDons'); | 		$this->maniaControl->getManialinkManager()->displayWidget($maniaLink, $player, 'TopDons'); | ||||||
| 	} | 	} | ||||||
| } | } | ||||||
|   | |||||||
| @@ -52,11 +52,11 @@ class DynamicPointLimitPlugin implements CallbackListener, CommandListener, Plug | |||||||
| 	 * @see \ManiaControl\Plugins\Plugin::prepare() | 	 * @see \ManiaControl\Plugins\Plugin::prepare() | ||||||
| 	 */ | 	 */ | ||||||
| 	public static function prepare(ManiaControl $maniaControl) { | 	public static function prepare(ManiaControl $maniaControl) { | ||||||
| 		$maniaControl->settingManager->initSetting(get_class(), self::SETTING_POINT_LIMIT_MULTIPLIER, 10); | 		$maniaControl->getSettingManager()->initSetting(get_class(), self::SETTING_POINT_LIMIT_MULTIPLIER, 10); | ||||||
| 		$maniaControl->settingManager->initSetting(get_class(), self::SETTING_POINT_LIMIT_OFFSET, 0); | 		$maniaControl->getSettingManager()->initSetting(get_class(), self::SETTING_POINT_LIMIT_OFFSET, 0); | ||||||
| 		$maniaControl->settingManager->initSetting(get_class(), self::SETTING_MIN_POINT_LIMIT, 30); | 		$maniaControl->getSettingManager()->initSetting(get_class(), self::SETTING_MIN_POINT_LIMIT, 30); | ||||||
| 		$maniaControl->settingManager->initSetting(get_class(), self::SETTING_MAX_POINT_LIMIT, 200); | 		$maniaControl->getSettingManager()->initSetting(get_class(), self::SETTING_MAX_POINT_LIMIT, 200); | ||||||
| 		$maniaControl->settingManager->initSetting(get_class(), self::SETTING_ACCEPT_OTHER_MODES, false); | 		$maniaControl->getSettingManager()->initSetting(get_class(), self::SETTING_ACCEPT_OTHER_MODES, false); | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	/** | 	/** | ||||||
| @@ -100,21 +100,21 @@ class DynamicPointLimitPlugin implements CallbackListener, CommandListener, Plug | |||||||
| 	public function load(ManiaControl $maniaControl) { | 	public function load(ManiaControl $maniaControl) { | ||||||
| 		$this->maniaControl = $maniaControl; | 		$this->maniaControl = $maniaControl; | ||||||
|  |  | ||||||
| 		$allowOthers = $this->maniaControl->settingManager->getSettingValue($this, self::SETTING_ACCEPT_OTHER_MODES); | 		$allowOthers = $this->maniaControl->getSettingManager()->getSettingValue($this, self::SETTING_ACCEPT_OTHER_MODES); | ||||||
| 		if (!$allowOthers && $this->maniaControl->server->titleId !== 'SMStormRoyal@nadeolabs') { | 		if (!$allowOthers && $this->maniaControl->getServer()->titleId !== 'SMStormRoyal@nadeolabs') { | ||||||
| 			$error = 'This plugin only supports Royal (check Settings)!'; | 			$error = 'This plugin only supports Royal (check Settings)!'; | ||||||
| 			throw new \Exception($error); | 			throw new \Exception($error); | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
| 		$this->maniaControl->callbackManager->registerCallbackListener(PlayerManager::CB_PLAYERCONNECT, $this, 'updatePointLimit'); | 		$this->maniaControl->getCallbackManager()->registerCallbackListener(PlayerManager::CB_PLAYERCONNECT, $this, 'updatePointLimit'); | ||||||
| 		$this->maniaControl->callbackManager->registerCallbackListener(PlayerManager::CB_PLAYERDISCONNECT, $this, 'updatePointLimit'); | 		$this->maniaControl->getCallbackManager()->registerCallbackListener(PlayerManager::CB_PLAYERDISCONNECT, $this, 'updatePointLimit'); | ||||||
| 		$this->maniaControl->callbackManager->registerCallbackListener(PlayerManager::CB_PLAYERINFOCHANGED, $this, 'handlePlayerInfoChangedCallback'); | 		$this->maniaControl->getCallbackManager()->registerCallbackListener(PlayerManager::CB_PLAYERINFOCHANGED, $this, 'handlePlayerInfoChangedCallback'); | ||||||
|  |  | ||||||
| 		$this->maniaControl->callbackManager->registerCallbackListener(Callbacks::BEGINROUND, $this, 'updatePointLimit'); | 		$this->maniaControl->getCallbackManager()->registerCallbackListener(Callbacks::BEGINROUND, $this, 'updatePointLimit'); | ||||||
| 		$this->maniaControl->callbackManager->registerCallbackListener(Callbacks::BEGINMAP, $this, 'handleBeginMap'); | 		$this->maniaControl->getCallbackManager()->registerCallbackListener(Callbacks::BEGINMAP, $this, 'handleBeginMap'); | ||||||
| 		$this->maniaControl->callbackManager->registerCallbackListener(SettingManager::CB_SETTING_CHANGED, $this, 'handleSettingChangedCallback'); | 		$this->maniaControl->getCallbackManager()->registerCallbackListener(SettingManager::CB_SETTING_CHANGED, $this, 'handleSettingChangedCallback'); | ||||||
|  |  | ||||||
| 		$this->maniaControl->commandManager->registerCommandListener('setpointlimit', $this, 'commandSetPointlimit', true, 'Setpointlimit XXX or auto'); | 		$this->maniaControl->getCommandManager()->registerCommandListener('setpointlimit', $this, 'commandSetPointlimit', true, 'Setpointlimit XXX or auto'); | ||||||
|  |  | ||||||
| 		$this->updatePointLimit(); | 		$this->updatePointLimit(); | ||||||
| 	} | 	} | ||||||
| @@ -126,12 +126,12 @@ class DynamicPointLimitPlugin implements CallbackListener, CommandListener, Plug | |||||||
| 		if ($this->staticMode) { | 		if ($this->staticMode) { | ||||||
| 			return; | 			return; | ||||||
| 		} | 		} | ||||||
| 		$numberOfPlayers = $this->maniaControl->playerManager->getPlayerCount(); | 		$numberOfPlayers = $this->maniaControl->getPlayerManager()->getPlayerCount(); | ||||||
|  |  | ||||||
| 		$multiplier = $this->maniaControl->settingManager->getSettingValue($this, self::SETTING_POINT_LIMIT_MULTIPLIER); | 		$multiplier = $this->maniaControl->getSettingManager()->getSettingValue($this, self::SETTING_POINT_LIMIT_MULTIPLIER); | ||||||
| 		$offset     = $this->maniaControl->settingManager->getSettingValue($this, self::SETTING_POINT_LIMIT_OFFSET); | 		$offset     = $this->maniaControl->getSettingManager()->getSettingValue($this, self::SETTING_POINT_LIMIT_OFFSET); | ||||||
| 		$minValue   = $this->maniaControl->settingManager->getSettingValue($this, self::SETTING_MIN_POINT_LIMIT); | 		$minValue   = $this->maniaControl->getSettingManager()->getSettingValue($this, self::SETTING_MIN_POINT_LIMIT); | ||||||
| 		$maxValue   = $this->maniaControl->settingManager->getSettingValue($this, self::SETTING_MAX_POINT_LIMIT); | 		$maxValue   = $this->maniaControl->getSettingManager()->getSettingValue($this, self::SETTING_MAX_POINT_LIMIT); | ||||||
|  |  | ||||||
| 		$pointLimit = $offset + $numberOfPlayers * $multiplier; | 		$pointLimit = $offset + $numberOfPlayers * $multiplier; | ||||||
| 		if ($pointLimit < $minValue) { | 		if ($pointLimit < $minValue) { | ||||||
| @@ -144,15 +144,15 @@ class DynamicPointLimitPlugin implements CallbackListener, CommandListener, Plug | |||||||
|  |  | ||||||
| 		if ($this->lastPointLimit !== $pointLimit) { | 		if ($this->lastPointLimit !== $pointLimit) { | ||||||
| 			try { | 			try { | ||||||
| 				$this->maniaControl->client->setModeScriptSettings(array(self::SCRIPT_SETTING_MAP_POINTS_LIMIT => $pointLimit)); | 				$this->maniaControl->getClient()->setModeScriptSettings(array(self::SCRIPT_SETTING_MAP_POINTS_LIMIT => $pointLimit)); | ||||||
| 				$message = "Dynamic PointLimit changed to: {$pointLimit}!"; | 				$message = "Dynamic PointLimit changed to: {$pointLimit}!"; | ||||||
| 				if ($this->lastPointLimit !== null) { | 				if ($this->lastPointLimit !== null) { | ||||||
| 					$message .= " (From {$this->lastPointLimit})"; | 					$message .= " (From {$this->lastPointLimit})"; | ||||||
| 				} | 				} | ||||||
| 				$this->maniaControl->chat->sendInformation($message); | 				$this->maniaControl->getChat()->sendInformation($message); | ||||||
| 				$this->lastPointLimit = $pointLimit; | 				$this->lastPointLimit = $pointLimit; | ||||||
| 			} catch (GameModeException $exception) { | 			} catch (GameModeException $exception) { | ||||||
| 				$this->maniaControl->chat->sendExceptionToAdmins($exception); | 				$this->maniaControl->getChat()->sendExceptionToAdmins($exception); | ||||||
| 			} | 			} | ||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
| @@ -166,31 +166,31 @@ class DynamicPointLimitPlugin implements CallbackListener, CommandListener, Plug | |||||||
| 	public function commandSetPointlimit(array $chatCallback, Player $player) { | 	public function commandSetPointlimit(array $chatCallback, Player $player) { | ||||||
| 		$commandParts = explode(' ', $chatCallback[1][2]); | 		$commandParts = explode(' ', $chatCallback[1][2]); | ||||||
| 		if (count($commandParts) < 2) { | 		if (count($commandParts) < 2) { | ||||||
| 			$this->maniaControl->chat->sendUsageInfo('Example: //setpointlimit auto', $player); | 			$this->maniaControl->getChat()->sendUsageInfo('Example: //setpointlimit auto', $player); | ||||||
| 			return; | 			return; | ||||||
| 		} | 		} | ||||||
| 		$value = strtolower($commandParts[1]); | 		$value = strtolower($commandParts[1]); | ||||||
| 		if ($value === "auto") { | 		if ($value === "auto") { | ||||||
| 			$this->staticMode = false; | 			$this->staticMode = false; | ||||||
| 			$this->maniaControl->chat->sendInformation('Enabled Dynamic PointLimit!'); | 			$this->maniaControl->getChat()->sendInformation('Enabled Dynamic PointLimit!'); | ||||||
| 			$this->updatePointLimit(); | 			$this->updatePointLimit(); | ||||||
| 		} else { | 		} else { | ||||||
| 			if (is_numeric($value)) { | 			if (is_numeric($value)) { | ||||||
| 				$value = (int)$value; | 				$value = (int)$value; | ||||||
| 				if ($value <= 0) { | 				if ($value <= 0) { | ||||||
| 					$this->maniaControl->chat->sendError('PointLimit needs to be greater than Zero.', $player); | 					$this->maniaControl->getChat()->sendError('PointLimit needs to be greater than Zero.', $player); | ||||||
| 					return; | 					return; | ||||||
| 				} | 				} | ||||||
| 				try { | 				try { | ||||||
| 					$this->maniaControl->client->setModeScriptSettings(array(self::SCRIPT_SETTING_MAP_POINTS_LIMIT => $value)); | 					$this->maniaControl->getClient()->setModeScriptSettings(array(self::SCRIPT_SETTING_MAP_POINTS_LIMIT => $value)); | ||||||
| 					$this->staticMode     = true; | 					$this->staticMode     = true; | ||||||
| 					$this->lastPointLimit = $value; | 					$this->lastPointLimit = $value; | ||||||
| 					$this->maniaControl->chat->sendInformation("PointLimit changed to: {$value} (Fixed)"); | 					$this->maniaControl->getChat()->sendInformation("PointLimit changed to: {$value} (Fixed)"); | ||||||
| 				} catch (GameModeException $exception) { | 				} catch (GameModeException $exception) { | ||||||
| 					$this->maniaControl->chat->sendException($exception, $player); | 					$this->maniaControl->getChat()->sendException($exception, $player); | ||||||
| 				} | 				} | ||||||
| 			} else { | 			} else { | ||||||
| 				$this->maniaControl->chat->sendUsageInfo('Example: //setpointlimit 150', $player); | 				$this->maniaControl->getChat()->sendUsageInfo('Example: //setpointlimit 150', $player); | ||||||
| 			} | 			} | ||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
| @@ -220,9 +220,9 @@ class DynamicPointLimitPlugin implements CallbackListener, CommandListener, Plug | |||||||
| 		if ($this->staticMode && !is_null($this->lastPointLimit)) { | 		if ($this->staticMode && !is_null($this->lastPointLimit)) { | ||||||
| 			// Refresh static point limit in case it has been reset | 			// Refresh static point limit in case it has been reset | ||||||
| 			try { | 			try { | ||||||
| 				$this->maniaControl->client->setModeScriptSettings(array(self::SCRIPT_SETTING_MAP_POINTS_LIMIT => $this->lastPointLimit)); | 				$this->maniaControl->getClient()->setModeScriptSettings(array(self::SCRIPT_SETTING_MAP_POINTS_LIMIT => $this->lastPointLimit)); | ||||||
| 				$message = "PointLimit fixed at {$this->lastPointLimit}."; | 				$message = "PointLimit fixed at {$this->lastPointLimit}."; | ||||||
| 				$this->maniaControl->chat->sendInformation($message); | 				$this->maniaControl->getChat()->sendInformation($message); | ||||||
| 			} catch (GameModeException $e) { | 			} catch (GameModeException $e) { | ||||||
| 				$this->lastPointLimit = null; | 				$this->lastPointLimit = null; | ||||||
| 			} | 			} | ||||||
|   | |||||||
| @@ -80,13 +80,13 @@ class KarmaPlugin implements CallbackListener, TimerListener, Plugin { | |||||||
| 	 */ | 	 */ | ||||||
| 	public static function prepare(ManiaControl $maniaControl) { | 	public static function prepare(ManiaControl $maniaControl) { | ||||||
| 		$thisClass = get_class(); | 		$thisClass = get_class(); | ||||||
| 		$maniaControl->settingManager->initSetting($thisClass, self::SETTING_MX_KARMA_ACTIVATED, true); | 		$maniaControl->getSettingManager()->initSetting($thisClass, self::SETTING_MX_KARMA_ACTIVATED, true); | ||||||
| 		$maniaControl->settingManager->initSetting($thisClass, self::SETTING_MX_KARMA_IMPORTING, true); | 		$maniaControl->getSettingManager()->initSetting($thisClass, self::SETTING_MX_KARMA_IMPORTING, true); | ||||||
| 		$maniaControl->settingManager->initSetting($thisClass, self::SETTING_WIDGET_DISPLAY_MX, true); | 		$maniaControl->getSettingManager()->initSetting($thisClass, self::SETTING_WIDGET_DISPLAY_MX, true); | ||||||
| 		$servers = $maniaControl->server->getAllServers(); | 		$servers = $maniaControl->getServer()->getAllServers(); | ||||||
| 		foreach ($servers as $server) { | 		foreach ($servers as $server) { | ||||||
| 			$settingName = self::buildKarmaSettingName($server->login); | 			$settingName = self::buildKarmaSettingName($server->login); | ||||||
| 			$maniaControl->settingManager->initSetting($thisClass, $settingName, ''); | 			$maniaControl->getSettingManager()->initSetting($thisClass, $settingName, ''); | ||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| @@ -144,30 +144,30 @@ class KarmaPlugin implements CallbackListener, TimerListener, Plugin { | |||||||
| 		// Init database | 		// Init database | ||||||
| 		$this->initTables(); | 		$this->initTables(); | ||||||
|  |  | ||||||
| 		// Init settings | 		// Settings | ||||||
| 		$this->maniaControl->settingManager->initSetting($this, self::SETTING_AVAILABLE_VOTES, '-2,2'); | 		$this->maniaControl->getSettingManager()->initSetting($this, self::SETTING_AVAILABLE_VOTES, '-2,2'); | ||||||
| 		$this->maniaControl->settingManager->initSetting($this, self::SETTING_WIDGET_ENABLE, true); | 		$this->maniaControl->getSettingManager()->initSetting($this, self::SETTING_WIDGET_ENABLE, true); | ||||||
| 		$this->maniaControl->settingManager->initSetting($this, self::SETTING_WIDGET_TITLE, 'Map-Karma'); | 		$this->maniaControl->getSettingManager()->initSetting($this, self::SETTING_WIDGET_TITLE, 'Map-Karma'); | ||||||
| 		$this->maniaControl->settingManager->initSetting($this, self::SETTING_WIDGET_POSX, 160 - 27.5); | 		$this->maniaControl->getSettingManager()->initSetting($this, self::SETTING_WIDGET_POSX, 160 - 27.5); | ||||||
| 		$this->maniaControl->settingManager->initSetting($this, self::SETTING_WIDGET_POSY, 90 - 10 - 6); | 		$this->maniaControl->getSettingManager()->initSetting($this, self::SETTING_WIDGET_POSY, 90 - 10 - 6); | ||||||
| 		$this->maniaControl->settingManager->initSetting($this, self::SETTING_WIDGET_WIDTH, 25.); | 		$this->maniaControl->getSettingManager()->initSetting($this, self::SETTING_WIDGET_WIDTH, 25.); | ||||||
| 		$this->maniaControl->settingManager->initSetting($this, self::SETTING_WIDGET_HEIGHT, 12.); | 		$this->maniaControl->getSettingManager()->initSetting($this, self::SETTING_WIDGET_HEIGHT, 12.); | ||||||
| 		$this->maniaControl->settingManager->initSetting($this, self::SETTING_NEWKARMA, true); | 		$this->maniaControl->getSettingManager()->initSetting($this, self::SETTING_NEWKARMA, true); | ||||||
|  |  | ||||||
| 		// Register for callbacks | 		// Callbacks | ||||||
| 		$this->maniaControl->timerManager->registerTimerListening($this, 'handle1Second', 1000); | 		$this->maniaControl->getTimerManager()->registerTimerListening($this, 'handle1Second', 1000); | ||||||
| 		$this->maniaControl->callbackManager->registerCallbackListener(Callbacks::BEGINMAP, $this, 'handleBeginMap'); | 		$this->maniaControl->getCallbackManager()->registerCallbackListener(Callbacks::BEGINMAP, $this, 'handleBeginMap'); | ||||||
| 		$this->maniaControl->callbackManager->registerCallbackListener(Callbacks::BEGINMAP, $this, 'importMxKarmaVotes'); | 		$this->maniaControl->getCallbackManager()->registerCallbackListener(Callbacks::BEGINMAP, $this, 'importMxKarmaVotes'); | ||||||
| 		$this->maniaControl->callbackManager->registerCallbackListener(Callbacks::ENDMAP, $this, 'sendMxKarmaVotes'); | 		$this->maniaControl->getCallbackManager()->registerCallbackListener(Callbacks::ENDMAP, $this, 'sendMxKarmaVotes'); | ||||||
| 		$this->maniaControl->callbackManager->registerCallbackListener(PlayerManager::CB_PLAYERCONNECT, $this, 'handlePlayerConnect'); | 		$this->maniaControl->getCallbackManager()->registerCallbackListener(PlayerManager::CB_PLAYERCONNECT, $this, 'handlePlayerConnect'); | ||||||
| 		$this->maniaControl->callbackManager->registerCallbackListener(CallbackManager::CB_MP_PLAYERCHAT, $this, 'handlePlayerChat'); | 		$this->maniaControl->getCallbackManager()->registerCallbackListener(CallbackManager::CB_MP_PLAYERCHAT, $this, 'handlePlayerChat'); | ||||||
| 		$this->maniaControl->callbackManager->registerCallbackListener(SettingManager::CB_SETTING_CHANGED, $this, 'updateSettings'); | 		$this->maniaControl->getCallbackManager()->registerCallbackListener(SettingManager::CB_SETTING_CHANGED, $this, 'updateSettings'); | ||||||
|  |  | ||||||
| 		// Define player stats | 		// Define player stats | ||||||
| 		$this->maniaControl->statisticManager->defineStatMetaData(self::STAT_PLAYER_MAPVOTES); | 		$this->maniaControl->getStatisticManager()->defineStatMetaData(self::STAT_PLAYER_MAPVOTES); | ||||||
|  |  | ||||||
| 		// Register Stat in Simple StatsList | 		// Register Stat in Simple StatsList | ||||||
| 		$this->maniaControl->statisticManager->getSimpleStatsList()->registerStat(self::STAT_PLAYER_MAPVOTES, 100, "VM"); | 		$this->maniaControl->getStatisticManager()->getSimpleStatsList()->registerStat(self::STAT_PLAYER_MAPVOTES, 100, "VM"); | ||||||
|  |  | ||||||
| 		$this->updateManialink = true; | 		$this->updateManialink = true; | ||||||
|  |  | ||||||
| @@ -176,13 +176,13 @@ class KarmaPlugin implements CallbackListener, TimerListener, Plugin { | |||||||
| 		$this->mxKarma['startTime'] = time(); | 		$this->mxKarma['startTime'] = time(); | ||||||
|  |  | ||||||
| 		//Check if Karma Code got specified, and inform admin that it would be good to specify one | 		//Check if Karma Code got specified, and inform admin that it would be good to specify one | ||||||
| 		$serverLogin      = $this->maniaControl->server->login; | 		$serverLogin      = $this->maniaControl->getServer()->login; | ||||||
| 		$karmaSettingName = self::buildKarmaSettingName($serverLogin); | 		$karmaSettingName = self::buildKarmaSettingName($serverLogin); | ||||||
| 		$mxKarmaCode      = $this->maniaControl->settingManager->getSettingValue($this, $karmaSettingName); | 		$mxKarmaCode      = $this->maniaControl->getSettingManager()->getSettingValue($this, $karmaSettingName); | ||||||
|  |  | ||||||
| 		if (!$mxKarmaCode) { | 		if (!$mxKarmaCode) { | ||||||
| 			$permission = $this->maniaControl->settingManager->getSettingValue($this->maniaControl->authenticationManager, PluginMenu::SETTING_PERMISSION_CHANGE_PLUGIN_SETTINGS); | 			$permission = $this->maniaControl->getSettingManager()->getSettingValue($this->maniaControl->getAuthenticationManager(), PluginMenu::SETTING_PERMISSION_CHANGE_PLUGIN_SETTINGS); | ||||||
| 			$this->maniaControl->chat->sendErrorToAdmins("Please specify a Mania-Exchange Karma Key in the Karma-Plugin settings!", $permission); | 			$this->maniaControl->getChat()->sendErrorToAdmins("Please specify a Mania-Exchange Karma Key in the Karma-Plugin settings!", $permission); | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
| 		return true; | 		return true; | ||||||
| @@ -192,7 +192,7 @@ class KarmaPlugin implements CallbackListener, TimerListener, Plugin { | |||||||
| 	 * Create necessary database tables | 	 * Create necessary database tables | ||||||
| 	 */ | 	 */ | ||||||
| 	private function initTables() { | 	private function initTables() { | ||||||
| 		$mysqli = $this->maniaControl->database->mysqli; | 		$mysqli = $this->maniaControl->getDatabase()->getMysqli(); | ||||||
|  |  | ||||||
| 		// Create local table | 		// Create local table | ||||||
| 		$query = "CREATE TABLE IF NOT EXISTS `" . self::TABLE_KARMA . "` ( | 		$query = "CREATE TABLE IF NOT EXISTS `" . self::TABLE_KARMA . "` ( | ||||||
| @@ -228,13 +228,13 @@ class KarmaPlugin implements CallbackListener, TimerListener, Plugin { | |||||||
| 	 * Open a Mx Karma Session | 	 * Open a Mx Karma Session | ||||||
| 	 */ | 	 */ | ||||||
| 	private function mxKarmaOpenSession() { | 	private function mxKarmaOpenSession() { | ||||||
| 		if (!$this->maniaControl->settingManager->getSettingValue($this, self::SETTING_MX_KARMA_ACTIVATED)) { | 		if (!$this->maniaControl->getSettingManager()->getSettingValue($this, self::SETTING_MX_KARMA_ACTIVATED)) { | ||||||
| 			return; | 			return; | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
| 		$serverLogin      = $this->maniaControl->server->login; | 		$serverLogin      = $this->maniaControl->getServer()->login; | ||||||
| 		$karmaSettingName = self::buildKarmaSettingName($serverLogin); | 		$karmaSettingName = self::buildKarmaSettingName($serverLogin); | ||||||
| 		$mxKarmaCode      = $this->maniaControl->settingManager->getSettingValue($this, $karmaSettingName); | 		$mxKarmaCode      = $this->maniaControl->getSettingManager()->getSettingValue($this, $karmaSettingName); | ||||||
|  |  | ||||||
| 		if (!$mxKarmaCode) { | 		if (!$mxKarmaCode) { | ||||||
| 			return; | 			return; | ||||||
| @@ -250,15 +250,15 @@ class KarmaPlugin implements CallbackListener, TimerListener, Plugin { | |||||||
|  |  | ||||||
| 		$this->mxKarma['connectionInProgress'] = true; | 		$this->mxKarma['connectionInProgress'] = true; | ||||||
|  |  | ||||||
| 		$this->maniaControl->fileReader->loadFile($query, function ($json, $error) use ($mxKarmaCode) { | 		$this->maniaControl->getFileReader()->loadFile($query, function ($json, $error) use ($mxKarmaCode) { | ||||||
| 			$this->mxKarma['connectionInProgress'] = false; | 			$this->mxKarma['connectionInProgress'] = false; | ||||||
| 			if ($error) { | 			if ($error) { | ||||||
| 				$this->maniaControl->errorHandler->triggerDebugNotice('mx karma error: ' . $error); | 				$this->maniaControl->getErrorHandler()->triggerDebugNotice('mx karma error: ' . $error); | ||||||
| 				return; | 				return; | ||||||
| 			} | 			} | ||||||
| 			$data = json_decode($json); | 			$data = json_decode($json); | ||||||
| 			if (!$data) { | 			if (!$data) { | ||||||
| 				$this->maniaControl->errorHandler->triggerDebugNotice('auth error', $json, $data); | 				$this->maniaControl->getErrorHandler()->triggerDebugNotice('auth error', $json, $data); | ||||||
| 				return; | 				return; | ||||||
| 			} | 			} | ||||||
| 			if ($data->success) { | 			if ($data->success) { | ||||||
| @@ -267,7 +267,7 @@ class KarmaPlugin implements CallbackListener, TimerListener, Plugin { | |||||||
| 			} else { | 			} else { | ||||||
| 				$this->maniaControl->log("Error while authenticating on Mania-Exchange Karma"); | 				$this->maniaControl->log("Error while authenticating on Mania-Exchange Karma"); | ||||||
| 				// TODO remove temp trigger | 				// TODO remove temp trigger | ||||||
| 				$this->maniaControl->errorHandler->triggerDebugNotice('auth error', $data->data->message); | 				$this->maniaControl->getErrorHandler()->triggerDebugNotice('auth error', $data->data->message); | ||||||
| 				$this->mxKarma['connectionInProgress'] = false; | 				$this->mxKarma['connectionInProgress'] = false; | ||||||
| 			} | 			} | ||||||
| 		}, AsynchronousFileReader::CONTENT_TYPE_JSON, 1000); | 		}, AsynchronousFileReader::CONTENT_TYPE_JSON, 1000); | ||||||
| @@ -285,15 +285,15 @@ class KarmaPlugin implements CallbackListener, TimerListener, Plugin { | |||||||
| 		$query .= '?sessionKey=' . urlencode($this->mxKarma['session']->sessionKey); | 		$query .= '?sessionKey=' . urlencode($this->mxKarma['session']->sessionKey); | ||||||
| 		$query .= '&activationHash=' . urlencode($hash); | 		$query .= '&activationHash=' . urlencode($hash); | ||||||
|  |  | ||||||
| 		$this->maniaControl->fileReader->loadFile($query, function ($json, $error) use ($query) { | 		$this->maniaControl->getFileReader()->loadFile($query, function ($json, $error) use ($query) { | ||||||
| 			$this->mxKarma['connectionInProgress'] = false; | 			$this->mxKarma['connectionInProgress'] = false; | ||||||
| 			if ($error) { | 			if ($error) { | ||||||
| 				$this->maniaControl->errorHandler->triggerDebugNotice('mx karma error', $error); | 				$this->maniaControl->getErrorHandler()->triggerDebugNotice('mx karma error', $error); | ||||||
| 				return; | 				return; | ||||||
| 			} | 			} | ||||||
| 			$data = json_decode($json); | 			$data = json_decode($json); | ||||||
| 			if (!$data) { | 			if (!$data) { | ||||||
| 				$this->maniaControl->errorHandler->triggerDebugNotice('parse error', $json, $data); | 				$this->maniaControl->getErrorHandler()->triggerDebugNotice('parse error', $json, $data); | ||||||
| 				return; | 				return; | ||||||
| 			} | 			} | ||||||
| 			if ($data->success && $data->data->activated) { | 			if ($data->success && $data->data->activated) { | ||||||
| @@ -303,10 +303,10 @@ class KarmaPlugin implements CallbackListener, TimerListener, Plugin { | |||||||
| 				$this->getMxKarmaVotes(); | 				$this->getMxKarmaVotes(); | ||||||
| 			} else { | 			} else { | ||||||
| 				if ($data->data->message === 'invalid hash') { | 				if ($data->data->message === 'invalid hash') { | ||||||
| 					$permission = $this->maniaControl->settingManager->getSettingValue($this->maniaControl->authenticationManager, PluginMenu::SETTING_PERMISSION_CHANGE_PLUGIN_SETTINGS); | 					$permission = $this->maniaControl->getSettingManager()->getSettingValue($this->maniaControl->getAuthenticationManager(), PluginMenu::SETTING_PERMISSION_CHANGE_PLUGIN_SETTINGS); | ||||||
| 					$this->maniaControl->chat->sendErrorToAdmins("Invalid Mania-Exchange Karma code in Karma Plugin specified!", $permission); | 					$this->maniaControl->getChat()->sendErrorToAdmins("Invalid Mania-Exchange Karma code in Karma Plugin specified!", $permission); | ||||||
| 				} else { | 				} else { | ||||||
| 					$this->maniaControl->errorHandler->triggerDebugNotice('auth error', $data->data->message, $query); | 					$this->maniaControl->getErrorHandler()->triggerDebugNotice('auth error', $data->data->message, $query); | ||||||
| 				} | 				} | ||||||
| 				$this->maniaControl->log("Error while activating Mania-Exchange Karma Session: " . $data->data->message); | 				$this->maniaControl->log("Error while activating Mania-Exchange Karma Session: " . $data->data->message); | ||||||
| 				unset($this->mxKarma['session']); | 				unset($this->mxKarma['session']); | ||||||
| @@ -329,7 +329,7 @@ class KarmaPlugin implements CallbackListener, TimerListener, Plugin { | |||||||
| 	 * Fetch the mxKarmaVotes for the current map | 	 * Fetch the mxKarmaVotes for the current map | ||||||
| 	 */ | 	 */ | ||||||
| 	public function getMxKarmaVotes(Player $player = null) { | 	public function getMxKarmaVotes(Player $player = null) { | ||||||
| 		if (!$this->maniaControl->settingManager->getSettingValue($this, self::SETTING_MX_KARMA_ACTIVATED)) { | 		if (!$this->maniaControl->getSettingManager()->getSettingValue($this, self::SETTING_MX_KARMA_ACTIVATED)) { | ||||||
| 			return; | 			return; | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
| @@ -340,25 +340,25 @@ class KarmaPlugin implements CallbackListener, TimerListener, Plugin { | |||||||
| 			return; | 			return; | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
| 		$map = $this->maniaControl->mapManager->getCurrentMap(); | 		$map = $this->maniaControl->getMapManager()->getCurrentMap(); | ||||||
|  |  | ||||||
| 		$properties = array(); | 		$properties = array(); | ||||||
|  |  | ||||||
| 		$gameMode = $this->maniaControl->server->getGameMode(true); | 		$gameMode = $this->maniaControl->getServer()->getGameMode(true); | ||||||
| 		if ($gameMode === 'Script') { | 		if ($gameMode === 'Script') { | ||||||
| 			$scriptName             = $this->maniaControl->client->getScriptName(); | 			$scriptName             = $this->maniaControl->getClient()->getScriptName(); | ||||||
| 			$properties['gamemode'] = $scriptName['CurrentValue']; | 			$properties['gamemode'] = $scriptName['CurrentValue']; | ||||||
| 		} else { | 		} else { | ||||||
| 			$properties['gamemode'] = $gameMode; | 			$properties['gamemode'] = $gameMode; | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
| 		$properties['titleid'] = $this->maniaControl->server->titleId; | 		$properties['titleid'] = $this->maniaControl->getServer()->titleId; | ||||||
| 		$properties['mapuid']  = $map->uid; | 		$properties['mapuid']  = $map->uid; | ||||||
|  |  | ||||||
| 		if (!$player) { | 		if (!$player) { | ||||||
| 			$properties['getvotesonly'] = false; | 			$properties['getvotesonly'] = false; | ||||||
| 			$properties['playerlogins'] = array(); | 			$properties['playerlogins'] = array(); | ||||||
| 			foreach ($this->maniaControl->playerManager->getPlayers() as $loopPlayer) { | 			foreach ($this->maniaControl->getPlayerManager()->getPlayers() as $loopPlayer) { | ||||||
| 				$properties['playerlogins'][] = $loopPlayer->login; | 				$properties['playerlogins'][] = $loopPlayer->login; | ||||||
| 			} | 			} | ||||||
| 		} else { | 		} else { | ||||||
| @@ -367,18 +367,18 @@ class KarmaPlugin implements CallbackListener, TimerListener, Plugin { | |||||||
| 		} | 		} | ||||||
|  |  | ||||||
| 		$content = json_encode($properties); | 		$content = json_encode($properties); | ||||||
| 		$this->maniaControl->fileReader->postData(self::MX_KARMA_URL . self::MX_KARMA_GET_MAP_RATING . '?sessionKey=' . urlencode($this->mxKarma['session']->sessionKey), function ($json, | 		$this->maniaControl->getFileReader()->postData(self::MX_KARMA_URL . self::MX_KARMA_GET_MAP_RATING . '?sessionKey=' . urlencode($this->mxKarma['session']->sessionKey), function ($json, | ||||||
| 		                                                                                                                                                                            $error) use | 		                                                                                                                                                                            $error) use | ||||||
| 		( | 		( | ||||||
| 			&$player | 			&$player | ||||||
| 		) { | 		) { | ||||||
| 			if ($error) { | 			if ($error) { | ||||||
| 				$this->maniaControl->errorHandler->triggerDebugNotice('mx karma error', $error); | 				$this->maniaControl->getErrorHandler()->triggerDebugNotice('mx karma error', $error); | ||||||
| 				return; | 				return; | ||||||
| 			} | 			} | ||||||
| 			$data = json_decode($json); | 			$data = json_decode($json); | ||||||
| 			if (!$data) { | 			if (!$data) { | ||||||
| 				$this->maniaControl->errorHandler->triggerDebugNotice('parse error', $json, $data); | 				$this->maniaControl->getErrorHandler()->triggerDebugNotice('parse error', $json, $data); | ||||||
| 				return; | 				return; | ||||||
| 			} | 			} | ||||||
|  |  | ||||||
| @@ -396,7 +396,7 @@ class KarmaPlugin implements CallbackListener, TimerListener, Plugin { | |||||||
| 				} | 				} | ||||||
|  |  | ||||||
| 				$this->updateManialink = true; | 				$this->updateManialink = true; | ||||||
| 				$this->maniaControl->callbackManager->triggerCallback(self::CB_KARMA_MXUPDATED, $this->mxKarma); | 				$this->maniaControl->getCallbackManager()->triggerCallback(self::CB_KARMA_MXUPDATED, $this->mxKarma); | ||||||
| 				$this->maniaControl->log('MX-Karma Votes successfully fetched!'); | 				$this->maniaControl->log('MX-Karma Votes successfully fetched!'); | ||||||
| 			} else { | 			} else { | ||||||
| 				// Problem occurred | 				// Problem occurred | ||||||
| @@ -404,7 +404,7 @@ class KarmaPlugin implements CallbackListener, TimerListener, Plugin { | |||||||
| 				if ($data->data->message === 'invalid session') { | 				if ($data->data->message === 'invalid session') { | ||||||
| 					unset($this->mxKarma['session']); | 					unset($this->mxKarma['session']); | ||||||
| 				} else { | 				} else { | ||||||
| 					$this->maniaControl->errorHandler->triggerDebugNotice('fetch error', $data->data->message, self::MX_KARMA_GET_MAP_RATING, $this->mxKarma['session']); | 					$this->maniaControl->getErrorHandler()->triggerDebugNotice('fetch error', $data->data->message, self::MX_KARMA_GET_MAP_RATING, $this->mxKarma['session']); | ||||||
| 				} | 				} | ||||||
| 			} | 			} | ||||||
| 		}, $content, false, AsynchronousFileReader::CONTENT_TYPE_JSON); | 		}, $content, false, AsynchronousFileReader::CONTENT_TYPE_JSON); | ||||||
| @@ -414,7 +414,7 @@ class KarmaPlugin implements CallbackListener, TimerListener, Plugin { | |||||||
| 	 * @see \ManiaControl\Plugins\Plugin::unload() | 	 * @see \ManiaControl\Plugins\Plugin::unload() | ||||||
| 	 */ | 	 */ | ||||||
| 	public function unload() { | 	public function unload() { | ||||||
| 		$this->maniaControl->manialinkManager->hideManialink(self::MLID_KARMA); | 		$this->maniaControl->getManialinkManager()->hideManialink(self::MLID_KARMA); | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	/** | 	/** | ||||||
| @@ -425,7 +425,7 @@ class KarmaPlugin implements CallbackListener, TimerListener, Plugin { | |||||||
| 		if (isset($this->mxKarma['map'])) { | 		if (isset($this->mxKarma['map'])) { | ||||||
| 			$votes = array(); | 			$votes = array(); | ||||||
| 			foreach ($this->mxKarma['votes'] as $login => $value) { | 			foreach ($this->mxKarma['votes'] as $login => $value) { | ||||||
| 				$player = $this->maniaControl->playerManager->getPlayer($login); | 				$player = $this->maniaControl->getPlayerManager()->getPlayer($login); | ||||||
| 				array_push($votes, array('login' => $login, 'nickname' => $player->rawNickname, 'vote' => $value)); | 				array_push($votes, array('login' => $login, 'nickname' => $player->rawNickname, 'vote' => $value)); | ||||||
| 			} | 			} | ||||||
| 			$this->postKarmaVotes($this->mxKarma['map'], $votes); | 			$this->postKarmaVotes($this->mxKarma['map'], $votes); | ||||||
| @@ -455,7 +455,7 @@ class KarmaPlugin implements CallbackListener, TimerListener, Plugin { | |||||||
| 			return; | 			return; | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
| 		$gameMode = $this->maniaControl->server->getGameMode(true); | 		$gameMode = $this->maniaControl->getServer()->getGameMode(true); | ||||||
|  |  | ||||||
| 		if (empty($votes)) { | 		if (empty($votes)) { | ||||||
| 			return; | 			return; | ||||||
| @@ -463,7 +463,7 @@ class KarmaPlugin implements CallbackListener, TimerListener, Plugin { | |||||||
|  |  | ||||||
| 		$properties = array(); | 		$properties = array(); | ||||||
| 		if ($gameMode === 'Script') { | 		if ($gameMode === 'Script') { | ||||||
| 			$scriptName             = $this->maniaControl->client->getScriptName(); | 			$scriptName             = $this->maniaControl->getClient()->getScriptName(); | ||||||
| 			$properties['gamemode'] = $scriptName['CurrentValue']; | 			$properties['gamemode'] = $scriptName['CurrentValue']; | ||||||
| 		} else { | 		} else { | ||||||
| 			$properties['gamemode'] = $gameMode; | 			$properties['gamemode'] = $gameMode; | ||||||
| @@ -476,7 +476,7 @@ class KarmaPlugin implements CallbackListener, TimerListener, Plugin { | |||||||
| 		} | 		} | ||||||
|  |  | ||||||
| 		$properties['votes']     = $votes; | 		$properties['votes']     = $votes; | ||||||
| 		$properties['titleid']   = $this->maniaControl->server->titleId; | 		$properties['titleid']   = $this->maniaControl->getServer()->titleId; | ||||||
| 		$properties['mapname']   = $map->rawName; | 		$properties['mapname']   = $map->rawName; | ||||||
| 		$properties['mapuid']    = $map->uid; | 		$properties['mapuid']    = $map->uid; | ||||||
| 		$properties['mapauthor'] = $map->authorLogin; | 		$properties['mapauthor'] = $map->authorLogin; | ||||||
| @@ -484,15 +484,15 @@ class KarmaPlugin implements CallbackListener, TimerListener, Plugin { | |||||||
|  |  | ||||||
| 		$content = json_encode($properties); | 		$content = json_encode($properties); | ||||||
|  |  | ||||||
| 		$this->maniaControl->fileReader->postData(self::MX_KARMA_URL . self::MX_KARMA_SAVE_VOTES . "?sessionKey=" . urlencode($this->mxKarma['session']->sessionKey), function ($json, | 		$this->maniaControl->getFileReader()->postData(self::MX_KARMA_URL . self::MX_KARMA_SAVE_VOTES . "?sessionKey=" . urlencode($this->mxKarma['session']->sessionKey), function ($json, | ||||||
| 		                                                                                                                                                                        $error) { | 		                                                                                                                                                                        $error) { | ||||||
| 			if ($error) { | 			if ($error) { | ||||||
| 				$this->maniaControl->errorHandler->triggerDebugNotice('mx karma error', $error); | 				$this->maniaControl->getErrorHandler()->triggerDebugNotice('mx karma error', $error); | ||||||
| 				return; | 				return; | ||||||
| 			} | 			} | ||||||
| 			$data = json_decode($json); | 			$data = json_decode($json); | ||||||
| 			if (!$data) { | 			if (!$data) { | ||||||
| 				$this->maniaControl->errorHandler->triggerDebugNotice('parse error', $json, $data); | 				$this->maniaControl->getErrorHandler()->triggerDebugNotice('parse error', $json, $data); | ||||||
| 				return; | 				return; | ||||||
| 			} | 			} | ||||||
| 			if ($data->success) { | 			if ($data->success) { | ||||||
| @@ -503,7 +503,7 @@ class KarmaPlugin implements CallbackListener, TimerListener, Plugin { | |||||||
| 				if ($data->data->message === "invalid session") { | 				if ($data->data->message === "invalid session") { | ||||||
| 					unset($this->mxKarma['session']); | 					unset($this->mxKarma['session']); | ||||||
| 				} else { | 				} else { | ||||||
| 					$this->maniaControl->errorHandler->triggerDebugNotice('saving error', $data->data->message, self::MX_KARMA_SAVE_VOTES, $this->mxKarma['session']); | 					$this->maniaControl->getErrorHandler()->triggerDebugNotice('saving error', $data->data->message, self::MX_KARMA_SAVE_VOTES, $this->mxKarma['session']); | ||||||
| 				} | 				} | ||||||
| 			} | 			} | ||||||
| 		}, $content, false, AsynchronousFileReader::CONTENT_TYPE_JSON); | 		}, $content, false, AsynchronousFileReader::CONTENT_TYPE_JSON); | ||||||
| @@ -546,7 +546,7 @@ class KarmaPlugin implements CallbackListener, TimerListener, Plugin { | |||||||
| 	 */ | 	 */ | ||||||
| 	public function handlePlayerChat(array $chatCallback) { | 	public function handlePlayerChat(array $chatCallback) { | ||||||
| 		$login  = $chatCallback[1][1]; | 		$login  = $chatCallback[1][1]; | ||||||
| 		$player = $this->maniaControl->playerManager->getPlayer($login); | 		$player = $this->maniaControl->getPlayerManager()->getPlayer($login); | ||||||
| 		if (!$player) { | 		if (!$player) { | ||||||
| 			return; | 			return; | ||||||
| 		} | 		} | ||||||
| @@ -565,10 +565,10 @@ class KarmaPlugin implements CallbackListener, TimerListener, Plugin { | |||||||
| 		$vote    = $countPositive - $countNegative; | 		$vote    = $countPositive - $countNegative; | ||||||
| 		$success = $this->handleVote($player, $vote); | 		$success = $this->handleVote($player, $vote); | ||||||
| 		if (!$success) { | 		if (!$success) { | ||||||
| 			$this->maniaControl->chat->sendError('Error occurred.', $player->login); | 			$this->maniaControl->getChat()->sendError('Error occurred.', $player->login); | ||||||
| 			return; | 			return; | ||||||
| 		} | 		} | ||||||
| 		$this->maniaControl->chat->sendSuccess('Vote updated!', $player->login); | 		$this->maniaControl->getChat()->sendSuccess('Vote updated!', $player->login); | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	/** | 	/** | ||||||
| @@ -580,7 +580,7 @@ class KarmaPlugin implements CallbackListener, TimerListener, Plugin { | |||||||
| 	 */ | 	 */ | ||||||
| 	private function handleVote(Player $player, $vote) { | 	private function handleVote(Player $player, $vote) { | ||||||
| 		// Check vote | 		// Check vote | ||||||
| 		$votesSetting = $this->maniaControl->settingManager->getSettingValue($this, self::SETTING_AVAILABLE_VOTES); | 		$votesSetting = $this->maniaControl->getSettingManager()->getSettingValue($this, self::SETTING_AVAILABLE_VOTES); | ||||||
| 		$votes        = explode(',', $votesSetting); | 		$votes        = explode(',', $votesSetting); | ||||||
| 		$voteLow      = intval($votes[0]); | 		$voteLow      = intval($votes[0]); | ||||||
| 		$voteHigh     = $voteLow + 2; | 		$voteHigh     = $voteLow + 2; | ||||||
| @@ -597,10 +597,10 @@ class KarmaPlugin implements CallbackListener, TimerListener, Plugin { | |||||||
| 		$vote /= $voteHigh; | 		$vote /= $voteHigh; | ||||||
|  |  | ||||||
| 		// Save vote | 		// Save vote | ||||||
| 		$map = $this->maniaControl->mapManager->getCurrentMap(); | 		$map = $this->maniaControl->getMapManager()->getCurrentMap(); | ||||||
|  |  | ||||||
| 		// Update vote in MX karma array | 		// Update vote in MX karma array | ||||||
| 		if ($this->maniaControl->settingManager->getSettingValue($this, self::SETTING_MX_KARMA_ACTIVATED) && isset($this->mxKarma['session'])) { | 		if ($this->maniaControl->getSettingManager()->getSettingValue($this, self::SETTING_MX_KARMA_ACTIVATED) && isset($this->mxKarma['session'])) { | ||||||
| 			if (!isset($this->mxKarma['votes'][$player->login])) { | 			if (!isset($this->mxKarma['votes'][$player->login])) { | ||||||
| 				if (!isset($this->mxKarma['voteCount'])) { | 				if (!isset($this->mxKarma['voteCount'])) { | ||||||
| 					$this->mxKarma['voteCount'] = 0; | 					$this->mxKarma['voteCount'] = 0; | ||||||
| @@ -633,14 +633,14 @@ class KarmaPlugin implements CallbackListener, TimerListener, Plugin { | |||||||
|  |  | ||||||
| 		$voted = $this->getPlayerVote($player, $map); | 		$voted = $this->getPlayerVote($player, $map); | ||||||
| 		if (!$voted) { | 		if (!$voted) { | ||||||
| 			$this->maniaControl->statisticManager->incrementStat(self::STAT_PLAYER_MAPVOTES, $player, $this->maniaControl->server->index); | 			$this->maniaControl->getStatisticManager()->incrementStat(self::STAT_PLAYER_MAPVOTES, $player, $this->maniaControl->getServer()->index); | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
| 		$success = $this->savePlayerVote($player, $map, $vote); | 		$success = $this->savePlayerVote($player, $map, $vote); | ||||||
| 		if (!$success) { | 		if (!$success) { | ||||||
| 			return false; | 			return false; | ||||||
| 		} | 		} | ||||||
| 		$this->maniaControl->callbackManager->triggerCallback(self::CB_KARMA_CHANGED); | 		$this->maniaControl->getCallbackManager()->triggerCallback(self::CB_KARMA_CHANGED); | ||||||
| 		$this->updateManialink = true; | 		$this->updateManialink = true; | ||||||
| 		return true; | 		return true; | ||||||
| 	} | 	} | ||||||
| @@ -653,7 +653,7 @@ class KarmaPlugin implements CallbackListener, TimerListener, Plugin { | |||||||
| 	 * @return int | 	 * @return int | ||||||
| 	 */ | 	 */ | ||||||
| 	public function getPlayerVote(Player $player, Map $map) { | 	public function getPlayerVote(Player $player, Map $map) { | ||||||
| 		$mysqli = $this->maniaControl->database->mysqli; | 		$mysqli = $this->maniaControl->getDatabase()->getMysqli(); | ||||||
| 		$query  = "SELECT * FROM `" . self::TABLE_KARMA . "` | 		$query  = "SELECT * FROM `" . self::TABLE_KARMA . "` | ||||||
| 				WHERE `playerIndex` = {$player->index} | 				WHERE `playerIndex` = {$player->index} | ||||||
| 				AND `mapIndex` = {$map->index} | 				AND `mapIndex` = {$map->index} | ||||||
| @@ -682,7 +682,7 @@ class KarmaPlugin implements CallbackListener, TimerListener, Plugin { | |||||||
| 	 * @return bool | 	 * @return bool | ||||||
| 	 */ | 	 */ | ||||||
| 	private function savePlayerVote(Player $player, Map $map, $vote) { | 	private function savePlayerVote(Player $player, Map $map, $vote) { | ||||||
| 		$mysqli = $this->maniaControl->database->mysqli; | 		$mysqli = $this->maniaControl->getDatabase()->getMysqli(); | ||||||
| 		$query  = "INSERT INTO `" . self::TABLE_KARMA . "` ( | 		$query  = "INSERT INTO `" . self::TABLE_KARMA . "` ( | ||||||
| 				`mapIndex`, | 				`mapIndex`, | ||||||
| 				`playerIndex`, | 				`playerIndex`, | ||||||
| @@ -709,10 +709,10 @@ class KarmaPlugin implements CallbackListener, TimerListener, Plugin { | |||||||
| 	 * @return array | 	 * @return array | ||||||
| 	 */ | 	 */ | ||||||
| 	public function getMapPlayerVotes(Map $map) { | 	public function getMapPlayerVotes(Map $map) { | ||||||
| 		$mysqli = $this->maniaControl->database->mysqli; | 		$mysqli = $this->maniaControl->getDatabase()->getMysqli(); | ||||||
| 		$query  = "SELECT * FROM `" . self::TABLE_KARMA . "` | 		$query  = "SELECT * FROM `" . self::TABLE_KARMA . "` | ||||||
| 				WHERE `mapIndex` = {$map->index} | 				WHERE `mapIndex` = {$map->index} | ||||||
| 				AND `vote` >= 0"; | 				AND `vote` >= 0;"; | ||||||
| 		$result = $mysqli->query($query); | 		$result = $mysqli->query($query); | ||||||
| 		if ($mysqli->error) { | 		if ($mysqli->error) { | ||||||
| 			trigger_error($mysqli->error); | 			trigger_error($mysqli->error); | ||||||
| @@ -721,7 +721,7 @@ class KarmaPlugin implements CallbackListener, TimerListener, Plugin { | |||||||
|  |  | ||||||
| 		$votes = array(); | 		$votes = array(); | ||||||
| 		while ($vote = $result->fetch_object()) { | 		while ($vote = $result->fetch_object()) { | ||||||
| 			$player    = $this->maniaControl->playerManager->getPlayerByIndex($vote->playerIndex); | 			$player    = $this->maniaControl->getPlayerManager()->getPlayerByIndex($vote->playerIndex); | ||||||
| 			$karma     = $vote->vote; | 			$karma     = $vote->vote; | ||||||
| 			$voteArray = array('player' => $player, 'karma' => $karma); | 			$voteArray = array('player' => $player, 'karma' => $karma); | ||||||
| 			array_push($votes, $voteArray); | 			array_push($votes, $voteArray); | ||||||
| @@ -745,7 +745,7 @@ class KarmaPlugin implements CallbackListener, TimerListener, Plugin { | |||||||
| 			return; | 			return; | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
| 		$serverLogin      = $this->maniaControl->server->login; | 		$serverLogin      = $this->maniaControl->getServer()->login; | ||||||
| 		$karmaSettingName = self::buildKarmaSettingName($serverLogin); | 		$karmaSettingName = self::buildKarmaSettingName($serverLogin); | ||||||
|  |  | ||||||
| 		switch ($setting->setting) { | 		switch ($setting->setting) { | ||||||
| @@ -761,7 +761,7 @@ class KarmaPlugin implements CallbackListener, TimerListener, Plugin { | |||||||
| 					$this->handle1Second(time()); | 					$this->handle1Second(time()); | ||||||
| 				} else { | 				} else { | ||||||
| 					$this->updateManialink = false; | 					$this->updateManialink = false; | ||||||
| 					$this->maniaControl->manialinkManager->hideManialink(self::MLID_KARMA); | 					$this->maniaControl->getManialinkManager()->hideManialink(self::MLID_KARMA); | ||||||
| 				} | 				} | ||||||
| 				break; | 				break; | ||||||
| 			} | 			} | ||||||
| @@ -776,17 +776,17 @@ class KarmaPlugin implements CallbackListener, TimerListener, Plugin { | |||||||
| 			return; | 			return; | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
| 		$displayMxKarma = $this->maniaControl->settingManager->getSettingValue($this, self::SETTING_WIDGET_DISPLAY_MX); | 		$displayMxKarma = $this->maniaControl->getSettingManager()->getSettingValue($this, self::SETTING_WIDGET_DISPLAY_MX); | ||||||
|  |  | ||||||
| 		// Get players | 		// Get players | ||||||
| 		$players = $this->updateManialink; | 		$players = $this->updateManialink; | ||||||
| 		if ($players === true) { | 		if ($players === true) { | ||||||
| 			$players = $this->maniaControl->playerManager->getPlayers(); | 			$players = $this->maniaControl->getPlayerManager()->getPlayers(); | ||||||
| 		} | 		} | ||||||
| 		$this->updateManialink = false; | 		$this->updateManialink = false; | ||||||
|  |  | ||||||
| 		// Get map karma | 		// Get map karma | ||||||
| 		$map = $this->maniaControl->mapManager->getCurrentMap(); | 		$map = $this->maniaControl->getMapManager()->getCurrentMap(); | ||||||
|  |  | ||||||
| 		// Display the mx Karma if the setting is chosen and the MX session is available | 		// Display the mx Karma if the setting is chosen and the MX session is available | ||||||
| 		if ($displayMxKarma && isset($this->mxKarma['session']) && isset($this->mxKarma['voteCount'])) { | 		if ($displayMxKarma && isset($this->mxKarma['session']) && isset($this->mxKarma['voteCount'])) { | ||||||
| @@ -798,7 +798,7 @@ class KarmaPlugin implements CallbackListener, TimerListener, Plugin { | |||||||
| 			$voteCount = $votes['count']; | 			$voteCount = $votes['count']; | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
| 		if ($this->maniaControl->settingManager->getSettingValue($this, self::SETTING_WIDGET_ENABLE)) { | 		if ($this->maniaControl->getSettingManager()->getSettingValue($this, self::SETTING_WIDGET_ENABLE)) { | ||||||
| 			// Build karma manialink | 			// Build karma manialink | ||||||
| 			$this->buildManialink(); | 			$this->buildManialink(); | ||||||
|  |  | ||||||
| @@ -832,7 +832,7 @@ class KarmaPlugin implements CallbackListener, TimerListener, Plugin { | |||||||
| 				// $votesFrame->removeChildren(); | 				// $votesFrame->removeChildren(); | ||||||
|  |  | ||||||
| 				// Send manialink | 				// Send manialink | ||||||
| 				$this->maniaControl->manialinkManager->sendManialink($this->manialink, $login); | 				$this->maniaControl->getManialinkManager()->sendManialink($this->manialink, $login); | ||||||
| 			} | 			} | ||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
| @@ -844,7 +844,7 @@ class KarmaPlugin implements CallbackListener, TimerListener, Plugin { | |||||||
| 	 * @return float | bool | 	 * @return float | bool | ||||||
| 	 */ | 	 */ | ||||||
| 	public function getMapKarma(Map $map) { | 	public function getMapKarma(Map $map) { | ||||||
| 		$mysqli = $this->maniaControl->database->mysqli; | 		$mysqli = $this->maniaControl->getDatabase()->getMysqli(); | ||||||
| 		$query  = "SELECT AVG(`vote`) AS `karma` FROM `" . self::TABLE_KARMA . "` | 		$query  = "SELECT AVG(`vote`) AS `karma` FROM `" . self::TABLE_KARMA . "` | ||||||
| 				WHERE `mapIndex` = {$map->index} | 				WHERE `mapIndex` = {$map->index} | ||||||
| 				AND `vote` >= 0;"; | 				AND `vote` >= 0;"; | ||||||
| @@ -873,7 +873,7 @@ class KarmaPlugin implements CallbackListener, TimerListener, Plugin { | |||||||
| 	 * @return array | 	 * @return array | ||||||
| 	 */ | 	 */ | ||||||
| 	public function getMapVotes(Map $map) { | 	public function getMapVotes(Map $map) { | ||||||
| 		$mysqli = $this->maniaControl->database->mysqli; | 		$mysqli = $this->maniaControl->getDatabase()->getMysqli(); | ||||||
| 		$query  = "SELECT `vote`, COUNT(`vote`) AS `count` FROM `" . self::TABLE_KARMA . "` | 		$query  = "SELECT `vote`, COUNT(`vote`) AS `count` FROM `" . self::TABLE_KARMA . "` | ||||||
| 				WHERE `mapIndex` = {$map->index} | 				WHERE `mapIndex` = {$map->index} | ||||||
| 				AND `vote` >= 0 | 				AND `vote` >= 0 | ||||||
| @@ -904,14 +904,14 @@ class KarmaPlugin implements CallbackListener, TimerListener, Plugin { | |||||||
| 			return; | 			return; | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
| 		$title        = $this->maniaControl->settingManager->getSettingValue($this, self::SETTING_WIDGET_TITLE); | 		$title        = $this->maniaControl->getSettingManager()->getSettingValue($this, self::SETTING_WIDGET_TITLE); | ||||||
| 		$posX         = $this->maniaControl->settingManager->getSettingValue($this, self::SETTING_WIDGET_POSX); | 		$posX         = $this->maniaControl->getSettingManager()->getSettingValue($this, self::SETTING_WIDGET_POSX); | ||||||
| 		$posY         = $this->maniaControl->settingManager->getSettingValue($this, self::SETTING_WIDGET_POSY); | 		$posY         = $this->maniaControl->getSettingManager()->getSettingValue($this, self::SETTING_WIDGET_POSY); | ||||||
| 		$width        = $this->maniaControl->settingManager->getSettingValue($this, self::SETTING_WIDGET_WIDTH); | 		$width        = $this->maniaControl->getSettingManager()->getSettingValue($this, self::SETTING_WIDGET_WIDTH); | ||||||
| 		$height       = $this->maniaControl->settingManager->getSettingValue($this, self::SETTING_WIDGET_HEIGHT); | 		$height       = $this->maniaControl->getSettingManager()->getSettingValue($this, self::SETTING_WIDGET_HEIGHT); | ||||||
| 		$labelStyle   = $this->maniaControl->manialinkManager->getStyleManager()->getDefaultLabelStyle(); | 		$labelStyle   = $this->maniaControl->getManialinkManager()->getStyleManager()->getDefaultLabelStyle(); | ||||||
| 		$quadStyle    = $this->maniaControl->manialinkManager->getStyleManager()->getDefaultQuadStyle(); | 		$quadStyle    = $this->maniaControl->getManialinkManager()->getStyleManager()->getDefaultQuadStyle(); | ||||||
| 		$quadSubstyle = $this->maniaControl->manialinkManager->getStyleManager()->getDefaultQuadSubstyle(); | 		$quadSubstyle = $this->maniaControl->getManialinkManager()->getStyleManager()->getDefaultQuadSubstyle(); | ||||||
|  |  | ||||||
| 		$manialink = new ManiaLink(self::MLID_KARMA); | 		$manialink = new ManiaLink(self::MLID_KARMA); | ||||||
|  |  | ||||||
| @@ -962,11 +962,11 @@ class KarmaPlugin implements CallbackListener, TimerListener, Plugin { | |||||||
| 	 * @param Map $map | 	 * @param Map $map | ||||||
| 	 */ | 	 */ | ||||||
| 	public function importMxKarmaVotes(Map $map) { | 	public function importMxKarmaVotes(Map $map) { | ||||||
| 		if (!$this->maniaControl->settingManager->getSettingValue($this, self::SETTING_MX_KARMA_ACTIVATED)) { | 		if (!$this->maniaControl->getSettingManager()->getSettingValue($this, self::SETTING_MX_KARMA_ACTIVATED)) { | ||||||
| 			return; | 			return; | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
| 		if (!$this->maniaControl->settingManager->getSettingValue($this, self::SETTING_MX_KARMA_IMPORTING)) { | 		if (!$this->maniaControl->getSettingManager()->getSettingValue($this, self::SETTING_MX_KARMA_IMPORTING)) { | ||||||
| 			return; | 			return; | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
| @@ -977,7 +977,7 @@ class KarmaPlugin implements CallbackListener, TimerListener, Plugin { | |||||||
| 			return; | 			return; | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
| 		$mysqli = $this->maniaControl->database->mysqli; | 		$mysqli = $this->maniaControl->getDatabase()->getMysqli(); | ||||||
| 		$query  = "SELECT `mapImported` FROM `" . self::MX_IMPORT_TABLE . "` | 		$query  = "SELECT `mapImported` FROM `" . self::MX_IMPORT_TABLE . "` | ||||||
| 				WHERE `mapIndex` = {$map->index};"; | 				WHERE `mapIndex` = {$map->index};"; | ||||||
| 		$result = $mysqli->query($query); | 		$result = $mysqli->query($query); | ||||||
| @@ -1031,7 +1031,7 @@ class KarmaPlugin implements CallbackListener, TimerListener, Plugin { | |||||||
| 	 * Save Mx Karma Votes at MapEnd | 	 * Save Mx Karma Votes at MapEnd | ||||||
| 	 */ | 	 */ | ||||||
| 	public function sendMxKarmaVotes(Map $map) { | 	public function sendMxKarmaVotes(Map $map) { | ||||||
| 		if (!$this->maniaControl->settingManager->getSettingValue($this, self::SETTING_MX_KARMA_ACTIVATED)) { | 		if (!$this->maniaControl->getSettingManager()->getSettingValue($this, self::SETTING_MX_KARMA_ACTIVATED)) { | ||||||
| 			return; | 			return; | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
|   | |||||||
| @@ -111,33 +111,33 @@ class LocalRecordsPlugin implements CallbackListener, CommandListener, TimerList | |||||||
| 		$this->maniaControl = $maniaControl; | 		$this->maniaControl = $maniaControl; | ||||||
| 		$this->initTables(); | 		$this->initTables(); | ||||||
|  |  | ||||||
| 		// Init settings | 		// Settings | ||||||
| 		$this->maniaControl->settingManager->initSetting($this, self::SETTING_WIDGET_TITLE, 'Local Records'); | 		$this->maniaControl->getSettingManager()->initSetting($this, self::SETTING_WIDGET_TITLE, 'Local Records'); | ||||||
| 		$this->maniaControl->settingManager->initSetting($this, self::SETTING_WIDGET_POSX, -139.); | 		$this->maniaControl->getSettingManager()->initSetting($this, self::SETTING_WIDGET_POSX, -139.); | ||||||
| 		$this->maniaControl->settingManager->initSetting($this, self::SETTING_WIDGET_POSY, 75); | 		$this->maniaControl->getSettingManager()->initSetting($this, self::SETTING_WIDGET_POSY, 75); | ||||||
| 		$this->maniaControl->settingManager->initSetting($this, self::SETTING_WIDGET_WIDTH, 40.); | 		$this->maniaControl->getSettingManager()->initSetting($this, self::SETTING_WIDGET_WIDTH, 40.); | ||||||
| 		$this->maniaControl->settingManager->initSetting($this, self::SETTING_WIDGET_LINESCOUNT, 15); | 		$this->maniaControl->getSettingManager()->initSetting($this, self::SETTING_WIDGET_LINESCOUNT, 15); | ||||||
| 		$this->maniaControl->settingManager->initSetting($this, self::SETTING_WIDGET_LINEHEIGHT, 4.); | 		$this->maniaControl->getSettingManager()->initSetting($this, self::SETTING_WIDGET_LINEHEIGHT, 4.); | ||||||
| 		$this->maniaControl->settingManager->initSetting($this, self::SETTING_WIDGET_ENABLE, true); | 		$this->maniaControl->getSettingManager()->initSetting($this, self::SETTING_WIDGET_ENABLE, true); | ||||||
| 		$this->maniaControl->settingManager->initSetting($this, self::SETTING_NOTIFY_ONLY_DRIVER, false); | 		$this->maniaControl->getSettingManager()->initSetting($this, self::SETTING_NOTIFY_ONLY_DRIVER, false); | ||||||
| 		$this->maniaControl->settingManager->initSetting($this, self::SETTING_NOTIFY_BEST_RECORDS, -1); | 		$this->maniaControl->getSettingManager()->initSetting($this, self::SETTING_NOTIFY_BEST_RECORDS, -1); | ||||||
| 		$this->maniaControl->settingManager->initSetting($this, self::SETTING_ADJUST_OUTER_BORDER, false); | 		$this->maniaControl->getSettingManager()->initSetting($this, self::SETTING_ADJUST_OUTER_BORDER, false); | ||||||
|  |  | ||||||
| 		// Register for callbacks | 		// Callbacks | ||||||
| 		$this->maniaControl->timerManager->registerTimerListening($this, 'handle1Second', 1000); | 		$this->maniaControl->getTimerManager()->registerTimerListening($this, 'handle1Second', 1000); | ||||||
|  |  | ||||||
| 		$this->maniaControl->callbackManager->registerCallbackListener(Callbacks::AFTERINIT, $this, 'handleAfterInit'); | 		$this->maniaControl->getCallbackManager()->registerCallbackListener(Callbacks::AFTERINIT, $this, 'handleAfterInit'); | ||||||
| 		$this->maniaControl->callbackManager->registerCallbackListener(Callbacks::BEGINMAP, $this, 'handleMapBegin'); | 		$this->maniaControl->getCallbackManager()->registerCallbackListener(Callbacks::BEGINMAP, $this, 'handleMapBegin'); | ||||||
| 		$this->maniaControl->callbackManager->registerCallbackListener(SettingManager::CB_SETTING_CHANGED, $this, 'handleSettingChanged'); | 		$this->maniaControl->getCallbackManager()->registerCallbackListener(SettingManager::CB_SETTING_CHANGED, $this, 'handleSettingChanged'); | ||||||
| 		$this->maniaControl->callbackManager->registerCallbackListener(CallbackManager::CB_MP_PLAYERMANIALINKPAGEANSWER, $this, 'handleManialinkPageAnswer'); | 		$this->maniaControl->getCallbackManager()->registerCallbackListener(CallbackManager::CB_MP_PLAYERMANIALINKPAGEANSWER, $this, 'handleManialinkPageAnswer'); | ||||||
|  |  | ||||||
| 		$this->maniaControl->callbackManager->registerCallbackListener(PlayerManager::CB_PLAYERCONNECT, $this, 'handlePlayerConnect'); | 		$this->maniaControl->getCallbackManager()->registerCallbackListener(PlayerManager::CB_PLAYERCONNECT, $this, 'handlePlayerConnect'); | ||||||
| 		$this->maniaControl->callbackManager->registerCallbackListener(RecordCallback::CHECKPOINT, $this, 'handleCheckpointCallback'); | 		$this->maniaControl->getCallbackManager()->registerCallbackListener(RecordCallback::CHECKPOINT, $this, 'handleCheckpointCallback'); | ||||||
| 		$this->maniaControl->callbackManager->registerCallbackListener(RecordCallback::LAPFINISH, $this, 'handleLapFinishCallback'); | 		$this->maniaControl->getCallbackManager()->registerCallbackListener(RecordCallback::LAPFINISH, $this, 'handleLapFinishCallback'); | ||||||
| 		$this->maniaControl->callbackManager->registerCallbackListener(RecordCallback::FINISH, $this, 'handleFinishCallback'); | 		$this->maniaControl->getCallbackManager()->registerCallbackListener(RecordCallback::FINISH, $this, 'handleFinishCallback'); | ||||||
|  |  | ||||||
| 		$this->maniaControl->commandManager->registerCommandListener(array('recs', 'records'), $this, 'showRecordsList', false, 'Shows a list of Local Records on the current map.'); | 		$this->maniaControl->getCommandManager()->registerCommandListener(array('recs', 'records'), $this, 'showRecordsList', false, 'Shows a list of Local Records on the current map.'); | ||||||
| 		$this->maniaControl->commandManager->registerCommandListener('delrec', $this, 'deleteRecord', true, 'Removes a record from the database.'); | 		$this->maniaControl->getCommandManager()->registerCommandListener('delrec', $this, 'deleteRecord', true, 'Removes a record from the database.'); | ||||||
|  |  | ||||||
| 		$this->updateManialink = true; | 		$this->updateManialink = true; | ||||||
|  |  | ||||||
| @@ -148,7 +148,7 @@ class LocalRecordsPlugin implements CallbackListener, CommandListener, TimerList | |||||||
| 	 * Initialize needed database tables | 	 * Initialize needed database tables | ||||||
| 	 */ | 	 */ | ||||||
| 	private function initTables() { | 	private function initTables() { | ||||||
| 		$mysqli = $this->maniaControl->database->mysqli; | 		$mysqli = $this->maniaControl->getDatabase()->getMysqli(); | ||||||
| 		$query  = "CREATE TABLE IF NOT EXISTS `" . self::TABLE_RECORDS . "` ( | 		$query  = "CREATE TABLE IF NOT EXISTS `" . self::TABLE_RECORDS . "` ( | ||||||
| 				`index` int(11) NOT NULL AUTO_INCREMENT, | 				`index` int(11) NOT NULL AUTO_INCREMENT, | ||||||
| 				`mapIndex` int(11) NOT NULL, | 				`mapIndex` int(11) NOT NULL, | ||||||
| @@ -175,7 +175,7 @@ class LocalRecordsPlugin implements CallbackListener, CommandListener, TimerList | |||||||
| 	 * @see \ManiaControl\Plugins\Plugin::unload() | 	 * @see \ManiaControl\Plugins\Plugin::unload() | ||||||
| 	 */ | 	 */ | ||||||
| 	public function unload() { | 	public function unload() { | ||||||
| 		$this->maniaControl->manialinkManager->hideManialink(self::MLID_RECORDS); | 		$this->maniaControl->getManialinkManager()->hideManialink(self::MLID_RECORDS); | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	/** | 	/** | ||||||
| @@ -194,9 +194,9 @@ class LocalRecordsPlugin implements CallbackListener, CommandListener, TimerList | |||||||
| 		} | 		} | ||||||
|  |  | ||||||
| 		$this->updateManialink = false; | 		$this->updateManialink = false; | ||||||
| 		if ($this->maniaControl->settingManager->getSettingValue($this, self::SETTING_WIDGET_ENABLE)) { | 		if ($this->maniaControl->getSettingManager()->getSettingValue($this, self::SETTING_WIDGET_ENABLE)) { | ||||||
| 			$manialink = $this->buildManialink(); | 			$manialink = $this->buildManialink(); | ||||||
| 			$this->maniaControl->manialinkManager->sendManialink($manialink); | 			$this->maniaControl->getManialinkManager()->sendManialink($manialink); | ||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| @@ -206,20 +206,20 @@ class LocalRecordsPlugin implements CallbackListener, CommandListener, TimerList | |||||||
| 	 * @return string | 	 * @return string | ||||||
| 	 */ | 	 */ | ||||||
| 	private function buildManialink() { | 	private function buildManialink() { | ||||||
| 		$map = $this->maniaControl->mapManager->getCurrentMap(); | 		$map = $this->maniaControl->getMapManager()->getCurrentMap(); | ||||||
| 		if (!$map) { | 		if (!$map) { | ||||||
| 			return null; | 			return null; | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
| 		$title        = $this->maniaControl->settingManager->getSettingValue($this, self::SETTING_WIDGET_TITLE); | 		$title        = $this->maniaControl->getSettingManager()->getSettingValue($this, self::SETTING_WIDGET_TITLE); | ||||||
| 		$posX         = $this->maniaControl->settingManager->getSettingValue($this, self::SETTING_WIDGET_POSX); | 		$posX         = $this->maniaControl->getSettingManager()->getSettingValue($this, self::SETTING_WIDGET_POSX); | ||||||
| 		$posY         = $this->maniaControl->settingManager->getSettingValue($this, self::SETTING_WIDGET_POSY); | 		$posY         = $this->maniaControl->getSettingManager()->getSettingValue($this, self::SETTING_WIDGET_POSY); | ||||||
| 		$width        = $this->maniaControl->settingManager->getSettingValue($this, self::SETTING_WIDGET_WIDTH); | 		$width        = $this->maniaControl->getSettingManager()->getSettingValue($this, self::SETTING_WIDGET_WIDTH); | ||||||
| 		$lines        = $this->maniaControl->settingManager->getSettingValue($this, self::SETTING_WIDGET_LINESCOUNT); | 		$lines        = $this->maniaControl->getSettingManager()->getSettingValue($this, self::SETTING_WIDGET_LINESCOUNT); | ||||||
| 		$lineHeight   = $this->maniaControl->settingManager->getSettingValue($this, self::SETTING_WIDGET_LINEHEIGHT); | 		$lineHeight   = $this->maniaControl->getSettingManager()->getSettingValue($this, self::SETTING_WIDGET_LINEHEIGHT); | ||||||
| 		$labelStyle   = $this->maniaControl->manialinkManager->getStyleManager()->getDefaultLabelStyle(); | 		$labelStyle   = $this->maniaControl->getManialinkManager()->getStyleManager()->getDefaultLabelStyle(); | ||||||
| 		$quadStyle    = $this->maniaControl->manialinkManager->getStyleManager()->getDefaultQuadStyle(); | 		$quadStyle    = $this->maniaControl->getManialinkManager()->getStyleManager()->getDefaultQuadStyle(); | ||||||
| 		$quadSubstyle = $this->maniaControl->manialinkManager->getStyleManager()->getDefaultQuadSubstyle(); | 		$quadSubstyle = $this->maniaControl->getManialinkManager()->getStyleManager()->getDefaultQuadSubstyle(); | ||||||
|  |  | ||||||
| 		$records = $this->getLocalRecords($map); | 		$records = $this->getLocalRecords($map); | ||||||
| 		if (!is_array($records)) { | 		if (!is_array($records)) { | ||||||
| @@ -235,7 +235,7 @@ class LocalRecordsPlugin implements CallbackListener, CommandListener, TimerList | |||||||
| 		$backgroundQuad = new Quad(); | 		$backgroundQuad = new Quad(); | ||||||
| 		$frame->add($backgroundQuad); | 		$frame->add($backgroundQuad); | ||||||
| 		$backgroundQuad->setVAlign($backgroundQuad::TOP); | 		$backgroundQuad->setVAlign($backgroundQuad::TOP); | ||||||
| 		$adjustOuterBorder = $this->maniaControl->settingManager->getSettingValue($this, self::SETTING_ADJUST_OUTER_BORDER); | 		$adjustOuterBorder = $this->maniaControl->getSettingManager()->getSettingValue($this, self::SETTING_ADJUST_OUTER_BORDER); | ||||||
| 		$height            = 7. + ($adjustOuterBorder ? count($records) : $lines) * $lineHeight; | 		$height            = 7. + ($adjustOuterBorder ? count($records) : $lines) * $lineHeight; | ||||||
| 		$backgroundQuad->setSize($width * 1.05, $height); | 		$backgroundQuad->setSize($width * 1.05, $height); | ||||||
| 		$backgroundQuad->setStyles($quadStyle, $quadSubstyle); | 		$backgroundQuad->setStyles($quadStyle, $quadSubstyle); | ||||||
| @@ -306,7 +306,7 @@ class LocalRecordsPlugin implements CallbackListener, CommandListener, TimerList | |||||||
| 	 * @return array | 	 * @return array | ||||||
| 	 */ | 	 */ | ||||||
| 	public function getLocalRecords(Map $map, $limit = -1) { | 	public function getLocalRecords(Map $map, $limit = -1) { | ||||||
| 		$mysqli = $this->maniaControl->database->mysqli; | 		$mysqli = $this->maniaControl->getDatabase()->getMysqli(); | ||||||
| 		$limit  = ($limit > 0 ? 'LIMIT ' . $limit : ''); | 		$limit  = ($limit > 0 ? 'LIMIT ' . $limit : ''); | ||||||
| 		$query  = "SELECT * FROM ( | 		$query  = "SELECT * FROM ( | ||||||
| 					SELECT recs.*, @rank := @rank + 1 as `rank` FROM `" . self::TABLE_RECORDS . "` recs, (SELECT @rank := 0) ra | 					SELECT recs.*, @rank := @rank + 1 as `rank` FROM `" . self::TABLE_RECORDS . "` recs, (SELECT @rank := 0) ra | ||||||
| @@ -344,7 +344,7 @@ class LocalRecordsPlugin implements CallbackListener, CommandListener, TimerList | |||||||
| 				if ($setting->value) { | 				if ($setting->value) { | ||||||
| 					$this->updateManialink = true; | 					$this->updateManialink = true; | ||||||
| 				} else { | 				} else { | ||||||
| 					$this->maniaControl->manialinkManager->hideManialink(self::MLID_RECORDS); | 					$this->maniaControl->getManialinkManager()->hideManialink(self::MLID_RECORDS); | ||||||
| 				} | 				} | ||||||
| 				break; | 				break; | ||||||
| 			} | 			} | ||||||
| @@ -389,7 +389,7 @@ class LocalRecordsPlugin implements CallbackListener, CommandListener, TimerList | |||||||
| 			return; | 			return; | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
| 		$map = $this->maniaControl->mapManager->getCurrentMap(); | 		$map = $this->maniaControl->getMapManager()->getCurrentMap(); | ||||||
|  |  | ||||||
| 		$checkpointsString                   = $this->getCheckpoints($callback->player->login); | 		$checkpointsString                   = $this->getCheckpoints($callback->player->login); | ||||||
| 		$this->checkpoints[$callback->login] = array(); | 		$this->checkpoints[$callback->login] = array(); | ||||||
| @@ -405,13 +405,13 @@ class LocalRecordsPlugin implements CallbackListener, CommandListener, TimerList | |||||||
| 				// Same time | 				// Same time | ||||||
| 				// TODO: respect notify-settings | 				// TODO: respect notify-settings | ||||||
| 				$message = '$<$fff' . $callback->player->nickname . '$> equalized his/her $<$ff0' . $oldRecord->rank . '.$> Local Record: $<$fff' . Formatter::formatTime($oldRecord->time) . '$>!'; | 				$message = '$<$fff' . $callback->player->nickname . '$> equalized his/her $<$ff0' . $oldRecord->rank . '.$> Local Record: $<$fff' . Formatter::formatTime($oldRecord->time) . '$>!'; | ||||||
| 				$this->maniaControl->chat->sendInformation('$3c0' . $message); | 				$this->maniaControl->getChat()->sendInformation('$3c0' . $message); | ||||||
| 				return; | 				return; | ||||||
| 			} | 			} | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
| 		// Save time | 		// Save time | ||||||
| 		$mysqli = $this->maniaControl->database->mysqli; | 		$mysqli = $this->maniaControl->getDatabase()->getMysqli(); | ||||||
| 		$query  = "INSERT INTO `" . self::TABLE_RECORDS . "` ( | 		$query  = "INSERT INTO `" . self::TABLE_RECORDS . "` ( | ||||||
| 				`mapIndex`, | 				`mapIndex`, | ||||||
| 				`playerIndex`, | 				`playerIndex`, | ||||||
| @@ -436,8 +436,8 @@ class LocalRecordsPlugin implements CallbackListener, CommandListener, TimerList | |||||||
| 		$newRecord    = $this->getLocalRecord($map, $callback->player); | 		$newRecord    = $this->getLocalRecord($map, $callback->player); | ||||||
| 		$improvedRank = (!$oldRecord || $newRecord->rank < $oldRecord->rank); | 		$improvedRank = (!$oldRecord || $newRecord->rank < $oldRecord->rank); | ||||||
|  |  | ||||||
| 		$notifyOnlyDriver      = $this->maniaControl->settingManager->getSettingValue($this, self::SETTING_NOTIFY_ONLY_DRIVER); | 		$notifyOnlyDriver      = $this->maniaControl->getSettingManager()->getSettingValue($this, self::SETTING_NOTIFY_ONLY_DRIVER); | ||||||
| 		$notifyOnlyBestRecords = $this->maniaControl->settingManager->getSettingValue($this, self::SETTING_NOTIFY_BEST_RECORDS); | 		$notifyOnlyBestRecords = $this->maniaControl->getSettingManager()->getSettingValue($this, self::SETTING_NOTIFY_BEST_RECORDS); | ||||||
|  |  | ||||||
| 		$message = '$3c0'; | 		$message = '$3c0'; | ||||||
| 		if ($notifyOnlyDriver) { | 		if ($notifyOnlyDriver) { | ||||||
| @@ -458,12 +458,12 @@ class LocalRecordsPlugin implements CallbackListener, CommandListener, TimerList | |||||||
| 		} | 		} | ||||||
|  |  | ||||||
| 		if ($notifyOnlyDriver) { | 		if ($notifyOnlyDriver) { | ||||||
| 			$this->maniaControl->chat->sendInformation($message, $callback->player); | 			$this->maniaControl->getChat()->sendInformation($message, $callback->player); | ||||||
| 		} else if (!$notifyOnlyBestRecords || $newRecord->rank <= $notifyOnlyBestRecords) { | 		} else if (!$notifyOnlyBestRecords || $newRecord->rank <= $notifyOnlyBestRecords) { | ||||||
| 			$this->maniaControl->chat->sendInformation($message); | 			$this->maniaControl->getChat()->sendInformation($message); | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
| 		$this->maniaControl->callbackManager->triggerCallback(self::CB_LOCALRECORDS_CHANGED, $newRecord); | 		$this->maniaControl->getCallbackManager()->triggerCallback(self::CB_LOCALRECORDS_CHANGED, $newRecord); | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	/** | 	/** | ||||||
| @@ -495,7 +495,7 @@ class LocalRecordsPlugin implements CallbackListener, CommandListener, TimerList | |||||||
| 	 * @return mixed | 	 * @return mixed | ||||||
| 	 */ | 	 */ | ||||||
| 	private function getLocalRecord(Map $map, Player $player) { | 	private function getLocalRecord(Map $map, Player $player) { | ||||||
| 		$mysqli = $this->maniaControl->database->mysqli; | 		$mysqli = $this->maniaControl->getDatabase()->getMysqli(); | ||||||
| 		$query  = "SELECT records.* FROM ( | 		$query  = "SELECT records.* FROM ( | ||||||
| 					SELECT recs.*, @rank := @rank + 1 as `rank` FROM `" . self::TABLE_RECORDS . "` recs, (SELECT @rank := 0) ra | 					SELECT recs.*, @rank := @rank + 1 as `rank` FROM `" . self::TABLE_RECORDS . "` recs, (SELECT @rank := 0) ra | ||||||
| 					WHERE recs.`mapIndex` = {$map->index} | 					WHERE recs.`mapIndex` = {$map->index} | ||||||
| @@ -534,7 +534,7 @@ class LocalRecordsPlugin implements CallbackListener, CommandListener, TimerList | |||||||
| 		$actionId = $callback[1][2]; | 		$actionId = $callback[1][2]; | ||||||
|  |  | ||||||
| 		$login  = $callback[1][1]; | 		$login  = $callback[1][1]; | ||||||
| 		$player = $this->maniaControl->playerManager->getPlayer($login); | 		$player = $this->maniaControl->getPlayerManager()->getPlayer($login); | ||||||
|  |  | ||||||
| 		if ($actionId === self::ACTION_SHOW_RECORDSLIST) { | 		if ($actionId === self::ACTION_SHOW_RECORDSLIST) { | ||||||
| 			$this->showRecordsList(array(), $player); | 			$this->showRecordsList(array(), $player); | ||||||
| @@ -548,11 +548,11 @@ class LocalRecordsPlugin implements CallbackListener, CommandListener, TimerList | |||||||
| 	 * @param Player $player | 	 * @param Player $player | ||||||
| 	 */ | 	 */ | ||||||
| 	public function showRecordsList(array $chat, Player $player) { | 	public function showRecordsList(array $chat, Player $player) { | ||||||
| 		$width  = $this->maniaControl->manialinkManager->getStyleManager()->getListWidgetsWidth(); | 		$width  = $this->maniaControl->getManialinkManager()->getStyleManager()->getListWidgetsWidth(); | ||||||
| 		$height = $this->maniaControl->manialinkManager->getStyleManager()->getListWidgetsHeight(); | 		$height = $this->maniaControl->getManialinkManager()->getStyleManager()->getListWidgetsHeight(); | ||||||
|  |  | ||||||
| 		// get PlayerList | 		// get PlayerList | ||||||
| 		$records = $this->getLocalRecords($this->maniaControl->mapManager->getCurrentMap()); | 		$records = $this->getLocalRecords($this->maniaControl->getMapManager()->getCurrentMap()); | ||||||
|  |  | ||||||
| 		// create manialink | 		// create manialink | ||||||
| 		$maniaLink = new ManiaLink(ManialinkManager::MAIN_MLID); | 		$maniaLink = new ManiaLink(ManialinkManager::MAIN_MLID); | ||||||
| @@ -561,7 +561,7 @@ class LocalRecordsPlugin implements CallbackListener, CommandListener, TimerList | |||||||
| 		$script->addFeature($paging); | 		$script->addFeature($paging); | ||||||
|  |  | ||||||
| 		// Main frame | 		// Main frame | ||||||
| 		$frame = $this->maniaControl->manialinkManager->getStyleManager()->getDefaultListFrame($script, $paging); | 		$frame = $this->maniaControl->getManialinkManager()->getStyleManager()->getDefaultListFrame($script, $paging); | ||||||
| 		$maniaLink->add($frame); | 		$maniaLink->add($frame); | ||||||
|  |  | ||||||
| 		// Start offsets | 		// Start offsets | ||||||
| @@ -569,7 +569,7 @@ class LocalRecordsPlugin implements CallbackListener, CommandListener, TimerList | |||||||
| 		$posY = $height / 2; | 		$posY = $height / 2; | ||||||
|  |  | ||||||
| 		// Predefine Description Label | 		// Predefine Description Label | ||||||
| 		$descriptionLabel = $this->maniaControl->manialinkManager->getStyleManager()->getDefaultDescriptionLabel(); | 		$descriptionLabel = $this->maniaControl->getManialinkManager()->getStyleManager()->getDefaultDescriptionLabel(); | ||||||
| 		$frame->add($descriptionLabel); | 		$frame->add($descriptionLabel); | ||||||
|  |  | ||||||
| 		// Headline | 		// Headline | ||||||
| @@ -577,7 +577,7 @@ class LocalRecordsPlugin implements CallbackListener, CommandListener, TimerList | |||||||
| 		$frame->add($headFrame); | 		$frame->add($headFrame); | ||||||
| 		$headFrame->setY($posY - 5); | 		$headFrame->setY($posY - 5); | ||||||
| 		$array = array('Rank' => $posX + 5, 'Nickname' => $posX + 18, 'Login' => $posX + 70, 'Time' => $posX + 101); | 		$array = array('Rank' => $posX + 5, 'Nickname' => $posX + 18, 'Login' => $posX + 70, 'Time' => $posX + 101); | ||||||
| 		$this->maniaControl->manialinkManager->labelLine($headFrame, $array); | 		$this->maniaControl->getManialinkManager()->labelLine($headFrame, $array); | ||||||
|  |  | ||||||
| 		$index     = 0; | 		$index     = 0; | ||||||
| 		$posY      = $height / 2 - 10; | 		$posY      = $height / 2 - 10; | ||||||
| @@ -606,7 +606,7 @@ class LocalRecordsPlugin implements CallbackListener, CommandListener, TimerList | |||||||
| 				$listRecord->nickname = $listRecord->login; | 				$listRecord->nickname = $listRecord->login; | ||||||
| 			} | 			} | ||||||
| 			$array = array($listRecord->rank => $posX + 5, '$fff' . $listRecord->nickname => $posX + 18, $listRecord->login => $posX + 70, Formatter::formatTime($listRecord->time) => $posX + 101); | 			$array = array($listRecord->rank => $posX + 5, '$fff' . $listRecord->nickname => $posX + 18, $listRecord->login => $posX + 70, Formatter::formatTime($listRecord->time) => $posX + 101); | ||||||
| 			$this->maniaControl->manialinkManager->labelLine($recordFrame, $array); | 			$this->maniaControl->getManialinkManager()->labelLine($recordFrame, $array); | ||||||
|  |  | ||||||
| 			$recordFrame->setY($posY); | 			$recordFrame->setY($posY); | ||||||
|  |  | ||||||
| @@ -615,7 +615,7 @@ class LocalRecordsPlugin implements CallbackListener, CommandListener, TimerList | |||||||
| 		} | 		} | ||||||
|  |  | ||||||
| 		// Render and display xml | 		// Render and display xml | ||||||
| 		$this->maniaControl->manialinkManager->displayWidget($maniaLink, $player, 'PlayerList'); | 		$this->maniaControl->getManialinkManager()->displayWidget($maniaLink, $player, 'PlayerList'); | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	/** | 	/** | ||||||
| @@ -625,26 +625,26 @@ class LocalRecordsPlugin implements CallbackListener, CommandListener, TimerList | |||||||
| 	 * @param Player $player | 	 * @param Player $player | ||||||
| 	 */ | 	 */ | ||||||
| 	public function deleteRecord(array $chat, Player $player) { | 	public function deleteRecord(array $chat, Player $player) { | ||||||
| 		if (!$this->maniaControl->authenticationManager->checkRight($player, AuthenticationManager::AUTH_LEVEL_MASTERADMIN)) { | 		if (!$this->maniaControl->getAuthenticationManager()->checkRight($player, AuthenticationManager::AUTH_LEVEL_MASTERADMIN)) { | ||||||
| 			$this->maniaControl->authenticationManager->sendNotAllowed($player); | 			$this->maniaControl->getAuthenticationManager()->sendNotAllowed($player); | ||||||
| 			return; | 			return; | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
| 		$commandParts = explode(' ', $chat[1][2]); | 		$commandParts = explode(' ', $chat[1][2]); | ||||||
| 		if (count($commandParts) < 2) { | 		if (count($commandParts) < 2) { | ||||||
| 			$this->maniaControl->chat->sendUsageInfo('Missing Record ID! (Example: //delrec 3)', $player); | 			$this->maniaControl->getChat()->sendUsageInfo('Missing Record ID! (Example: //delrec 3)', $player); | ||||||
| 			return; | 			return; | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
| 		$recordId   = (int)$commandParts[1]; | 		$recordId   = (int)$commandParts[1]; | ||||||
| 		$currentMap = $this->maniaControl->mapManager->getCurrentMap(); | 		$currentMap = $this->maniaControl->getMapManager()->getCurrentMap(); | ||||||
| 		$records    = $this->getLocalRecords($currentMap); | 		$records    = $this->getLocalRecords($currentMap); | ||||||
| 		if (count($records) < $recordId) { | 		if (count($records) < $recordId) { | ||||||
| 			$this->maniaControl->chat->sendError('Cannot remove record $<$fff' . $recordId . '$>!', $player); | 			$this->maniaControl->getChat()->sendError('Cannot remove record $<$fff' . $recordId . '$>!', $player); | ||||||
| 			return; | 			return; | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
| 		$mysqli = $this->maniaControl->database->mysqli; | 		$mysqli = $this->maniaControl->getDatabase()->getMysqli(); | ||||||
| 		$query  = "DELETE FROM `" . self::TABLE_RECORDS . "` | 		$query  = "DELETE FROM `" . self::TABLE_RECORDS . "` | ||||||
| 				WHERE `mapIndex` = {$currentMap->index} | 				WHERE `mapIndex` = {$currentMap->index} | ||||||
| 				AND `playerIndex` = {$player->index};"; | 				AND `playerIndex` = {$player->index};"; | ||||||
| @@ -654,7 +654,7 @@ class LocalRecordsPlugin implements CallbackListener, CommandListener, TimerList | |||||||
| 			return; | 			return; | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
| 		$this->maniaControl->callbackManager->triggerCallback(self::CB_LOCALRECORDS_CHANGED, null); | 		$this->maniaControl->getCallbackManager()->triggerCallback(self::CB_LOCALRECORDS_CHANGED, null); | ||||||
| 		$this->maniaControl->chat->sendInformation('Record no. $<$fff' . $recordId . '$> has been removed!'); | 		$this->maniaControl->getChat()->sendInformation('Record no. $<$fff' . $recordId . '$> has been removed!'); | ||||||
| 	} | 	} | ||||||
| } | } | ||||||
|   | |||||||
| @@ -100,22 +100,22 @@ class ServerRankingPlugin implements Plugin, CallbackListener, CommandListener { | |||||||
|  |  | ||||||
| 		$this->initTables(); | 		$this->initTables(); | ||||||
|  |  | ||||||
| 		$this->maniaControl->settingManager->initSetting($this, self::SETTING_MIN_HITS_RATIO_RANKING, 100); | 		$this->maniaControl->getSettingManager()->initSetting($this, self::SETTING_MIN_HITS_RATIO_RANKING, 100); | ||||||
| 		$this->maniaControl->settingManager->initSetting($this, self::SETTING_MIN_HITS_POINTS_RANKING, 15); | 		$this->maniaControl->getSettingManager()->initSetting($this, self::SETTING_MIN_HITS_POINTS_RANKING, 15); | ||||||
|  |  | ||||||
| 		$this->maniaControl->settingManager->initSetting($this, self::SETTING_MIN_REQUIRED_RECORDS, 3); | 		$this->maniaControl->getSettingManager()->initSetting($this, self::SETTING_MIN_REQUIRED_RECORDS, 3); | ||||||
| 		$this->maniaControl->settingManager->initSetting($this, self::SETTING_MAX_STORED_RECORDS, 50); | 		$this->maniaControl->getSettingManager()->initSetting($this, self::SETTING_MAX_STORED_RECORDS, 50); | ||||||
|  |  | ||||||
| 		$this->maniaControl->settingManager->initSetting($this, self::SETTING_RANKING_TYPE, $this->getRankingsTypeArray()); | 		$this->maniaControl->getSettingManager()->initSetting($this, self::SETTING_RANKING_TYPE, $this->getRankingsTypeArray()); | ||||||
|  |  | ||||||
| 		//Register CallbackListeners | 		// Callbacks | ||||||
| 		$this->maniaControl->callbackManager->registerCallbackListener(PlayerManager::CB_PLAYERCONNECT, $this, 'handlePlayerConnect'); | 		$this->maniaControl->getCallbackManager()->registerCallbackListener(PlayerManager::CB_PLAYERCONNECT, $this, 'handlePlayerConnect'); | ||||||
| 		$this->maniaControl->callbackManager->registerCallbackListener(Callbacks::ENDMAP, $this, 'handleEndMap'); | 		$this->maniaControl->getCallbackManager()->registerCallbackListener(Callbacks::ENDMAP, $this, 'handleEndMap'); | ||||||
|  |  | ||||||
| 		//Register CommandListener | 		// Commands | ||||||
| 		$this->maniaControl->commandManager->registerCommandListener('rank', $this, 'command_showRank', false, 'Shows your current ServerRank.'); | 		$this->maniaControl->getCommandManager()->registerCommandListener('rank', $this, 'command_showRank', false, 'Shows your current ServerRank.'); | ||||||
| 		$this->maniaControl->commandManager->registerCommandListener('nextrank', $this, 'command_nextRank', false, 'Shows the person in front of you in the ServerRanking.'); | 		$this->maniaControl->getCommandManager()->registerCommandListener('nextrank', $this, 'command_nextRank', false, 'Shows the person in front of you in the ServerRanking.'); | ||||||
| 		$this->maniaControl->commandManager->registerCommandListener(array('topranks', 'top100'), $this, 'command_topRanks', false, 'Shows an overview of the best-ranked 100 players.'); | 		$this->maniaControl->getCommandManager()->registerCommandListener(array('topranks', 'top100'), $this, 'command_topRanks', false, 'Shows an overview of the best-ranked 100 players.'); | ||||||
|  |  | ||||||
| 		// TODO: only update records count | 		// TODO: only update records count | ||||||
| 		$this->resetRanks(); | 		$this->resetRanks(); | ||||||
| @@ -128,9 +128,9 @@ class ServerRankingPlugin implements Plugin, CallbackListener, CommandListener { | |||||||
| 	 * @return array[] | 	 * @return array[] | ||||||
| 	 */ | 	 */ | ||||||
| 	private function getRankingsTypeArray() { | 	private function getRankingsTypeArray() { | ||||||
| 		$script = $this->maniaControl->client->getScriptName(); | 		$script = $this->maniaControl->getClient()->getScriptName(); | ||||||
|  |  | ||||||
| 		if ($this->maniaControl->mapManager->getCurrentMap() | 		if ($this->maniaControl->getMapManager()->getCurrentMap() | ||||||
| 		                                   ->getGame() === 'tm' | 		                                   ->getGame() === 'tm' | ||||||
| 		) { | 		) { | ||||||
| 			//TODO also add obstacle here as default | 			//TODO also add obstacle here as default | ||||||
| @@ -146,7 +146,7 @@ class ServerRankingPlugin implements Plugin, CallbackListener, CommandListener { | |||||||
| 	 * Create necessary database tables | 	 * Create necessary database tables | ||||||
| 	 */ | 	 */ | ||||||
| 	private function initTables() { | 	private function initTables() { | ||||||
| 		$mysqli = $this->maniaControl->database->mysqli; | 		$mysqli = $this->maniaControl->getDatabase()->getMysqli(); | ||||||
| 		$query  = "CREATE TABLE IF NOT EXISTS `" . self::TABLE_RANK . "` ( | 		$query  = "CREATE TABLE IF NOT EXISTS `" . self::TABLE_RANK . "` ( | ||||||
| 				`PlayerIndex` int(11) NOT NULL, | 				`PlayerIndex` int(11) NOT NULL, | ||||||
| 				`Rank` int(11) NOT NULL, | 				`Rank` int(11) NOT NULL, | ||||||
| @@ -164,7 +164,7 @@ class ServerRankingPlugin implements Plugin, CallbackListener, CommandListener { | |||||||
| 	 * Resets and rebuilds the Ranking | 	 * Resets and rebuilds the Ranking | ||||||
| 	 */ | 	 */ | ||||||
| 	private function resetRanks() { | 	private function resetRanks() { | ||||||
| 		$mysqli = $this->maniaControl->database->mysqli; | 		$mysqli = $this->maniaControl->getDatabase()->getMysqli(); | ||||||
|  |  | ||||||
| 		// Erase old Average Data | 		// Erase old Average Data | ||||||
| 		$query = "TRUNCATE TABLE `" . self::TABLE_RANK . "`;"; | 		$query = "TRUNCATE TABLE `" . self::TABLE_RANK . "`;"; | ||||||
| @@ -173,15 +173,15 @@ class ServerRankingPlugin implements Plugin, CallbackListener, CommandListener { | |||||||
| 			trigger_error($mysqli->error); | 			trigger_error($mysqli->error); | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
| 		$type = $this->maniaControl->settingManager->getSettingValue($this, self::SETTING_RANKING_TYPE); | 		$type = $this->maniaControl->getSettingManager()->getSettingValue($this, self::SETTING_RANKING_TYPE); | ||||||
|  |  | ||||||
| 		switch ($type) { | 		switch ($type) { | ||||||
| 			case self::RANKING_TYPE_RATIOS: | 			case self::RANKING_TYPE_RATIOS: | ||||||
| 				$minHits = $this->maniaControl->settingManager->getSettingValue($this, self::SETTING_MIN_HITS_RATIO_RANKING); | 				$minHits = $this->maniaControl->getSettingManager()->getSettingValue($this, self::SETTING_MIN_HITS_RATIO_RANKING); | ||||||
|  |  | ||||||
| 				$hits            = $this->maniaControl->statisticManager->getStatsRanking(StatisticCollector::STAT_ON_HIT, -1, $minHits); | 				$hits            = $this->maniaControl->getStatisticManager()->getStatsRanking(StatisticCollector::STAT_ON_HIT, -1, $minHits); | ||||||
| 				$killDeathRatios = $this->maniaControl->statisticManager->getStatsRanking(StatisticManager::SPECIAL_STAT_KD_RATIO); | 				$killDeathRatios = $this->maniaControl->getStatisticManager()->getStatsRanking(StatisticManager::SPECIAL_STAT_KD_RATIO); | ||||||
| 				$accuracies      = $this->maniaControl->statisticManager->getStatsRanking(StatisticManager::SPECIAL_STAT_LASER_ACC); | 				$accuracies      = $this->maniaControl->getStatisticManager()->getStatsRanking(StatisticManager::SPECIAL_STAT_LASER_ACC); | ||||||
|  |  | ||||||
| 				$ranks = array(); | 				$ranks = array(); | ||||||
| 				foreach ($hits as $login => $hitCount) { | 				foreach ($hits as $login => $hitCount) { | ||||||
| @@ -195,24 +195,24 @@ class ServerRankingPlugin implements Plugin, CallbackListener, CommandListener { | |||||||
|  |  | ||||||
| 				break; | 				break; | ||||||
| 			case self::RANKING_TYPE_POINTS: | 			case self::RANKING_TYPE_POINTS: | ||||||
| 				$minHits = $this->maniaControl->settingManager->getSettingValue($this, self::SETTING_MIN_HITS_POINTS_RANKING); | 				$minHits = $this->maniaControl->getSettingManager()->getSettingValue($this, self::SETTING_MIN_HITS_POINTS_RANKING); | ||||||
| 				$ranks   = $this->maniaControl->statisticManager->getStatsRanking(StatisticCollector::STAT_ON_HIT, -1, $minHits); | 				$ranks   = $this->maniaControl->getStatisticManager()->getStatsRanking(StatisticCollector::STAT_ON_HIT, -1, $minHits); | ||||||
| 				break; | 				break; | ||||||
| 			case self::RANKING_TYPE_RECORDS: | 			case self::RANKING_TYPE_RECORDS: | ||||||
| 				// TODO: verify workable status | 				// TODO: verify workable status | ||||||
| 				/** @var LocalRecordsPlugin $localRecordsPlugin */ | 				/** @var LocalRecordsPlugin $localRecordsPlugin */ | ||||||
| 				$localRecordsPlugin = $this->maniaControl->pluginManager->getPlugin(__NAMESPACE__ . '\LocalRecordsPlugin'); | 				$localRecordsPlugin = $this->maniaControl->getPluginManager()->getPlugin(__NAMESPACE__ . '\LocalRecordsPlugin'); | ||||||
| 				if (!$localRecordsPlugin) { | 				if (!$localRecordsPlugin) { | ||||||
| 					return; | 					return; | ||||||
| 				} | 				} | ||||||
|  |  | ||||||
| 				$requiredRecords = $this->maniaControl->settingManager->getSettingValue($this, self::SETTING_MIN_REQUIRED_RECORDS); | 				$requiredRecords = $this->maniaControl->getSettingManager()->getSettingValue($this, self::SETTING_MIN_REQUIRED_RECORDS); | ||||||
| 				$maxRecords      = $this->maniaControl->settingManager->getSettingValue($this, self::SETTING_MAX_STORED_RECORDS); | 				$maxRecords      = $this->maniaControl->getSettingManager()->getSettingValue($this, self::SETTING_MAX_STORED_RECORDS); | ||||||
|  |  | ||||||
| 				$query = 'SELECT playerIndex, COUNT(*) AS Cnt | 				$query = "SELECT `playerIndex`, COUNT(*) AS `Cnt` | ||||||
| 						FROM ' . LocalRecordsPlugin::TABLE_RECORDS . ' | 						FROM `" . LocalRecordsPlugin::TABLE_RECORDS . "` | ||||||
| 						GROUP BY PlayerIndex | 						GROUP BY `PlayerIndex` | ||||||
| 						HAVING Cnt >=' . $requiredRecords; | 						HAVING `Cnt` >= {$requiredRecords};"; | ||||||
|  |  | ||||||
| 				$result  = $mysqli->query($query); | 				$result  = $mysqli->query($query); | ||||||
| 				$players = array(); | 				$players = array(); | ||||||
| @@ -221,7 +221,7 @@ class ServerRankingPlugin implements Plugin, CallbackListener, CommandListener { | |||||||
| 				} | 				} | ||||||
| 				$result->free_result(); | 				$result->free_result(); | ||||||
|  |  | ||||||
| 				$maps = $this->maniaControl->mapManager->getMaps(); | 				$maps = $this->maniaControl->getMapManager()->getMaps(); | ||||||
| 				foreach ($maps as $map) { | 				foreach ($maps as $map) { | ||||||
| 					$records = $localRecordsPlugin->getLocalRecords($map, $maxRecords); | 					$records = $localRecordsPlugin->getLocalRecords($map, $maxRecords); | ||||||
|  |  | ||||||
| @@ -296,14 +296,14 @@ class ServerRankingPlugin implements Plugin, CallbackListener, CommandListener { | |||||||
| 	public function showRank(Player $player) { | 	public function showRank(Player $player) { | ||||||
| 		$rankObj = $this->getRank($player); | 		$rankObj = $this->getRank($player); | ||||||
|  |  | ||||||
| 		$type = $this->maniaControl->settingManager->getSettingValue($this, self::SETTING_RANKING_TYPE); | 		$type = $this->maniaControl->getSettingManager()->getSettingValue($this, self::SETTING_RANKING_TYPE); | ||||||
|  |  | ||||||
| 		$message = ''; | 		$message = ''; | ||||||
| 		if ($rankObj) { | 		if ($rankObj) { | ||||||
| 			switch ($type) { | 			switch ($type) { | ||||||
| 				case self::RANKING_TYPE_RATIOS: | 				case self::RANKING_TYPE_RATIOS: | ||||||
| 					$killDeathRatio = $this->maniaControl->statisticManager->getStatisticData(StatisticManager::SPECIAL_STAT_KD_RATIO, $player->index); | 					$killDeathRatio = $this->maniaControl->getStatisticManager()->getStatisticData(StatisticManager::SPECIAL_STAT_KD_RATIO, $player->index); | ||||||
| 					$accuracy       = $this->maniaControl->statisticManager->getStatisticData(StatisticManager::SPECIAL_STAT_LASER_ACC, $player->index); | 					$accuracy       = $this->maniaControl->getStatisticManager()->getStatisticData(StatisticManager::SPECIAL_STAT_LASER_ACC, $player->index); | ||||||
| 					$message        = '$0f3Your Server rank is $<$ff3' . $rankObj->rank . '$> / $<$fff' . $this->recordCount . '$> (K/D: $<$fff' . round($killDeathRatio, 2) . '$> Acc: $<$fff' . round($accuracy * 100) . '%$>)'; | 					$message        = '$0f3Your Server rank is $<$ff3' . $rankObj->rank . '$> / $<$fff' . $this->recordCount . '$> (K/D: $<$fff' . round($killDeathRatio, 2) . '$> Acc: $<$fff' . round($accuracy * 100) . '%$>)'; | ||||||
| 					break; | 					break; | ||||||
| 				case self::RANKING_TYPE_POINTS: | 				case self::RANKING_TYPE_POINTS: | ||||||
| @@ -315,19 +315,19 @@ class ServerRankingPlugin implements Plugin, CallbackListener, CommandListener { | |||||||
| 		} else { | 		} else { | ||||||
| 			switch ($type) { | 			switch ($type) { | ||||||
| 				case self::RANKING_TYPE_RATIOS: | 				case self::RANKING_TYPE_RATIOS: | ||||||
| 					$minHits = $this->maniaControl->settingManager->getSettingValue($this, self::SETTING_MIN_HITS_RATIO_RANKING); | 					$minHits = $this->maniaControl->getSettingManager()->getSettingValue($this, self::SETTING_MIN_HITS_RATIO_RANKING); | ||||||
| 					$message = '$0f3 You must make $<$fff' . $minHits . '$> Hits on this server before receiving a rank...'; | 					$message = '$0f3 You must make $<$fff' . $minHits . '$> Hits on this server before receiving a rank...'; | ||||||
| 					break; | 					break; | ||||||
| 				case self::RANKING_TYPE_POINTS: | 				case self::RANKING_TYPE_POINTS: | ||||||
| 					$minPoints = $this->maniaControl->settingManager->getSettingValue($this, self::SETTING_MIN_HITS_POINTS_RANKING); | 					$minPoints = $this->maniaControl->getSettingManager()->getSettingValue($this, self::SETTING_MIN_HITS_POINTS_RANKING); | ||||||
| 					$message   = '$0f3 You must make $<$fff' . $minPoints . '$> Hits on this server before receiving a rank...'; | 					$message   = '$0f3 You must make $<$fff' . $minPoints . '$> Hits on this server before receiving a rank...'; | ||||||
| 					break; | 					break; | ||||||
| 				case self::RANKING_TYPE_RECORDS: | 				case self::RANKING_TYPE_RECORDS: | ||||||
| 					$minRecords = $this->maniaControl->settingManager->getSettingValue($this, self::SETTING_MIN_REQUIRED_RECORDS); | 					$minRecords = $this->maniaControl->getSettingManager()->getSettingValue($this, self::SETTING_MIN_REQUIRED_RECORDS); | ||||||
| 					$message    = '$0f3 You need $<$fff' . $minRecords . '$> Records on this server before receiving a rank...'; | 					$message    = '$0f3 You need $<$fff' . $minRecords . '$> Records on this server before receiving a rank...'; | ||||||
| 			} | 			} | ||||||
| 		} | 		} | ||||||
| 		$this->maniaControl->chat->sendChat($message, $player->login); | 		$this->maniaControl->getChat()->sendChat($message, $player); | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	/** | 	/** | ||||||
| @@ -338,7 +338,7 @@ class ServerRankingPlugin implements Plugin, CallbackListener, CommandListener { | |||||||
| 	 */ | 	 */ | ||||||
| 	private function getRank(Player $player) { | 	private function getRank(Player $player) { | ||||||
| 		//TODO setting global from db or local | 		//TODO setting global from db or local | ||||||
| 		$mysqli = $this->maniaControl->database->mysqli; | 		$mysqli = $this->maniaControl->getDatabase()->getMysqli(); | ||||||
|  |  | ||||||
| 		$query  = "SELECT * FROM `" . self::TABLE_RANK . "` | 		$query  = "SELECT * FROM `" . self::TABLE_RANK . "` | ||||||
| 				WHERE `PlayerIndex` = {$player->index};"; | 				WHERE `PlayerIndex` = {$player->index};"; | ||||||
| @@ -371,12 +371,12 @@ class ServerRankingPlugin implements Plugin, CallbackListener, CommandListener { | |||||||
|  |  | ||||||
| 		if ($rankObject->rank > 1) { | 		if ($rankObject->rank > 1) { | ||||||
| 			$nextRank   = $this->getNextRank($player); | 			$nextRank   = $this->getNextRank($player); | ||||||
| 			$nextPlayer = $this->maniaControl->playerManager->getPlayerByIndex($nextRank->playerIndex); | 			$nextPlayer = $this->maniaControl->getPlayerManager()->getPlayerByIndex($nextRank->playerIndex); | ||||||
| 			$message    = '$0f3The next better ranked player is $fff' . $nextPlayer->nickname; | 			$message    = '$0f3The next better ranked player is $fff' . $nextPlayer->nickname; | ||||||
| 		} else { | 		} else { | ||||||
| 			$message = '$0f3No better ranked player :-)'; | 			$message = '$0f3No better ranked player :-)'; | ||||||
| 		} | 		} | ||||||
| 		$this->maniaControl->chat->sendChat($message, $player->login); | 		$this->maniaControl->getChat()->sendChat($message, $player); | ||||||
|  |  | ||||||
| 		return true; | 		return true; | ||||||
| 	} | 	} | ||||||
| @@ -394,9 +394,9 @@ class ServerRankingPlugin implements Plugin, CallbackListener, CommandListener { | |||||||
| 		} | 		} | ||||||
| 		$nextRank = $rankObject->rank - 1; | 		$nextRank = $rankObject->rank - 1; | ||||||
|  |  | ||||||
| 		$mysqli = $this->maniaControl->database->mysqli; | 		$mysqli = $this->maniaControl->getDatabase()->getMysqli(); | ||||||
| 		$query  = "SELECT * FROM `" . self::TABLE_RANK . "` | 		$query  = "SELECT * FROM `" . self::TABLE_RANK . "` | ||||||
| 				WHERE `Rank` = {$nextRank}"; | 				WHERE `Rank` = {$nextRank};"; | ||||||
| 		$result = $mysqli->query($query); | 		$result = $mysqli->query($query); | ||||||
| 		if ($mysqli->error) { | 		if ($mysqli->error) { | ||||||
| 			trigger_error($mysqli->error); | 			trigger_error($mysqli->error); | ||||||
| @@ -418,7 +418,7 @@ class ServerRankingPlugin implements Plugin, CallbackListener, CommandListener { | |||||||
| 	public function handleEndMap() { | 	public function handleEndMap() { | ||||||
| 		$this->resetRanks(); | 		$this->resetRanks(); | ||||||
|  |  | ||||||
| 		foreach ($this->maniaControl->playerManager->getPlayers() as $player) { | 		foreach ($this->maniaControl->getPlayerManager()->getPlayers() as $player) { | ||||||
| 			if ($player->isFakePlayer()) { | 			if ($player->isFakePlayer()) { | ||||||
| 				continue; | 				continue; | ||||||
| 			} | 			} | ||||||
| @@ -427,7 +427,7 @@ class ServerRankingPlugin implements Plugin, CallbackListener, CommandListener { | |||||||
| 		} | 		} | ||||||
|  |  | ||||||
| 		// Trigger callback | 		// Trigger callback | ||||||
| 		$this->maniaControl->callbackManager->triggerCallback(self::CB_RANK_BUILT); | 		$this->maniaControl->getCallbackManager()->triggerCallback(self::CB_RANK_BUILT); | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	/** | 	/** | ||||||
| @@ -449,7 +449,7 @@ class ServerRankingPlugin implements Plugin, CallbackListener, CommandListener { | |||||||
| 	public function command_nextRank(array $chatCallback, Player $player) { | 	public function command_nextRank(array $chatCallback, Player $player) { | ||||||
| 		if (!$this->showNextRank($player)) { | 		if (!$this->showNextRank($player)) { | ||||||
| 			$message = '$0f3You need to have a ServerRank first!'; | 			$message = '$0f3You need to have a ServerRank first!'; | ||||||
| 			$this->maniaControl->chat->sendChat($message, $player->login); | 			$this->maniaControl->getChat()->sendChat($message, $player); | ||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| @@ -469,16 +469,17 @@ class ServerRankingPlugin implements Plugin, CallbackListener, CommandListener { | |||||||
| 	 * @param Player $player | 	 * @param Player $player | ||||||
| 	 */ | 	 */ | ||||||
| 	private function showTopRanksList(Player $player) { | 	private function showTopRanksList(Player $player) { | ||||||
| 		$query  = "SELECT * FROM `" . self::TABLE_RANK . "` ORDER BY `Rank` ASC LIMIT 0, 100"; | 		$query  = "SELECT * FROM `" . self::TABLE_RANK . "` | ||||||
| 		$mysqli = $this->maniaControl->database->mysqli; | 				ORDER BY `Rank` ASC LIMIT 0, 100;"; | ||||||
|  | 		$mysqli = $this->maniaControl->getDatabase()->getMysqli(); | ||||||
| 		$result = $mysqli->query($query); | 		$result = $mysqli->query($query); | ||||||
| 		if ($mysqli->error) { | 		if ($mysqli->error) { | ||||||
| 			trigger_error($mysqli->error); | 			trigger_error($mysqli->error); | ||||||
| 			return; | 			return; | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
| 		$width  = $this->maniaControl->manialinkManager->getStyleManager()->getListWidgetsWidth(); | 		$width  = $this->maniaControl->getManialinkManager()->getStyleManager()->getListWidgetsWidth(); | ||||||
| 		$height = $this->maniaControl->manialinkManager->getStyleManager()->getListWidgetsHeight(); | 		$height = $this->maniaControl->getManialinkManager()->getStyleManager()->getListWidgetsHeight(); | ||||||
|  |  | ||||||
| 		// create manialink | 		// create manialink | ||||||
| 		$maniaLink = new ManiaLink(ManialinkManager::MAIN_MLID); | 		$maniaLink = new ManiaLink(ManialinkManager::MAIN_MLID); | ||||||
| @@ -487,7 +488,7 @@ class ServerRankingPlugin implements Plugin, CallbackListener, CommandListener { | |||||||
| 		$script->addFeature($paging); | 		$script->addFeature($paging); | ||||||
|  |  | ||||||
| 		// Main frame | 		// Main frame | ||||||
| 		$frame = $this->maniaControl->manialinkManager->getStyleManager()->getDefaultListFrame($script, $paging); | 		$frame = $this->maniaControl->getManialinkManager()->getStyleManager()->getDefaultListFrame($script, $paging); | ||||||
| 		$maniaLink->add($frame); | 		$maniaLink->add($frame); | ||||||
|  |  | ||||||
| 		// Start offsets | 		// Start offsets | ||||||
| @@ -495,7 +496,7 @@ class ServerRankingPlugin implements Plugin, CallbackListener, CommandListener { | |||||||
| 		$posY = $height / 2; | 		$posY = $height / 2; | ||||||
|  |  | ||||||
| 		//Predefine description Label | 		//Predefine description Label | ||||||
| 		$descriptionLabel = $this->maniaControl->manialinkManager->getStyleManager()->getDefaultDescriptionLabel(); | 		$descriptionLabel = $this->maniaControl->getManialinkManager()->getStyleManager()->getDefaultDescriptionLabel(); | ||||||
| 		$frame->add($descriptionLabel); | 		$frame->add($descriptionLabel); | ||||||
|  |  | ||||||
| 		// Headline | 		// Headline | ||||||
| @@ -503,7 +504,7 @@ class ServerRankingPlugin implements Plugin, CallbackListener, CommandListener { | |||||||
| 		$frame->add($headFrame); | 		$frame->add($headFrame); | ||||||
| 		$headFrame->setY($posY - 5); | 		$headFrame->setY($posY - 5); | ||||||
| 		$array = array('$oRank' => $posX + 5, '$oNickname' => $posX + 18, '$oAverage' => $posX + 70); | 		$array = array('$oRank' => $posX + 5, '$oNickname' => $posX + 18, '$oAverage' => $posX + 70); | ||||||
| 		$this->maniaControl->manialinkManager->labelLine($headFrame, $array); | 		$this->maniaControl->getManialinkManager()->labelLine($headFrame, $array); | ||||||
|  |  | ||||||
| 		$index = 1; | 		$index = 1; | ||||||
| 		$posY -= 10; | 		$posY -= 10; | ||||||
| @@ -529,16 +530,16 @@ class ServerRankingPlugin implements Plugin, CallbackListener, CommandListener { | |||||||
| 				$lineQuad->setZ(0.001); | 				$lineQuad->setZ(0.001); | ||||||
| 			} | 			} | ||||||
|  |  | ||||||
| 			$playerObject = $this->maniaControl->playerManager->getPlayerByIndex($rankedPlayer->PlayerIndex); | 			$playerObject = $this->maniaControl->getPlayerManager()->getPlayerByIndex($rankedPlayer->PlayerIndex); | ||||||
| 			$array        = array($rankedPlayer->Rank => $posX + 5, $playerObject->nickname => $posX + 18, (string)round($rankedPlayer->Avg, 2) => $posX + 70); | 			$array        = array($rankedPlayer->Rank => $posX + 5, $playerObject->nickname => $posX + 18, (string)round($rankedPlayer->Avg, 2) => $posX + 70); | ||||||
| 			$this->maniaControl->manialinkManager->labelLine($playerFrame, $array); | 			$this->maniaControl->getManialinkManager()->labelLine($playerFrame, $array); | ||||||
|  |  | ||||||
| 			$posY -= 4; | 			$posY -= 4; | ||||||
| 			$index++; | 			$index++; | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
| 		// Render and display xml | 		// Render and display xml | ||||||
| 		$this->maniaControl->manialinkManager->displayWidget($maniaLink, $player, 'TopRanks'); | 		$this->maniaControl->getManialinkManager()->displayWidget($maniaLink, $player, 'TopRanks'); | ||||||
| 	} | 	} | ||||||
| } | } | ||||||
|  |  | ||||||
|   | |||||||
| @@ -123,39 +123,40 @@ class WidgetPlugin implements CallbackListener, TimerListener, Plugin { | |||||||
| 		$this->maniaControl = $maniaControl; | 		$this->maniaControl = $maniaControl; | ||||||
|  |  | ||||||
| 		// Set CustomUI Setting | 		// Set CustomUI Setting | ||||||
| 		$this->maniaControl->manialinkManager->getCustomUIManager()->setChallengeInfoVisible(false); | 		$this->maniaControl->getManialinkManager()->getCustomUIManager()->setChallengeInfoVisible(false); | ||||||
|  |  | ||||||
| 		// Register for callbacks | 		// Callbacks | ||||||
| 		$this->maniaControl->callbackManager->registerCallbackListener(Callbacks::BEGINMAP, $this, 'handleOnBeginMap'); | 		$this->maniaControl->getCallbackManager()->registerCallbackListener(Callbacks::BEGINMAP, $this, 'handleOnBeginMap'); | ||||||
| 		$this->maniaControl->callbackManager->registerCallbackListener(Callbacks::ENDMAP, $this, 'handleOnEndMap'); | 		$this->maniaControl->getCallbackManager()->registerCallbackListener(Callbacks::ENDMAP, $this, 'handleOnEndMap'); | ||||||
| 		$this->maniaControl->callbackManager->registerCallbackListener(PlayerManager::CB_PLAYERCONNECT, $this, 'handlePlayerConnect'); | 		$this->maniaControl->getCallbackManager()->registerCallbackListener(PlayerManager::CB_PLAYERCONNECT, $this, 'handlePlayerConnect'); | ||||||
| 		$this->maniaControl->callbackManager->registerCallbackListener(PlayerManager::CB_PLAYERDISCONNECT, $this, 'updateWidgets'); | 		$this->maniaControl->getCallbackManager()->registerCallbackListener(PlayerManager::CB_PLAYERDISCONNECT, $this, 'updateWidgets'); | ||||||
| 		$this->maniaControl->callbackManager->registerCallbackListener(PlayerManager::CB_PLAYERINFOCHANGED, $this, 'updateWidgets'); | 		$this->maniaControl->getCallbackManager()->registerCallbackListener(PlayerManager::CB_PLAYERINFOCHANGED, $this, 'updateWidgets'); | ||||||
| 		$this->maniaControl->callbackManager->registerCallbackListener(SettingManager::CB_SETTING_CHANGED, $this, 'updateSettings'); | 		$this->maniaControl->getCallbackManager()->registerCallbackListener(SettingManager::CB_SETTING_CHANGED, $this, 'updateSettings'); | ||||||
|  |  | ||||||
| 		$this->maniaControl->settingManager->initSetting($this, self::SETTING_MAP_WIDGET_ACTIVATED, true); | 		// Settings | ||||||
| 		$this->maniaControl->settingManager->initSetting($this, self::SETTING_MAP_WIDGET_POSX, 160 - 20); | 		$this->maniaControl->getSettingManager()->initSetting($this, self::SETTING_MAP_WIDGET_ACTIVATED, true); | ||||||
| 		$this->maniaControl->settingManager->initSetting($this, self::SETTING_MAP_WIDGET_POSY, 90 - 4.5); | 		$this->maniaControl->getSettingManager()->initSetting($this, self::SETTING_MAP_WIDGET_POSX, 160 - 20); | ||||||
| 		$this->maniaControl->settingManager->initSetting($this, self::SETTING_MAP_WIDGET_WIDTH, 40); | 		$this->maniaControl->getSettingManager()->initSetting($this, self::SETTING_MAP_WIDGET_POSY, 90 - 4.5); | ||||||
| 		$this->maniaControl->settingManager->initSetting($this, self::SETTING_MAP_WIDGET_HEIGHT, 9.); | 		$this->maniaControl->getSettingManager()->initSetting($this, self::SETTING_MAP_WIDGET_WIDTH, 40); | ||||||
|  | 		$this->maniaControl->getSettingManager()->initSetting($this, self::SETTING_MAP_WIDGET_HEIGHT, 9.); | ||||||
|  |  | ||||||
| 		$this->maniaControl->settingManager->initSetting($this, self::SETTING_SERVERINFO_WIDGET_ACTIVATED, true); | 		$this->maniaControl->getSettingManager()->initSetting($this, self::SETTING_SERVERINFO_WIDGET_ACTIVATED, true); | ||||||
| 		$this->maniaControl->settingManager->initSetting($this, self::SETTING_SERVERINFO_WIDGET_POSX, -160 + 17.5); | 		$this->maniaControl->getSettingManager()->initSetting($this, self::SETTING_SERVERINFO_WIDGET_POSX, -160 + 17.5); | ||||||
| 		$this->maniaControl->settingManager->initSetting($this, self::SETTING_SERVERINFO_WIDGET_POSY, 90 - 4.5); | 		$this->maniaControl->getSettingManager()->initSetting($this, self::SETTING_SERVERINFO_WIDGET_POSY, 90 - 4.5); | ||||||
| 		$this->maniaControl->settingManager->initSetting($this, self::SETTING_SERVERINFO_WIDGET_WIDTH, 35); | 		$this->maniaControl->getSettingManager()->initSetting($this, self::SETTING_SERVERINFO_WIDGET_WIDTH, 35); | ||||||
| 		$this->maniaControl->settingManager->initSetting($this, self::SETTING_SERVERINFO_WIDGET_HEIGHT, 9.); | 		$this->maniaControl->getSettingManager()->initSetting($this, self::SETTING_SERVERINFO_WIDGET_HEIGHT, 9.); | ||||||
|  |  | ||||||
| 		$this->maniaControl->settingManager->initSetting($this, self::SETTING_NEXTMAP_WIDGET_ACTIVATED, true); | 		$this->maniaControl->getSettingManager()->initSetting($this, self::SETTING_NEXTMAP_WIDGET_ACTIVATED, true); | ||||||
| 		$this->maniaControl->settingManager->initSetting($this, self::SETTING_NEXTMAP_WIDGET_POSX, 160 - 20); | 		$this->maniaControl->getSettingManager()->initSetting($this, self::SETTING_NEXTMAP_WIDGET_POSX, 160 - 20); | ||||||
| 		$this->maniaControl->settingManager->initSetting($this, self::SETTING_NEXTMAP_WIDGET_POSY, 90 - 25.5); | 		$this->maniaControl->getSettingManager()->initSetting($this, self::SETTING_NEXTMAP_WIDGET_POSY, 90 - 25.5); | ||||||
| 		$this->maniaControl->settingManager->initSetting($this, self::SETTING_NEXTMAP_WIDGET_WIDTH, 40); | 		$this->maniaControl->getSettingManager()->initSetting($this, self::SETTING_NEXTMAP_WIDGET_WIDTH, 40); | ||||||
| 		$this->maniaControl->settingManager->initSetting($this, self::SETTING_NEXTMAP_WIDGET_HEIGHT, 12.); | 		$this->maniaControl->getSettingManager()->initSetting($this, self::SETTING_NEXTMAP_WIDGET_HEIGHT, 12.); | ||||||
|  |  | ||||||
| 		$this->maniaControl->settingManager->initSetting($this, self::SETTING_CLOCK_WIDGET_ACTIVATED, true); | 		$this->maniaControl->getSettingManager()->initSetting($this, self::SETTING_CLOCK_WIDGET_ACTIVATED, true); | ||||||
| 		$this->maniaControl->settingManager->initSetting($this, self::SETTING_CLOCK_WIDGET_POSX, 160 - 5); | 		$this->maniaControl->getSettingManager()->initSetting($this, self::SETTING_CLOCK_WIDGET_POSX, 160 - 5); | ||||||
| 		$this->maniaControl->settingManager->initSetting($this, self::SETTING_CLOCK_WIDGET_POSY, 90 - 11); | 		$this->maniaControl->getSettingManager()->initSetting($this, self::SETTING_CLOCK_WIDGET_POSY, 90 - 11); | ||||||
| 		$this->maniaControl->settingManager->initSetting($this, self::SETTING_CLOCK_WIDGET_WIDTH, 10); | 		$this->maniaControl->getSettingManager()->initSetting($this, self::SETTING_CLOCK_WIDGET_WIDTH, 10); | ||||||
| 		$this->maniaControl->settingManager->initSetting($this, self::SETTING_CLOCK_WIDGET_HEIGHT, 5.5); | 		$this->maniaControl->getSettingManager()->initSetting($this, self::SETTING_CLOCK_WIDGET_HEIGHT, 5.5); | ||||||
|  |  | ||||||
| 		$this->displayWidgets(); | 		$this->displayWidgets(); | ||||||
|  |  | ||||||
| @@ -167,14 +168,14 @@ class WidgetPlugin implements CallbackListener, TimerListener, Plugin { | |||||||
| 	 */ | 	 */ | ||||||
| 	private function displayWidgets() { | 	private function displayWidgets() { | ||||||
| 		// Display Map Widget | 		// Display Map Widget | ||||||
| 		if ($this->maniaControl->settingManager->getSettingValue($this, self::SETTING_MAP_WIDGET_ACTIVATED)) { | 		if ($this->maniaControl->getSettingManager()->getSettingValue($this, self::SETTING_MAP_WIDGET_ACTIVATED)) { | ||||||
| 			$this->maniaControl->client->triggerModeScriptEvent("Siege_SetProgressionLayerPosition", array("160.", "-67.", "0.")); | 			$this->maniaControl->getClient()->triggerModeScriptEvent("Siege_SetProgressionLayerPosition", array("160.", "-67.", "0.")); | ||||||
| 			$this->displayMapWidget(); | 			$this->displayMapWidget(); | ||||||
| 		} | 		} | ||||||
| 		if ($this->maniaControl->settingManager->getSettingValue($this, self::SETTING_CLOCK_WIDGET_ACTIVATED)) { | 		if ($this->maniaControl->getSettingManager()->getSettingValue($this, self::SETTING_CLOCK_WIDGET_ACTIVATED)) { | ||||||
| 			$this->displayClockWidget(); | 			$this->displayClockWidget(); | ||||||
| 		} | 		} | ||||||
| 		if ($this->maniaControl->settingManager->getSettingValue($this, self::SETTING_SERVERINFO_WIDGET_ACTIVATED)) { | 		if ($this->maniaControl->getSettingManager()->getSettingValue($this, self::SETTING_SERVERINFO_WIDGET_ACTIVATED)) { | ||||||
| 			$this->displayServerInfoWidget(); | 			$this->displayServerInfoWidget(); | ||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
| @@ -185,12 +186,12 @@ class WidgetPlugin implements CallbackListener, TimerListener, Plugin { | |||||||
| 	 * @param string $login | 	 * @param string $login | ||||||
| 	 */ | 	 */ | ||||||
| 	public function displayMapWidget($login = null) { | 	public function displayMapWidget($login = null) { | ||||||
| 		$posX         = $this->maniaControl->settingManager->getSettingValue($this, self::SETTING_MAP_WIDGET_POSX); | 		$posX         = $this->maniaControl->getSettingManager()->getSettingValue($this, self::SETTING_MAP_WIDGET_POSX); | ||||||
| 		$posY         = $this->maniaControl->settingManager->getSettingValue($this, self::SETTING_MAP_WIDGET_POSY); | 		$posY         = $this->maniaControl->getSettingManager()->getSettingValue($this, self::SETTING_MAP_WIDGET_POSY); | ||||||
| 		$width        = $this->maniaControl->settingManager->getSettingValue($this, self::SETTING_MAP_WIDGET_WIDTH); | 		$width        = $this->maniaControl->getSettingManager()->getSettingValue($this, self::SETTING_MAP_WIDGET_WIDTH); | ||||||
| 		$height       = $this->maniaControl->settingManager->getSettingValue($this, self::SETTING_MAP_WIDGET_HEIGHT); | 		$height       = $this->maniaControl->getSettingManager()->getSettingValue($this, self::SETTING_MAP_WIDGET_HEIGHT); | ||||||
| 		$quadStyle    = $this->maniaControl->manialinkManager->getStyleManager()->getDefaultQuadStyle(); | 		$quadStyle    = $this->maniaControl->getManialinkManager()->getStyleManager()->getDefaultQuadStyle(); | ||||||
| 		$quadSubstyle = $this->maniaControl->manialinkManager->getStyleManager()->getDefaultQuadSubstyle(); | 		$quadSubstyle = $this->maniaControl->getManialinkManager()->getStyleManager()->getDefaultQuadSubstyle(); | ||||||
|  |  | ||||||
| 		$maniaLink = new ManiaLink(self::MLID_MAP_WIDGET); | 		$maniaLink = new ManiaLink(self::MLID_MAP_WIDGET); | ||||||
| 		$script    = new Script(); | 		$script    = new Script(); | ||||||
| @@ -209,14 +210,14 @@ class WidgetPlugin implements CallbackListener, TimerListener, Plugin { | |||||||
| 		$backgroundQuad->setStyles($quadStyle, $quadSubstyle); | 		$backgroundQuad->setStyles($quadStyle, $quadSubstyle); | ||||||
| 		$backgroundQuad->addMapInfoFeature(); | 		$backgroundQuad->addMapInfoFeature(); | ||||||
|  |  | ||||||
| 		$map = $this->maniaControl->mapManager->getCurrentMap(); | 		$map = $this->maniaControl->getMapManager()->getCurrentMap(); | ||||||
|  |  | ||||||
| 		$label = new Label_Text(); | 		$label = new Label_Text(); | ||||||
| 		$frame->add($label); | 		$frame->add($label); | ||||||
| 		$label->setPosition(0, 1.5, 0.2); | 		$label->setPosition(0, 1.5, 0.2); | ||||||
| 		$label->setTextSize(1.3); | 		$label->setTextSize(1.3); | ||||||
| 		$label->setText(Formatter::stripDirtyCodes($map->name)); | 		$label->setText(Formatter::stripDirtyCodes($map->name)); | ||||||
| 		$label->setTextColor("FFF"); | 		$label->setTextColor('fff'); | ||||||
| 		$label->setSize($width - 5, $height); | 		$label->setSize($width - 5, $height); | ||||||
|  |  | ||||||
| 		$label = new Label_Text(); | 		$label = new Label_Text(); | ||||||
| @@ -225,21 +226,21 @@ class WidgetPlugin implements CallbackListener, TimerListener, Plugin { | |||||||
| 		$label->setTextSize(1); | 		$label->setTextSize(1); | ||||||
| 		$label->setScale(0.8); | 		$label->setScale(0.8); | ||||||
| 		$label->setText($map->authorLogin); | 		$label->setText($map->authorLogin); | ||||||
| 		$label->setTextColor("FFF"); | 		$label->setTextColor('fff'); | ||||||
| 		$label->setSize($width - 5, $height); | 		$label->setSize($width - 5, $height); | ||||||
|  |  | ||||||
| 		if (isset($map->mx->pageurl)) { | 		if (isset($map->mx->pageurl)) { | ||||||
| 			$quad = new Quad(); | 			$quad = new Quad(); | ||||||
| 			$frame->add($quad); | 			$frame->add($quad); | ||||||
| 			$quad->setImageFocus($this->maniaControl->manialinkManager->getIconManager()->getIcon(IconManager::MX_ICON_MOVER)); | 			$quad->setImageFocus($this->maniaControl->getManialinkManager()->getIconManager()->getIcon(IconManager::MX_ICON_MOVER)); | ||||||
| 			$quad->setImage($this->maniaControl->manialinkManager->getIconManager()->getIcon(IconManager::MX_ICON)); | 			$quad->setImage($this->maniaControl->getManialinkManager()->getIconManager()->getIcon(IconManager::MX_ICON)); | ||||||
| 			$quad->setPosition(-$width / 2 + 4, -1.5, -0.5); | 			$quad->setPosition(-$width / 2 + 4, -1.5, -0.5); | ||||||
| 			$quad->setSize(4, 4); | 			$quad->setSize(4, 4); | ||||||
| 			$quad->setUrl($map->mx->pageurl); | 			$quad->setUrl($map->mx->pageurl); | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
| 		// Send manialink | 		// Send manialink | ||||||
| 		$this->maniaControl->manialinkManager->sendManialink($maniaLink, $login); | 		$this->maniaControl->getManialinkManager()->sendManialink($maniaLink, $login); | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	/** | 	/** | ||||||
| @@ -248,12 +249,12 @@ class WidgetPlugin implements CallbackListener, TimerListener, Plugin { | |||||||
| 	 * @param bool $login | 	 * @param bool $login | ||||||
| 	 */ | 	 */ | ||||||
| 	public function displayClockWidget($login = false) { | 	public function displayClockWidget($login = false) { | ||||||
| 		$posX         = $this->maniaControl->settingManager->getSettingValue($this, self::SETTING_CLOCK_WIDGET_POSX); | 		$posX         = $this->maniaControl->getSettingManager()->getSettingValue($this, self::SETTING_CLOCK_WIDGET_POSX); | ||||||
| 		$posY         = $this->maniaControl->settingManager->getSettingValue($this, self::SETTING_CLOCK_WIDGET_POSY); | 		$posY         = $this->maniaControl->getSettingManager()->getSettingValue($this, self::SETTING_CLOCK_WIDGET_POSY); | ||||||
| 		$width        = $this->maniaControl->settingManager->getSettingValue($this, self::SETTING_CLOCK_WIDGET_WIDTH); | 		$width        = $this->maniaControl->getSettingManager()->getSettingValue($this, self::SETTING_CLOCK_WIDGET_WIDTH); | ||||||
| 		$height       = $this->maniaControl->settingManager->getSettingValue($this, self::SETTING_CLOCK_WIDGET_HEIGHT); | 		$height       = $this->maniaControl->getSettingManager()->getSettingValue($this, self::SETTING_CLOCK_WIDGET_HEIGHT); | ||||||
| 		$quadStyle    = $this->maniaControl->manialinkManager->getStyleManager()->getDefaultQuadStyle(); | 		$quadStyle    = $this->maniaControl->getManialinkManager()->getStyleManager()->getDefaultQuadStyle(); | ||||||
| 		$quadSubstyle = $this->maniaControl->manialinkManager->getStyleManager()->getDefaultQuadSubstyle(); | 		$quadSubstyle = $this->maniaControl->getManialinkManager()->getStyleManager()->getDefaultQuadSubstyle(); | ||||||
|  |  | ||||||
| 		$maniaLink = new ManiaLink(self::MLID_CLOCK_WIDGET); | 		$maniaLink = new ManiaLink(self::MLID_CLOCK_WIDGET); | ||||||
|  |  | ||||||
| @@ -278,7 +279,7 @@ class WidgetPlugin implements CallbackListener, TimerListener, Plugin { | |||||||
| 		$label->addClockFeature(false); | 		$label->addClockFeature(false); | ||||||
|  |  | ||||||
| 		// Send manialink | 		// Send manialink | ||||||
| 		$this->maniaControl->manialinkManager->sendManialink($maniaLink, $login); | 		$this->maniaControl->getManialinkManager()->sendManialink($maniaLink, $login); | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	/** | 	/** | ||||||
| @@ -287,12 +288,12 @@ class WidgetPlugin implements CallbackListener, TimerListener, Plugin { | |||||||
| 	 * @param string $login | 	 * @param string $login | ||||||
| 	 */ | 	 */ | ||||||
| 	public function displayServerInfoWidget($login = null) { | 	public function displayServerInfoWidget($login = null) { | ||||||
| 		$posX         = $this->maniaControl->settingManager->getSettingValue($this, self::SETTING_SERVERINFO_WIDGET_POSX); | 		$posX         = $this->maniaControl->getSettingManager()->getSettingValue($this, self::SETTING_SERVERINFO_WIDGET_POSX); | ||||||
| 		$posY         = $this->maniaControl->settingManager->getSettingValue($this, self::SETTING_SERVERINFO_WIDGET_POSY); | 		$posY         = $this->maniaControl->getSettingManager()->getSettingValue($this, self::SETTING_SERVERINFO_WIDGET_POSY); | ||||||
| 		$width        = $this->maniaControl->settingManager->getSettingValue($this, self::SETTING_SERVERINFO_WIDGET_WIDTH); | 		$width        = $this->maniaControl->getSettingManager()->getSettingValue($this, self::SETTING_SERVERINFO_WIDGET_WIDTH); | ||||||
| 		$height       = $this->maniaControl->settingManager->getSettingValue($this, self::SETTING_SERVERINFO_WIDGET_HEIGHT); | 		$height       = $this->maniaControl->getSettingManager()->getSettingValue($this, self::SETTING_SERVERINFO_WIDGET_HEIGHT); | ||||||
| 		$quadStyle    = $this->maniaControl->manialinkManager->getStyleManager()->getDefaultQuadStyle(); | 		$quadStyle    = $this->maniaControl->getManialinkManager()->getStyleManager()->getDefaultQuadStyle(); | ||||||
| 		$quadSubstyle = $this->maniaControl->manialinkManager->getStyleManager()->getDefaultQuadSubstyle(); | 		$quadSubstyle = $this->maniaControl->getManialinkManager()->getStyleManager()->getDefaultQuadSubstyle(); | ||||||
|  |  | ||||||
| 		$maniaLink = new ManiaLink(self::MLID_SERVERINFO_WIDGET); | 		$maniaLink = new ManiaLink(self::MLID_SERVERINFO_WIDGET); | ||||||
|  |  | ||||||
| @@ -308,13 +309,13 @@ class WidgetPlugin implements CallbackListener, TimerListener, Plugin { | |||||||
| 		$backgroundQuad->setSize($width, $height); | 		$backgroundQuad->setSize($width, $height); | ||||||
| 		$backgroundQuad->setStyles($quadStyle, $quadSubstyle); | 		$backgroundQuad->setStyles($quadStyle, $quadSubstyle); | ||||||
|  |  | ||||||
| 		$serverName = $this->maniaControl->client->getServerName(); | 		$serverName = $this->maniaControl->getClient()->getServerName(); | ||||||
|  |  | ||||||
| 		$playerCount = $this->maniaControl->playerManager->getPlayerCount(true); | 		$playerCount = $this->maniaControl->getPlayerManager()->getPlayerCount(true); | ||||||
| 		$maxPlayers  = $this->maniaControl->client->getMaxPlayers(); | 		$maxPlayers  = $this->maniaControl->getClient()->getMaxPlayers(); | ||||||
|  |  | ||||||
| 		$spectatorCount = $this->maniaControl->playerManager->getSpectatorCount(); | 		$spectatorCount = $this->maniaControl->getPlayerManager()->getSpectatorCount(); | ||||||
| 		$maxSpectators  = $this->maniaControl->client->getMaxSpectators(); | 		$maxSpectators  = $this->maniaControl->getClient()->getMaxSpectators(); | ||||||
|  |  | ||||||
| 		$label = new Label_Text(); | 		$label = new Label_Text(); | ||||||
| 		$frame->add($label); | 		$frame->add($label); | ||||||
| @@ -363,10 +364,10 @@ class WidgetPlugin implements CallbackListener, TimerListener, Plugin { | |||||||
| 		$quad->setSubStyle($quad::SUBSTYLE_StateFavourite); | 		$quad->setSubStyle($quad::SUBSTYLE_StateFavourite); | ||||||
| 		$quad->setPosition($width / 2 - 4, -1.5, -0.5); | 		$quad->setPosition($width / 2 - 4, -1.5, -0.5); | ||||||
| 		$quad->setSize(3, 3); | 		$quad->setSize(3, 3); | ||||||
| 		$quad->setManialink('maniacontrol?favorite=' . urlencode($this->maniaControl->server->login)); | 		$quad->setManialink('maniacontrol?favorite=' . urlencode($this->maniaControl->getServer()->login)); | ||||||
|  |  | ||||||
| 		// Send manialink | 		// Send manialink | ||||||
| 		$this->maniaControl->manialinkManager->sendManialink($maniaLink, $login); | 		$this->maniaControl->getManialinkManager()->sendManialink($maniaLink, $login); | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	/** | 	/** | ||||||
| @@ -374,7 +375,7 @@ class WidgetPlugin implements CallbackListener, TimerListener, Plugin { | |||||||
| 	 */ | 	 */ | ||||||
| 	public function unload() { | 	public function unload() { | ||||||
| 		//Restore Siege Progression Layer | 		//Restore Siege Progression Layer | ||||||
| 		$this->maniaControl->client->triggerModeScriptEvent("Siege_SetProgressionLayerPosition", array("160.", "90.", "0.")); | 		$this->maniaControl->getClient()->triggerModeScriptEvent('Siege_SetProgressionLayerPosition', array("160.", "90.", "0.")); | ||||||
|  |  | ||||||
| 		$this->closeWidget(self::MLID_CLOCK_WIDGET); | 		$this->closeWidget(self::MLID_CLOCK_WIDGET); | ||||||
| 		$this->closeWidget(self::MLID_SERVERINFO_WIDGET); | 		$this->closeWidget(self::MLID_SERVERINFO_WIDGET); | ||||||
| @@ -388,15 +389,14 @@ class WidgetPlugin implements CallbackListener, TimerListener, Plugin { | |||||||
| 	 * @param string $widgetId | 	 * @param string $widgetId | ||||||
| 	 */ | 	 */ | ||||||
| 	public function closeWidget($widgetId) { | 	public function closeWidget($widgetId) { | ||||||
| 		$emptyManialink = new ManiaLink($widgetId); | 		$this->maniaControl->getManialinkManager()->hideManialink($widgetId); | ||||||
| 		$this->maniaControl->manialinkManager->sendManialink($emptyManialink); |  | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	/** | 	/** | ||||||
| 	 * Handle Begin Map Callback | 	 * Handle Begin Map Callback | ||||||
| 	 */ | 	 */ | ||||||
| 	public function handleOnBeginMap() { | 	public function handleOnBeginMap() { | ||||||
| 		if ($this->maniaControl->settingManager->getSettingValue($this, self::SETTING_MAP_WIDGET_ACTIVATED)) { | 		if ($this->maniaControl->getSettingManager()->getSettingValue($this, self::SETTING_MAP_WIDGET_ACTIVATED)) { | ||||||
| 			$this->displayMapWidget(); | 			$this->displayMapWidget(); | ||||||
| 		} | 		} | ||||||
| 		$this->closeWidget(self::MLID_NEXTMAP_WIDGET); | 		$this->closeWidget(self::MLID_NEXTMAP_WIDGET); | ||||||
| @@ -406,7 +406,7 @@ class WidgetPlugin implements CallbackListener, TimerListener, Plugin { | |||||||
| 	 * Handle End Map Callback | 	 * Handle End Map Callback | ||||||
| 	 */ | 	 */ | ||||||
| 	public function handleOnEndMap() { | 	public function handleOnEndMap() { | ||||||
| 		if ($this->maniaControl->settingManager->getSettingValue($this, self::SETTING_NEXTMAP_WIDGET_ACTIVATED)) { | 		if ($this->maniaControl->getSettingManager()->getSettingValue($this, self::SETTING_NEXTMAP_WIDGET_ACTIVATED)) { | ||||||
| 			$this->displayNextMapWidget(); | 			$this->displayNextMapWidget(); | ||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
| @@ -417,13 +417,13 @@ class WidgetPlugin implements CallbackListener, TimerListener, Plugin { | |||||||
| 	 * @param string $login | 	 * @param string $login | ||||||
| 	 */ | 	 */ | ||||||
| 	public function displayNextMapWidget($login = null) { | 	public function displayNextMapWidget($login = null) { | ||||||
| 		$posX         = $this->maniaControl->settingManager->getSettingValue($this, self::SETTING_NEXTMAP_WIDGET_POSX); | 		$posX         = $this->maniaControl->getSettingManager()->getSettingValue($this, self::SETTING_NEXTMAP_WIDGET_POSX); | ||||||
| 		$posY         = $this->maniaControl->settingManager->getSettingValue($this, self::SETTING_NEXTMAP_WIDGET_POSY); | 		$posY         = $this->maniaControl->getSettingManager()->getSettingValue($this, self::SETTING_NEXTMAP_WIDGET_POSY); | ||||||
| 		$width        = $this->maniaControl->settingManager->getSettingValue($this, self::SETTING_NEXTMAP_WIDGET_WIDTH); | 		$width        = $this->maniaControl->getSettingManager()->getSettingValue($this, self::SETTING_NEXTMAP_WIDGET_WIDTH); | ||||||
| 		$height       = $this->maniaControl->settingManager->getSettingValue($this, self::SETTING_NEXTMAP_WIDGET_HEIGHT); | 		$height       = $this->maniaControl->getSettingManager()->getSettingValue($this, self::SETTING_NEXTMAP_WIDGET_HEIGHT); | ||||||
| 		$quadStyle    = $this->maniaControl->manialinkManager->getStyleManager()->getDefaultQuadStyle(); | 		$quadStyle    = $this->maniaControl->getManialinkManager()->getStyleManager()->getDefaultQuadStyle(); | ||||||
| 		$quadSubstyle = $this->maniaControl->manialinkManager->getStyleManager()->getDefaultQuadSubstyle(); | 		$quadSubstyle = $this->maniaControl->getManialinkManager()->getStyleManager()->getDefaultQuadSubstyle(); | ||||||
| 		$labelStyle   = $this->maniaControl->manialinkManager->getStyleManager()->getDefaultLabelStyle(); | 		$labelStyle   = $this->maniaControl->getManialinkManager()->getStyleManager()->getDefaultLabelStyle(); | ||||||
|  |  | ||||||
| 		$maniaLink = new ManiaLink(self::MLID_NEXTMAP_WIDGET); | 		$maniaLink = new ManiaLink(self::MLID_NEXTMAP_WIDGET); | ||||||
|  |  | ||||||
| @@ -440,7 +440,7 @@ class WidgetPlugin implements CallbackListener, TimerListener, Plugin { | |||||||
| 		$backgroundQuad->setStyles($quadStyle, $quadSubstyle); | 		$backgroundQuad->setStyles($quadStyle, $quadSubstyle); | ||||||
|  |  | ||||||
| 		// Check if the Next Map is a queued Map | 		// Check if the Next Map is a queued Map | ||||||
| 		$queuedMap = $this->maniaControl->mapManager->getMapQueue()->getNextMap(); | 		$queuedMap = $this->maniaControl->getMapManager()->getMapQueue()->getNextMap(); | ||||||
|  |  | ||||||
| 		/** | 		/** | ||||||
| 		 * @var Player $requester | 		 * @var Player $requester | ||||||
| @@ -448,7 +448,7 @@ class WidgetPlugin implements CallbackListener, TimerListener, Plugin { | |||||||
| 		$requester = null; | 		$requester = null; | ||||||
| 		// if the nextmap is not a queued map, get it from map info | 		// if the nextmap is not a queued map, get it from map info | ||||||
| 		if (!$queuedMap) { | 		if (!$queuedMap) { | ||||||
| 			$map    = $this->maniaControl->client->getNextMapInfo(); | 			$map    = $this->maniaControl->getClient()->getNextMapInfo(); | ||||||
| 			$name   = Formatter::stripDirtyCodes($map->name); | 			$name   = Formatter::stripDirtyCodes($map->name); | ||||||
| 			$author = $map->author; | 			$author = $map->author; | ||||||
| 		} else { | 		} else { | ||||||
| @@ -462,8 +462,8 @@ class WidgetPlugin implements CallbackListener, TimerListener, Plugin { | |||||||
| 		$frame->add($label); | 		$frame->add($label); | ||||||
| 		$label->setPosition(0, $height / 2 - 2.3, 0.2); | 		$label->setPosition(0, $height / 2 - 2.3, 0.2); | ||||||
| 		$label->setTextSize(1); | 		$label->setTextSize(1); | ||||||
| 		$label->setText("Next Map"); | 		$label->setText('Next Map'); | ||||||
| 		$label->setTextColor("FFF"); | 		$label->setTextColor('fff'); | ||||||
| 		$label->setStyle($labelStyle); | 		$label->setStyle($labelStyle); | ||||||
|  |  | ||||||
| 		$label = new Label_Text(); | 		$label = new Label_Text(); | ||||||
| @@ -471,7 +471,7 @@ class WidgetPlugin implements CallbackListener, TimerListener, Plugin { | |||||||
| 		$label->setPosition(0, $height / 2 - 5.5, 0.2); | 		$label->setPosition(0, $height / 2 - 5.5, 0.2); | ||||||
| 		$label->setTextSize(1.3); | 		$label->setTextSize(1.3); | ||||||
| 		$label->setText($name); | 		$label->setText($name); | ||||||
| 		$label->setTextColor("FFF"); | 		$label->setTextColor('fff'); | ||||||
|  |  | ||||||
| 		$label = new Label_Text(); | 		$label = new Label_Text(); | ||||||
| 		$frame->add($label); | 		$frame->add($label); | ||||||
| @@ -480,7 +480,7 @@ class WidgetPlugin implements CallbackListener, TimerListener, Plugin { | |||||||
| 		$label->setTextSize(1); | 		$label->setTextSize(1); | ||||||
| 		$label->setScale(0.8); | 		$label->setScale(0.8); | ||||||
| 		$label->setText($author); | 		$label->setText($author); | ||||||
| 		$label->setTextColor("FFF"); | 		$label->setTextColor('fff'); | ||||||
|  |  | ||||||
| 		if ($requester) { | 		if ($requester) { | ||||||
| 			$label = new Label_Text(); | 			$label = new Label_Text(); | ||||||
| @@ -489,12 +489,12 @@ class WidgetPlugin implements CallbackListener, TimerListener, Plugin { | |||||||
| 			$label->setTextSize(1); | 			$label->setTextSize(1); | ||||||
| 			$label->setScale(0.7); | 			$label->setScale(0.7); | ||||||
| 			$label->setText($author); | 			$label->setText($author); | ||||||
| 			$label->setTextColor("F80"); | 			$label->setTextColor('f80'); | ||||||
| 			$label->setText("Requested by " . $requester->nickname); | 			$label->setText('Requested by ' . $requester->getEscapedNickname()); | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
| 		// Send manialink | 		// Send manialink | ||||||
| 		$this->maniaControl->manialinkManager->sendManialink($maniaLink, $login); | 		$this->maniaControl->getManialinkManager()->sendManialink($maniaLink, $login); | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	/** | 	/** | ||||||
| @@ -504,13 +504,13 @@ class WidgetPlugin implements CallbackListener, TimerListener, Plugin { | |||||||
| 	 */ | 	 */ | ||||||
| 	public function handlePlayerConnect(Player $player) { | 	public function handlePlayerConnect(Player $player) { | ||||||
| 		// Display Map Widget | 		// Display Map Widget | ||||||
| 		if ($this->maniaControl->settingManager->getSettingValue($this, self::SETTING_MAP_WIDGET_ACTIVATED)) { | 		if ($this->maniaControl->getSettingManager()->getSettingValue($this, self::SETTING_MAP_WIDGET_ACTIVATED)) { | ||||||
| 			$this->displayMapWidget($player->login); | 			$this->displayMapWidget($player->login); | ||||||
| 		} | 		} | ||||||
| 		if ($this->maniaControl->settingManager->getSettingValue($this, self::SETTING_CLOCK_WIDGET_ACTIVATED)) { | 		if ($this->maniaControl->getSettingManager()->getSettingValue($this, self::SETTING_CLOCK_WIDGET_ACTIVATED)) { | ||||||
| 			$this->displayClockWidget($player->login); | 			$this->displayClockWidget($player->login); | ||||||
| 		} | 		} | ||||||
| 		if ($this->maniaControl->settingManager->getSettingValue($this, self::SETTING_SERVERINFO_WIDGET_ACTIVATED)) { | 		if ($this->maniaControl->getSettingManager()->getSettingValue($this, self::SETTING_SERVERINFO_WIDGET_ACTIVATED)) { | ||||||
| 			$this->displayServerInfoWidget(); | 			$this->displayServerInfoWidget(); | ||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
| @@ -530,7 +530,7 @@ class WidgetPlugin implements CallbackListener, TimerListener, Plugin { | |||||||
| 	 * Update Widget on certain callbacks | 	 * Update Widget on certain callbacks | ||||||
| 	 */ | 	 */ | ||||||
| 	public function updateWidgets() { | 	public function updateWidgets() { | ||||||
| 		if ($this->maniaControl->settingManager->getSettingValue($this, self::SETTING_SERVERINFO_WIDGET_ACTIVATED)) { | 		if ($this->maniaControl->getSettingManager()->getSettingValue($this, self::SETTING_SERVERINFO_WIDGET_ACTIVATED)) { | ||||||
| 			$this->displayServerInfoWidget(); | 			$this->displayServerInfoWidget(); | ||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user