renamed server commands class and improved code
This commit is contained in:
		| @@ -37,6 +37,8 @@ class Commands implements CallbackListener, CommandListener, ManialinkPageAnswer | |||||||
| 	const SETTING_PERMISSION_SHOW_SYSTEMINFO       = 'Show SystemInfo'; | 	const SETTING_PERMISSION_SHOW_SYSTEMINFO       = 'Show SystemInfo'; | ||||||
| 	const SETTING_PERMISSION_SHUTDOWN_SERVER       = 'Shutdown Server'; | 	const SETTING_PERMISSION_SHUTDOWN_SERVER       = 'Shutdown Server'; | ||||||
| 	const SETTING_PERMISSION_CHANGE_SERVERSETTINGS = 'Change ServerSettings'; | 	const SETTING_PERMISSION_CHANGE_SERVERSETTINGS = 'Change ServerSettings'; | ||||||
|  | 	const COMMAND_EXTEND_WARMUP                    = 'WarmUp_Extend'; | ||||||
|  | 	const COMMAND_FORCE_WARMUP                     = 'Command_ForceWarmUp'; | ||||||
|  |  | ||||||
| 	/* | 	/* | ||||||
| 	 * Private Properties | 	 * Private Properties | ||||||
| @@ -58,18 +60,21 @@ class Commands implements CallbackListener, CommandListener, ManialinkPageAnswer | |||||||
| 		$this->maniaControl->callbackManager->registerCallbackListener(Callbacks::ONINIT, $this, 'handleOnInit'); | 		$this->maniaControl->callbackManager->registerCallbackListener(Callbacks::ONINIT, $this, 'handleOnInit'); | ||||||
| 		$this->maniaControl->callbackManager->registerCallbackListener(Callbacks::WARMUPSTATUS, $this, 'handleWarmUpStatus'); | 		$this->maniaControl->callbackManager->registerCallbackListener(Callbacks::WARMUPSTATUS, $this, 'handleWarmUpStatus'); | ||||||
|  |  | ||||||
|  |  | ||||||
| 		// Register for commands | 		// Register for commands | ||||||
| 		$this->maniaControl->commandManager->registerCommandListener('setservername', $this, 'command_SetServerName', true, 'Sets the ServerName.'); | 		$this->maniaControl->commandManager->registerCommandListener('setservername', $this, 'commandSetServerName', true, 'Sets the ServerName.'); | ||||||
| 		$this->maniaControl->commandManager->registerCommandListener('setpwd', $this, 'command_SetPwd', true, 'Sets play password.'); | 		$this->maniaControl->commandManager->registerCommandListener('setpwd', $this, 'commandSetPwd', true, 'Sets play password.'); | ||||||
| 		$this->maniaControl->commandManager->registerCommandListener('setspecpwd', $this, 'command_SetSpecPwd', true, 'Sets spectator password.'); | 		$this->maniaControl->commandManager->registerCommandListener('setspecpwd', $this, 'commandSetSpecPwd', true, 'Sets spectator password.'); | ||||||
| 		$this->maniaControl->commandManager->registerCommandListener('setmaxplayers', $this, 'command_SetMaxPlayers', true, 'Sets the maximum number of players.'); | 		$this->maniaControl->commandManager->registerCommandListener('setmaxplayers', $this, 'commandSetMaxPlayers', true, 'Sets the maximum number of players.'); | ||||||
| 		$this->maniaControl->commandManager->registerCommandListener('setmaxspectators', $this, 'command_SetMaxSpectators', true, 'Sets the maximum number of spectators.'); | 		$this->maniaControl->commandManager->registerCommandListener('setmaxspectators', $this, 'commandSetMaxSpectators', true, 'Sets the maximum number of spectators.'); | ||||||
| 		$this->maniaControl->commandManager->registerCommandListener('shutdownserver', $this, 'command_ShutdownServer', true, 'Shuts down the ManiaPlanet server.'); | 		$this->maniaControl->commandManager->registerCommandListener('shutdownserver', $this, 'commandShutdownServer', true, 'Shuts down the ManiaPlanet server.'); | ||||||
| 		$this->maniaControl->commandManager->registerCommandListener('systeminfo', $this, 'command_SystemInfo', true, 'Shows system information.'); | 		$this->maniaControl->commandManager->registerCommandListener('systeminfo', $this, 'commandSystemInfo', true, 'Shows system information.'); | ||||||
|  | 		$this->maniaControl->commandManager->registerCommandListener('cancel', $this, 'commandCancelVote', true, 'Cancels the current vote.'); | ||||||
|  |  | ||||||
| 		$this->maniaControl->commandManager->registerCommandListener('cancel', $this, 'command_CancelVote', true, 'Cancels the current vote.'); | 		// Register for page actions | ||||||
| 		$this->maniaControl->manialinkManager->registerManialinkPageAnswerListener(self::ACTION_SET_PAUSE, $this, 'setPause'); | 		$this->maniaControl->manialinkManager->registerManialinkPageAnswerListener(self::ACTION_SET_PAUSE, $this, 'setPause'); | ||||||
|  | 		$this->maniaControl->manialinkManager->registerManialinkPageAnswerListener(self::ACTION_EXTEND_WARMUP, $this, 'commandExtendWarmup'); | ||||||
|  | 		$this->maniaControl->manialinkManager->registerManialinkPageAnswerListener(self::ACTION_END_WARMUP, $this, 'commandEndWarmup'); | ||||||
|  | 		$this->maniaControl->manialinkManager->registerManialinkPageAnswerListener(self::ACTION_CANCEL_VOTE, $this, 'commandCancelVote'); | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	/** | 	/** | ||||||
| @@ -84,56 +89,61 @@ class Commands implements CallbackListener, CommandListener, ManialinkPageAnswer | |||||||
| 		$this->maniaControl->authenticationManager->definePermissionLevel(self::SETTING_PERMISSION_CANCEL_VOTE, AuthenticationManager::AUTH_LEVEL_MODERATOR); | 		$this->maniaControl->authenticationManager->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->authenticationManager->definePermissionLevel(self::SETTING_PERMISSION_HANDLE_WARMUP, AuthenticationManager::AUTH_LEVEL_MODERATOR); | ||||||
|  |  | ||||||
| 		//Check if there is WarmUp Enabled in this Mode | 		$this->updateCancelVoteMenuItem(); | ||||||
| 		//TODO handle the Modescriptevents + answer by an own callback class (answer via closure or dunno) | 		$this->updateWarmUpMenuItems(); | ||||||
| 		$this->maniaControl->client->triggerModeScriptEvent("WarmUp_GetStatus"); | 	} | ||||||
|  |  | ||||||
| 		// Action cancel Vote | 	/** | ||||||
| 		$this->maniaControl->manialinkManager->registerManialinkPageAnswerListener(self::ACTION_CANCEL_VOTE, $this, 'command_cancelVote'); | 	 * Add the cancel vote menu item | ||||||
|  | 	 */ | ||||||
|  | 	private function updateCancelVoteMenuItem() { | ||||||
| 		$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->actionsMenu->addMenuItem($itemQuad, false, 30, 'Cancel Vote'); | ||||||
|  | 	} | ||||||
|  |  | ||||||
| 		//Check if Pause exists in current GameMode | 	/** | ||||||
|  | 	 * Manage the WarmUp related menu items | ||||||
|  | 	 */ | ||||||
|  | 	private function updateWarmUpMenuItems() { | ||||||
|  | 		$pauseExists = false; | ||||||
| 		try { | 		try { | ||||||
| 			$scriptInfos = $this->maniaControl->client->getModeScriptInfo(); | 			$scriptInfos = $this->maniaControl->client->getModeScriptInfo(); | ||||||
| 		} catch (GameModeException $e) { |  | ||||||
| 			return; |  | ||||||
| 		} |  | ||||||
| 		$pauseExists = false; |  | ||||||
| 			foreach ($scriptInfos->commandDescs as $param) { | 			foreach ($scriptInfos->commandDescs as $param) { | ||||||
| 			if ($param->name === 'Command_ForceWarmUp') { | 				if ($param->name === self::COMMAND_FORCE_WARMUP) { | ||||||
| 					$pauseExists = true; | 					$pauseExists = true; | ||||||
| 					break; | 					break; | ||||||
| 				} | 				} | ||||||
| 			} | 			} | ||||||
|  | 			$this->maniaControl->client->triggerModeScriptEvent("WarmUp_GetStatus"); | ||||||
|  | 		} catch (GameModeException $e) { | ||||||
|  | 		} | ||||||
|  |  | ||||||
| 		// Set Pause | 		// Add pause menu item | ||||||
| 		if ($pauseExists) { | 		if ($pauseExists) { | ||||||
| 			$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, 'Pauses the current game'); | 			$this->maniaControl->actionsMenu->addAdminMenuItem($itemQuad, 13, 'Pause the current game'); | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	/** | 	/** | ||||||
| 	 * Handeling the WarmupStatus Callback, and removes or adds the Menu Items for extending / Stopping warmup | 	 * Handle the WarmupStatus Callback, and removes or adds the Menu Items for extending / Stopping warmup | ||||||
| 	 * | 	 * | ||||||
| 	 * @param $warmupEnabled | 	 * @param $warmupEnabled | ||||||
| 	 */ | 	 */ | ||||||
| 	public function handleWarmUpStatus($warmupEnabled) { | 	public function handleWarmUpStatus($warmupEnabled) { | ||||||
| 		if ($warmupEnabled) { | 		if ($warmupEnabled) { | ||||||
| 			// Extend WarmUp | 			// Extend WarmUp menu item | ||||||
| 			$this->maniaControl->manialinkManager->registerManialinkPageAnswerListener(self::ACTION_EXTEND_WARMUP, $this, 'command_extendWarmup'); |  | ||||||
| 			$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->actionsMenu->addMenuItem($itemQuad, false, 14, 'Extend Warmup'); | ||||||
|  |  | ||||||
| 			// Stop WarmUp | 			// Stop WarmUp menu item | ||||||
| 			$this->maniaControl->manialinkManager->registerManialinkPageAnswerListener(self::ACTION_END_WARMUP, $this, 'command_endWarmup'); |  | ||||||
| 			$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); | ||||||
| @@ -150,27 +160,28 @@ class Commands implements CallbackListener, CommandListener, ManialinkPageAnswer | |||||||
| 	 * @param array  $chatCallback | 	 * @param array  $chatCallback | ||||||
| 	 * @param Player $player | 	 * @param Player $player | ||||||
| 	 */ | 	 */ | ||||||
| 	public function command_CancelVote(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->authenticationManager->checkPermission($player, self::SETTING_PERMISSION_CANCEL_VOTE)) { | ||||||
| 			$this->maniaControl->authenticationManager->sendNotAllowed($player); | 			$this->maniaControl->authenticationManager->sendNotAllowed($player); | ||||||
| 			return; | 			return; | ||||||
| 		} | 		} | ||||||
| 		$this->maniaControl->client->cancelVote(); |  | ||||||
|  |  | ||||||
| 		$this->maniaControl->chat->sendInformation('$<' . $player->nickname . '$> canceled the Vote!'); | 		if ($this->maniaControl->client->cancelVote()) { | ||||||
|  | 			$this->maniaControl->chat->sendInformation($player->getEscapedNickname() . ' canceled the Vote!'); | ||||||
| 		// Trigger callback |  | ||||||
| 			$this->maniaControl->callbackManager->triggerCallback(self::CB_VOTE_CANCELED, $player); | 			$this->maniaControl->callbackManager->triggerCallback(self::CB_VOTE_CANCELED, $player); | ||||||
|  | 		} else { | ||||||
|  | 			$this->maniaControl->chat->sendInformation("There's no vote running currently!", $player); | ||||||
|  | 		} | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
|  |  | ||||||
| 	/** | 	/** | ||||||
| 	 * Extends the Warmup | 	 * Extend the WarmUp | ||||||
| 	 * | 	 * | ||||||
| 	 * @param array  $callback | 	 * @param array  $callback | ||||||
| 	 * @param Player $player | 	 * @param Player $player | ||||||
| 	 */ | 	 */ | ||||||
| 	public function command_extendWarmup(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->authenticationManager->checkPermission($player, self::SETTING_PERMISSION_HANDLE_WARMUP)) { | ||||||
| 			$this->maniaControl->authenticationManager->sendNotAllowed($player); | 			$this->maniaControl->authenticationManager->sendNotAllowed($player); | ||||||
| 			return; | 			return; | ||||||
| @@ -178,20 +189,18 @@ class Commands implements CallbackListener, CommandListener, ManialinkPageAnswer | |||||||
|  |  | ||||||
| 		try { | 		try { | ||||||
| 			$this->maniaControl->client->triggerModeScriptEvent('WarmUp_Extend', '10'); | 			$this->maniaControl->client->triggerModeScriptEvent('WarmUp_Extend', '10'); | ||||||
| 		} catch (GameModeException $e) { |  | ||||||
| 			return; |  | ||||||
| 		} |  | ||||||
|  |  | ||||||
| 			$this->maniaControl->chat->sendInformation('$<' . $player->nickname . '$> extended the WarmUp by 10 seconds!'); | 			$this->maniaControl->chat->sendInformation('$<' . $player->nickname . '$> extended the WarmUp by 10 seconds!'); | ||||||
|  | 		} catch (GameModeException $e) { | ||||||
|  | 		} | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	/** | 	/** | ||||||
| 	 * Ends the Warmup | 	 * End the WarmUp | ||||||
| 	 * | 	 * | ||||||
| 	 * @param array  $callback | 	 * @param array  $callback | ||||||
| 	 * @param Player $player | 	 * @param Player $player | ||||||
| 	 */ | 	 */ | ||||||
| 	public function command_endWarmup(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->authenticationManager->checkPermission($player, self::SETTING_PERMISSION_HANDLE_WARMUP)) { | ||||||
| 			$this->maniaControl->authenticationManager->sendNotAllowed($player); | 			$this->maniaControl->authenticationManager->sendNotAllowed($player); | ||||||
| 			return; | 			return; | ||||||
| @@ -199,11 +208,9 @@ class Commands implements CallbackListener, CommandListener, ManialinkPageAnswer | |||||||
|  |  | ||||||
| 		try { | 		try { | ||||||
| 			$this->maniaControl->client->triggerModeScriptEvent('WarmUp_Stop', ''); | 			$this->maniaControl->client->triggerModeScriptEvent('WarmUp_Stop', ''); | ||||||
| 		} catch (GameModeException $e) { |  | ||||||
| 			return; |  | ||||||
| 		} |  | ||||||
|  |  | ||||||
| 			$this->maniaControl->chat->sendInformation('$<' . $player->nickname . '$> stopped the WarmUp!'); | 			$this->maniaControl->chat->sendInformation('$<' . $player->nickname . '$> stopped the WarmUp!'); | ||||||
|  | 		} catch (GameModeException $e) { | ||||||
|  | 		} | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	/** | 	/** | ||||||
| @@ -219,17 +226,16 @@ class Commands implements CallbackListener, CommandListener, ManialinkPageAnswer | |||||||
| 		} | 		} | ||||||
| 		try { | 		try { | ||||||
| 			$this->maniaControl->client->sendModeScriptCommands(array('Command_ForceWarmUp' => true)); | 			$this->maniaControl->client->sendModeScriptCommands(array('Command_ForceWarmUp' => true)); | ||||||
| 		} catch (GameModeException $e) { |  | ||||||
| 			return; |  | ||||||
| 		} |  | ||||||
|  |  | ||||||
| 			$this->maniaControl->chat->sendInformation('$<' . $player->nickname . '$> paused the Game!'); | 			$this->maniaControl->chat->sendInformation('$<' . $player->nickname . '$> paused the Game!'); | ||||||
|  | 		} catch (GameModeException $e) { | ||||||
|  | 		} | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	/** | 	/** | ||||||
| 	 * Check Stuff each 5 Seconds | 	 * Check Stuff each 5 Seconds | ||||||
| 	 */ | 	 */ | ||||||
| 	public function each5Seconds() { | 	public function each5Seconds() { | ||||||
|  | 		// 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->playerManager->getPlayerCount(false) <= 0) { | ||||||
| @@ -261,7 +267,7 @@ class Commands implements CallbackListener, CommandListener, ManialinkPageAnswer | |||||||
| 	 * @param array  $chat | 	 * @param array  $chat | ||||||
| 	 * @param Player $player | 	 * @param Player $player | ||||||
| 	 */ | 	 */ | ||||||
| 	public function command_SystemInfo(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->authenticationManager->checkPermission($player, self::SETTING_PERMISSION_SHOW_SYSTEMINFO)) { | ||||||
| 			$this->maniaControl->authenticationManager->sendNotAllowed($player); | 			$this->maniaControl->authenticationManager->sendNotAllowed($player); | ||||||
| 			return; | 			return; | ||||||
| @@ -277,7 +283,7 @@ class Commands implements CallbackListener, CommandListener, ManialinkPageAnswer | |||||||
| 	 * @param array  $chat | 	 * @param array  $chat | ||||||
| 	 * @param Player $player | 	 * @param Player $player | ||||||
| 	 */ | 	 */ | ||||||
| 	public function command_ShutdownServer(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->authenticationManager->checkPermission($player, self::SETTING_PERMISSION_SHUTDOWN_SERVER)) { | ||||||
| 			$this->maniaControl->authenticationManager->sendNotAllowed($player); | 			$this->maniaControl->authenticationManager->sendNotAllowed($player); | ||||||
| 			return; | 			return; | ||||||
| @@ -316,7 +322,7 @@ class Commands implements CallbackListener, CommandListener, ManialinkPageAnswer | |||||||
| 	 * @param array  $chat | 	 * @param array  $chat | ||||||
| 	 * @param Player $player | 	 * @param Player $player | ||||||
| 	 */ | 	 */ | ||||||
| 	public function command_SetServerName(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->authenticationManager->checkPermission($player, self::SETTING_PERMISSION_CHANGE_SERVERSETTINGS)) { | ||||||
| 			$this->maniaControl->authenticationManager->sendNotAllowed($player); | 			$this->maniaControl->authenticationManager->sendNotAllowed($player); | ||||||
| 			return; | 			return; | ||||||
| @@ -337,7 +343,7 @@ class Commands implements CallbackListener, CommandListener, ManialinkPageAnswer | |||||||
| 	 * @param array  $chatCallback | 	 * @param array  $chatCallback | ||||||
| 	 * @param Player $player | 	 * @param Player $player | ||||||
| 	 */ | 	 */ | ||||||
| 	public function command_SetPwd(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->authenticationManager->checkPermission($player, self::SETTING_PERMISSION_CHANGE_SERVERSETTINGS)) { | ||||||
| 			$this->maniaControl->authenticationManager->sendNotAllowed($player); | 			$this->maniaControl->authenticationManager->sendNotAllowed($player); | ||||||
| 			return; | 			return; | ||||||
| @@ -359,7 +365,7 @@ class Commands implements CallbackListener, CommandListener, ManialinkPageAnswer | |||||||
| 	 * @param array  $chatCallback | 	 * @param array  $chatCallback | ||||||
| 	 * @param Player $player | 	 * @param Player $player | ||||||
| 	 */ | 	 */ | ||||||
| 	public function command_SetSpecPwd(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->authenticationManager->checkPermission($player, self::SETTING_PERMISSION_CHANGE_SERVERSETTINGS)) { | ||||||
| 			$this->maniaControl->authenticationManager->sendNotAllowed($player); | 			$this->maniaControl->authenticationManager->sendNotAllowed($player); | ||||||
| 			return; | 			return; | ||||||
| @@ -381,7 +387,7 @@ class Commands implements CallbackListener, CommandListener, ManialinkPageAnswer | |||||||
| 	 * @param array  $chatCallback | 	 * @param array  $chatCallback | ||||||
| 	 * @param Player $player | 	 * @param Player $player | ||||||
| 	 */ | 	 */ | ||||||
| 	public function command_SetMaxPlayers(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->authenticationManager->checkPermission($player, self::SETTING_PERMISSION_CHANGE_SERVERSETTINGS)) { | ||||||
| 			$this->maniaControl->authenticationManager->sendNotAllowed($player); | 			$this->maniaControl->authenticationManager->sendNotAllowed($player); | ||||||
| 			return; | 			return; | ||||||
| @@ -411,7 +417,7 @@ class Commands implements CallbackListener, CommandListener, ManialinkPageAnswer | |||||||
| 	 * @param array  $chatCallback | 	 * @param array  $chatCallback | ||||||
| 	 * @param Player $player | 	 * @param Player $player | ||||||
| 	 */ | 	 */ | ||||||
| 	public function command_SetMaxSpectators(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->authenticationManager->checkPermission($player, self::SETTING_PERMISSION_CHANGE_SERVERSETTINGS)) { | ||||||
| 			$this->maniaControl->authenticationManager->sendNotAllowed($player); | 			$this->maniaControl->authenticationManager->sendNotAllowed($player); | ||||||
| 			return; | 			return; | ||||||
|   | |||||||
| @@ -35,7 +35,7 @@ class Server implements CallbackListener { | |||||||
| 	public $login = null; | 	public $login = null; | ||||||
| 	public $titleId = null; | 	public $titleId = null; | ||||||
| 	public $directory = null; | 	public $directory = null; | ||||||
| 	public $serverCommands = null; | 	public $commands = null; | ||||||
| 	public $usageReporter = null; | 	public $usageReporter = null; | ||||||
| 	public $rankingManager = null; | 	public $rankingManager = null; | ||||||
| 	public $scriptManager = null; | 	public $scriptManager = null; | ||||||
| @@ -56,7 +56,7 @@ class Server implements CallbackListener { | |||||||
| 		$this->initTables(); | 		$this->initTables(); | ||||||
|  |  | ||||||
| 		$this->directory      = new Directory($maniaControl); | 		$this->directory      = new Directory($maniaControl); | ||||||
| 		$this->serverCommands = new ServerCommands($maniaControl); | 		$this->commands       = new Commands($maniaControl); | ||||||
| 		$this->usageReporter  = new UsageReporter($maniaControl); | 		$this->usageReporter  = new UsageReporter($maniaControl); | ||||||
| 		$this->rankingManager = new RankingManager($maniaControl); | 		$this->rankingManager = new RankingManager($maniaControl); | ||||||
| 		$this->scriptManager  = new ScriptManager($maniaControl); | 		$this->scriptManager  = new ScriptManager($maniaControl); | ||||||
|   | |||||||
| @@ -26,7 +26,7 @@ use ManiaControl\Players\Player; | |||||||
| use ManiaControl\Players\PlayerManager; | use ManiaControl\Players\PlayerManager; | ||||||
| use ManiaControl\Plugins\Plugin; | use ManiaControl\Plugins\Plugin; | ||||||
| use ManiaControl\Server\Server; | use ManiaControl\Server\Server; | ||||||
| use ManiaControl\Server\ServerCommands; | use ManiaControl\Server\Commands; | ||||||
| use ManiaControl\Utils\ColorUtil; | use ManiaControl\Utils\ColorUtil; | ||||||
| use Maniaplanet\DedicatedServer\Structures\VoteRatio; | use Maniaplanet\DedicatedServer\Structures\VoteRatio; | ||||||
| use Maniaplanet\DedicatedServer\Xmlrpc\ChangeInProgressException; | use Maniaplanet\DedicatedServer\Xmlrpc\ChangeInProgressException; | ||||||
| @@ -134,7 +134,7 @@ class CustomVotesPlugin implements CommandListener, CallbackListener, ManialinkP | |||||||
|  |  | ||||||
| 		$this->maniaControl->commandManager->registerCommandListener('vote', $this, 'chat_vote', false, 'Starts a new vote.'); | 		$this->maniaControl->commandManager->registerCommandListener('vote', $this, 'chat_vote', false, 'Starts a new vote.'); | ||||||
| 		$this->maniaControl->timerManager->registerTimerListening($this, 'handle1Second', 1000); | 		$this->maniaControl->timerManager->registerTimerListening($this, 'handle1Second', 1000); | ||||||
| 		$this->maniaControl->callbackManager->registerCallbackListener(ServerCommands::CB_VOTE_CANCELED, $this, 'handleVoteCanceled'); | 		$this->maniaControl->callbackManager->registerCallbackListener(Commands::CB_VOTE_CANCELED, $this, 'handleVoteCanceled'); | ||||||
| 		$this->maniaControl->manialinkManager->registerManialinkPageAnswerListener(self::ACTION_POSITIVE_VOTE, $this, 'handlePositiveVote'); | 		$this->maniaControl->manialinkManager->registerManialinkPageAnswerListener(self::ACTION_POSITIVE_VOTE, $this, 'handlePositiveVote'); | ||||||
| 		$this->maniaControl->manialinkManager->registerManialinkPageAnswerListener(self::ACTION_NEGATIVE_VOTE, $this, 'handleNegativeVote'); | 		$this->maniaControl->manialinkManager->registerManialinkPageAnswerListener(self::ACTION_NEGATIVE_VOTE, $this, 'handleNegativeVote'); | ||||||
|  |  | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user