Refactoring of Code, Comments and Spelling
This commit is contained in:
		@@ -4,6 +4,7 @@ namespace ManiaControl\Server;
 | 
			
		||||
 | 
			
		||||
use ManiaControl\FileUtil;
 | 
			
		||||
use ManiaControl\ManiaControl;
 | 
			
		||||
use ManiaControl\Players\Player;
 | 
			
		||||
 | 
			
		||||
require_once __DIR__ . '/ServerCommands.php';
 | 
			
		||||
 | 
			
		||||
@@ -159,7 +160,7 @@ class Server {
 | 
			
		||||
	 */
 | 
			
		||||
	public function getSystemInfo() {
 | 
			
		||||
		if (!$this->maniaControl->client->query('GetSystemInfo')) {
 | 
			
		||||
			trigger_error("Couldn't fetch server system info. " . $this->maniaControl->getClientErrorText($client));
 | 
			
		||||
			trigger_error("Couldn't fetch server system info. " . $this->maniaControl->getClientErrorText($this->maniaControl->client));
 | 
			
		||||
			return null;
 | 
			
		||||
		}
 | 
			
		||||
		return $this->maniaControl->client->getResponse();
 | 
			
		||||
@@ -252,7 +253,7 @@ class Server {
 | 
			
		||||
		$map = $this->getMap();
 | 
			
		||||
		$gameMode = $this->getGameMode();
 | 
			
		||||
		$time = time();
 | 
			
		||||
		$fileName = "GhostReplays/Ghost.{$login}.{$gameMode}.{$time}.{$map['UId']}.Replay.Gbx";
 | 
			
		||||
		$fileName = "GhostReplays/Ghost.{$player->login}.{$gameMode}.{$time}.{$map['UId']}.Replay.Gbx";
 | 
			
		||||
		
 | 
			
		||||
		// Save ghost replay
 | 
			
		||||
		if (!$this->maniaControl->client->query('SaveBestGhostsReplay', $player->login, $fileName)) {
 | 
			
		||||
 
 | 
			
		||||
@@ -161,7 +161,7 @@ class ServerCommands implements CallbackListener, CommandListener {
 | 
			
		||||
		}
 | 
			
		||||
		$serverName = $params[1];
 | 
			
		||||
		if (!$this->maniaControl->client->query('SetServerName', $serverName)) {
 | 
			
		||||
			$this->maniaControl->chat->sendError('Error occured: ' . $this->maniaControl->getClientErrorText(), $player->login);
 | 
			
		||||
			$this->maniaControl->chat->sendError('Error occurred: ' . $this->maniaControl->getClientErrorText(), $player->login);
 | 
			
		||||
			return;
 | 
			
		||||
		}
 | 
			
		||||
		$this->maniaControl->chat->sendSuccess("Server name changed to: '{$serverName}'!", $player->login);
 | 
			
		||||
@@ -187,7 +187,7 @@ class ServerCommands implements CallbackListener, CommandListener {
 | 
			
		||||
		}
 | 
			
		||||
		$success = $this->maniaControl->client->query('SetServerPassword', $password);
 | 
			
		||||
		if (!$success) {
 | 
			
		||||
			$this->maniaControl->chat->sendError('Error occured: ' . $this->maniaControl->getClientErrorText(), $player->login);
 | 
			
		||||
			$this->maniaControl->chat->sendError('Error occurred: ' . $this->maniaControl->getClientErrorText(), $player->login);
 | 
			
		||||
			return;
 | 
			
		||||
		}
 | 
			
		||||
		$this->maniaControl->chat->sendSuccess($successMessage, $player->login);
 | 
			
		||||
@@ -213,7 +213,7 @@ class ServerCommands implements CallbackListener, CommandListener {
 | 
			
		||||
		}
 | 
			
		||||
		$success = $this->maniaControl->client->query('SetServerPasswordForSpectator', $password);
 | 
			
		||||
		if (!$success) {
 | 
			
		||||
			$this->maniaControl->chat->sendError('Error occured: ' . $this->maniaControl->getClientErrorText(), $player->login);
 | 
			
		||||
			$this->maniaControl->chat->sendError('Error occurred: ' . $this->maniaControl->getClientErrorText(), $player->login);
 | 
			
		||||
			return;
 | 
			
		||||
		}
 | 
			
		||||
		$this->maniaControl->chat->sendSuccess($successMessage, $player->login);
 | 
			
		||||
@@ -246,7 +246,7 @@ class ServerCommands implements CallbackListener, CommandListener {
 | 
			
		||||
		}
 | 
			
		||||
		$success = $this->maniaControl->client->query('SetMaxPlayers', $amount);
 | 
			
		||||
		if (!$success) {
 | 
			
		||||
			$this->maniaControl->chat->sendError('Error occured: ' . $this->maniaControl->getClientErrorText(), $player->login);
 | 
			
		||||
			$this->maniaControl->chat->sendError('Error occurred: ' . $this->maniaControl->getClientErrorText(), $player->login);
 | 
			
		||||
			return;
 | 
			
		||||
		}
 | 
			
		||||
		$this->maniaControl->chat->sendSuccess("Changed max players to: {$amount}", $player->login);
 | 
			
		||||
@@ -279,7 +279,7 @@ class ServerCommands implements CallbackListener, CommandListener {
 | 
			
		||||
		}
 | 
			
		||||
		$success = $this->maniaControl->client->query('SetMaxSpectators', $amount);
 | 
			
		||||
		if (!$success) {
 | 
			
		||||
			$this->maniaControl->chat->sendError('Error occured: ' . $this->maniaControl->getClientErrorText(), $player->login);
 | 
			
		||||
			$this->maniaControl->chat->sendError('Error occurred: ' . $this->maniaControl->getClientErrorText(), $player->login);
 | 
			
		||||
			return;
 | 
			
		||||
		}
 | 
			
		||||
		$this->maniaControl->chat->sendSuccess("Changed max spectators to: {$amount}", $player->login);
 | 
			
		||||
@@ -298,7 +298,7 @@ class ServerCommands implements CallbackListener, CommandListener {
 | 
			
		||||
		}
 | 
			
		||||
		$success = $this->maniaControl->client->query('SetHideServer', 1);
 | 
			
		||||
		if (!$success) {
 | 
			
		||||
			$this->maniaControl->chat->sendError('Error occured: ' . $this->maniaControl->getClientErrorText(), $player->login);
 | 
			
		||||
			$this->maniaControl->chat->sendError('Error occurred: ' . $this->maniaControl->getClientErrorText(), $player->login);
 | 
			
		||||
			return;
 | 
			
		||||
		}
 | 
			
		||||
		$this->maniaControl->chat->sendSuccess('Server is now hidden!', $player->login);
 | 
			
		||||
@@ -317,7 +317,7 @@ class ServerCommands implements CallbackListener, CommandListener {
 | 
			
		||||
		}
 | 
			
		||||
		$success = $this->maniaControl->client->query('SetHideServer', 0);
 | 
			
		||||
		if (!$success) {
 | 
			
		||||
			$this->maniaControl->chat->sendError('Error occured: ' . $this->maniaControl->getClientErrorText(), $player->login);
 | 
			
		||||
			$this->maniaControl->chat->sendError('Error occurred: ' . $this->maniaControl->getClientErrorText(), $player->login);
 | 
			
		||||
			return;
 | 
			
		||||
		}
 | 
			
		||||
		$this->maniaControl->chat->sendSuccess('Server is now visible!', $player->login);
 | 
			
		||||
@@ -336,7 +336,7 @@ class ServerCommands implements CallbackListener, CommandListener {
 | 
			
		||||
		}
 | 
			
		||||
		$success = $this->maniaControl->client->query('AllowMapDownload', true);
 | 
			
		||||
		if (!$success) {
 | 
			
		||||
			$this->maniaControl->chat->sendError('Error occured: ' . $this->maniaControl->getClientErrorText(), $player->login);
 | 
			
		||||
			$this->maniaControl->chat->sendError('Error occurred: ' . $this->maniaControl->getClientErrorText(), $player->login);
 | 
			
		||||
			return;
 | 
			
		||||
		}
 | 
			
		||||
		$this->maniaControl->chat->sendSuccess('Map Download is now enabled!', $player->login);
 | 
			
		||||
@@ -355,7 +355,7 @@ class ServerCommands implements CallbackListener, CommandListener {
 | 
			
		||||
		}
 | 
			
		||||
		$success = $this->maniaControl->client->query('AllowMapDownload', false);
 | 
			
		||||
		if (!$success) {
 | 
			
		||||
			$this->maniaControl->chat->sendError('Error occured: ' . $this->maniaControl->getClientErrorText(), $player->login);
 | 
			
		||||
			$this->maniaControl->chat->sendError('Error occurred: ' . $this->maniaControl->getClientErrorText(), $player->login);
 | 
			
		||||
			return;
 | 
			
		||||
		}
 | 
			
		||||
		$this->maniaControl->chat->sendSuccess('Map Download is now disabled!', $player->login);
 | 
			
		||||
@@ -374,7 +374,7 @@ class ServerCommands implements CallbackListener, CommandListener {
 | 
			
		||||
		}
 | 
			
		||||
		$success = $this->maniaControl->client->query('DisableHorns', false);
 | 
			
		||||
		if (!$success) {
 | 
			
		||||
			$this->maniaControl->chat->sendError('Error occured: ' . $this->maniaControl->getClientErrorText(), $player->login);
 | 
			
		||||
			$this->maniaControl->chat->sendError('Error occurred: ' . $this->maniaControl->getClientErrorText(), $player->login);
 | 
			
		||||
			return;
 | 
			
		||||
		}
 | 
			
		||||
		$this->maniaControl->chat->sendSuccess('Horns enabled!', $player->login);
 | 
			
		||||
@@ -393,7 +393,7 @@ class ServerCommands implements CallbackListener, CommandListener {
 | 
			
		||||
		}
 | 
			
		||||
		$success = $this->maniaControl->client->query('DisableHorns', true);
 | 
			
		||||
		if (!$success) {
 | 
			
		||||
			$this->maniaControl->chat->sendError('Error occured: ' . $this->maniaControl->getClientErrorText(), $player->login);
 | 
			
		||||
			$this->maniaControl->chat->sendError('Error occurred: ' . $this->maniaControl->getClientErrorText(), $player->login);
 | 
			
		||||
			return;
 | 
			
		||||
		}
 | 
			
		||||
		$this->maniaControl->chat->sendSuccess('Horns disabled!', $player->login);
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user