changed all client Exceptions from Exception to \Exception
This commit is contained in:
parent
34db6ea31b
commit
f825c0c111
@ -3,7 +3,6 @@
|
|||||||
namespace ManiaControl\Callbacks;
|
namespace ManiaControl\Callbacks;
|
||||||
|
|
||||||
use ManiaControl\ManiaControl;
|
use ManiaControl\ManiaControl;
|
||||||
use Maniaplanet\DedicatedServer\Xmlrpc\Exception;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class for managing Server and ManiaControl Callbacks
|
* Class for managing Server and ManiaControl Callbacks
|
||||||
@ -193,7 +192,7 @@ class CallbackManager {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
$callbacks = $this->maniaControl->client->executeCallbacks();
|
$callbacks = $this->maniaControl->client->executeCallbacks();
|
||||||
} catch(Exception $e) {
|
} catch(\Exception $e) {
|
||||||
trigger_error("Error reading server callbacks. " . $e->getMessage());
|
trigger_error("Error reading server callbacks. " . $e->getMessage());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -13,7 +13,6 @@ use ManiaControl\Callbacks\CallbackListener;
|
|||||||
use ManiaControl\Callbacks\CallbackManager;
|
use ManiaControl\Callbacks\CallbackManager;
|
||||||
use ManiaControl\ManiaControl;
|
use ManiaControl\ManiaControl;
|
||||||
use ManiaControl\Players\Player;
|
use ManiaControl\Players\Player;
|
||||||
use Maniaplanet\DedicatedServer\Xmlrpc\Exception;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class offering a Configurator for Script Settings
|
* Class offering a Configurator for Script Settings
|
||||||
@ -126,7 +125,7 @@ class ScriptSettings implements ConfiguratorMenu, CallbackListener {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
$this->maniaControl->client->setModeScriptSettings($loadedSettings);
|
$this->maniaControl->client->setModeScriptSettings($loadedSettings);
|
||||||
} catch(Exception $e) {
|
} catch(\Exception $e) {
|
||||||
trigger_error('Error occured: ' . $e->getMessage());
|
trigger_error('Error occured: ' . $e->getMessage());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -379,7 +378,7 @@ class ScriptSettings implements ConfiguratorMenu, CallbackListener {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
$success = $this->maniaControl->client->setModeScriptSettings($newSettings);
|
$success = $this->maniaControl->client->setModeScriptSettings($newSettings);
|
||||||
} catch(Exception $e) {
|
} catch(\Exception $e) {
|
||||||
$this->maniaControl->chat->sendError('Error occurred: ' . $e->getMessage(), $player->login);
|
$this->maniaControl->chat->sendError('Error occurred: ' . $e->getMessage(), $player->login);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -13,7 +13,7 @@ use ManiaControl\Callbacks\CallbackListener;
|
|||||||
use ManiaControl\Callbacks\CallbackManager;
|
use ManiaControl\Callbacks\CallbackManager;
|
||||||
use ManiaControl\ManiaControl;
|
use ManiaControl\ManiaControl;
|
||||||
use ManiaControl\Players\Player;
|
use ManiaControl\Players\Player;
|
||||||
use Maniaplanet\DedicatedServer\Xmlrpc\Exception;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class offering a Configurator for Server Settings
|
* Class offering a Configurator for Server Settings
|
||||||
@ -115,7 +115,7 @@ class ServerSettings implements ConfiguratorMenu, CallbackListener {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
$this->maniaControl->client->setServerOptions($serverSettings);
|
$this->maniaControl->client->setServerOptions($serverSettings);
|
||||||
} catch(Exception $e) {
|
} catch(\Exception $e) {
|
||||||
trigger_error('Error occured: ' . $e->getMessage());
|
trigger_error('Error occured: ' . $e->getMessage());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -332,7 +332,7 @@ class ServerSettings implements ConfiguratorMenu, CallbackListener {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
$this->maniaControl->client->setServerOptions($newSettings);
|
$this->maniaControl->client->setServerOptions($newSettings);
|
||||||
} catch(Exception $e) {
|
} catch(\Exception $e) {
|
||||||
trigger_error('Error occured: ' . $e->getMessage());
|
trigger_error('Error occured: ' . $e->getMessage());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -19,7 +19,6 @@ use ManiaControl\Server\Server;
|
|||||||
use ManiaControl\Settings\SettingManager;
|
use ManiaControl\Settings\SettingManager;
|
||||||
use ManiaControl\Statistics\StatisticManager;
|
use ManiaControl\Statistics\StatisticManager;
|
||||||
use Maniaplanet\DedicatedServer\Connection;
|
use Maniaplanet\DedicatedServer\Connection;
|
||||||
use Maniaplanet\DedicatedServer\Xmlrpc\Exception;
|
|
||||||
|
|
||||||
require_once __DIR__ . '/Maniaplanet/DedicatedServer/Connection.php';
|
require_once __DIR__ . '/Maniaplanet/DedicatedServer/Connection.php';
|
||||||
require_once __DIR__ . '/GbxDataFetcher/gbxdatafetcher.inc.php';
|
require_once __DIR__ . '/GbxDataFetcher/gbxdatafetcher.inc.php';
|
||||||
@ -322,14 +321,14 @@ class ManiaControl implements CommandListener {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
$this->client = Connection::factory($host, $port, self::CONNECT_TIMEOUT, $login, $pass);
|
$this->client = Connection::factory($host, $port, self::CONNECT_TIMEOUT, $login, $pass);
|
||||||
} catch(Exception $e) {
|
} catch(\Exception $e) {
|
||||||
trigger_error("Couldn't authenticate on server with user '{$login}'! " . $e->getMessage(), E_USER_ERROR);
|
trigger_error("Couldn't authenticate on server with user '{$login}'! " . $e->getMessage(), E_USER_ERROR);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Enable callback system
|
// Enable callback system
|
||||||
try {
|
try {
|
||||||
$this->client->enableCallbacks(true);
|
$this->client->enableCallbacks(true);
|
||||||
} catch(Exception $e) {
|
} catch(\Exception $e) {
|
||||||
trigger_error("Couldn't enable callbacks! " . $e->getMessage(), E_USER_ERROR);
|
trigger_error("Couldn't enable callbacks! " . $e->getMessage(), E_USER_ERROR);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -357,7 +356,7 @@ class ManiaControl implements CommandListener {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
$scriptSettings = $this->client->getModeScriptSettings();
|
$scriptSettings = $this->client->getModeScriptSettings();
|
||||||
} catch(Exception $e) {
|
} catch(\Exception $e) {
|
||||||
trigger_error("Couldn't get mode script settings. " . $e->getMessage());
|
trigger_error("Couldn't get mode script settings. " . $e->getMessage());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -369,7 +368,7 @@ class ManiaControl implements CommandListener {
|
|||||||
$scriptSettings['S_UseScriptCallbacks'] = true;
|
$scriptSettings['S_UseScriptCallbacks'] = true;
|
||||||
try {
|
try {
|
||||||
$this->client->setModeScriptSettings($scriptSettings);
|
$this->client->setModeScriptSettings($scriptSettings);
|
||||||
} catch(Exception $e) {
|
} catch(\Exception $e) {
|
||||||
trigger_error("Couldn't set mode script settings to enable script callbacks. " . $e->getMessage());
|
trigger_error("Couldn't set mode script settings to enable script callbacks. " . $e->getMessage());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -10,7 +10,6 @@ use ManiaControl\Callbacks\CallbackListener;
|
|||||||
use ManiaControl\Callbacks\CallbackManager;
|
use ManiaControl\Callbacks\CallbackManager;
|
||||||
use ManiaControl\ManiaControl;
|
use ManiaControl\ManiaControl;
|
||||||
use ManiaControl\Players\Player;
|
use ManiaControl\Players\Player;
|
||||||
use Maniaplanet\DedicatedServer\Xmlrpc\Exception;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Manialink manager class
|
* Manialink manager class
|
||||||
@ -149,7 +148,7 @@ class ManialinkManager implements ManialinkPageAnswerListener, CallbackListener
|
|||||||
|
|
||||||
return $success;
|
return $success;
|
||||||
}
|
}
|
||||||
} catch(Exception $e) {
|
} catch(\Exception $e) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -11,7 +11,6 @@ use ManiaControl\Admin\AuthenticationManager;
|
|||||||
use ManiaControl\Formatter;
|
use ManiaControl\Formatter;
|
||||||
use ManiaControl\ManiaControl;
|
use ManiaControl\ManiaControl;
|
||||||
use ManiaControl\Manialinks\ManialinkManager;
|
use ManiaControl\Manialinks\ManialinkManager;
|
||||||
use Maniaplanet\DedicatedServer\Xmlrpc\Exception;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* PlayerActions Class
|
* PlayerActions Class
|
||||||
@ -86,7 +85,7 @@ class PlayerActions {
|
|||||||
try {
|
try {
|
||||||
$this->maniaControl->client->forceSpectator($target->login, self::SPECTATOR_PLAYER);
|
$this->maniaControl->client->forceSpectator($target->login, self::SPECTATOR_PLAYER);
|
||||||
|
|
||||||
} catch(Exception $e) {
|
} catch(\Exception $e) {
|
||||||
$this->maniaControl->chat->sendError('Error occurred: ' . $e->getMessage(), $admin->login);
|
$this->maniaControl->chat->sendError('Error occurred: ' . $e->getMessage(), $admin->login);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -94,7 +93,7 @@ class PlayerActions {
|
|||||||
if($userIsAbleToSelect) {
|
if($userIsAbleToSelect) {
|
||||||
try {
|
try {
|
||||||
$this->maniaControl->client->forceSpectator($target->login, self::SPECTATOR_USER_SELECTABLE);
|
$this->maniaControl->client->forceSpectator($target->login, self::SPECTATOR_USER_SELECTABLE);
|
||||||
} catch(Exception $e) {
|
} catch(\Exception $e) {
|
||||||
$this->maniaControl->chat->sendError('Error occurred: ' . $e->getMessage(), $admin->login);
|
$this->maniaControl->chat->sendError('Error occurred: ' . $e->getMessage(), $admin->login);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -131,7 +130,7 @@ class PlayerActions {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
$this->maniaControl->client->forcePlayerTeam($target->login, $teamId);
|
$this->maniaControl->client->forcePlayerTeam($target->login, $teamId);
|
||||||
} catch(Exception $e) {
|
} catch(\Exception $e) {
|
||||||
$this->maniaControl->chat->sendError('Error occurred: ' . $e->getMessage(), $admin->login);
|
$this->maniaControl->chat->sendError('Error occurred: ' . $e->getMessage(), $admin->login);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -168,7 +167,7 @@ class PlayerActions {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
$this->maniaControl->client->forceSpectator($target->login, $spectatorState);
|
$this->maniaControl->client->forceSpectator($target->login, $spectatorState);
|
||||||
} catch(Exception $e) {
|
} catch(\Exception $e) {
|
||||||
$this->maniaControl->chat->sendError('Error occurred: ' . $e->getMessage(), $admin->login);
|
$this->maniaControl->chat->sendError('Error occurred: ' . $e->getMessage(), $admin->login);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -182,7 +181,7 @@ class PlayerActions {
|
|||||||
// Free player slot
|
// Free player slot
|
||||||
try {
|
try {
|
||||||
$this->maniaControl->client->spectatorReleasePlayerSlot($target->login);
|
$this->maniaControl->client->spectatorReleasePlayerSlot($target->login);
|
||||||
} catch(Exception $e) {
|
} catch(\Exception $e) {
|
||||||
//do nothing
|
//do nothing
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -206,7 +205,7 @@ class PlayerActions {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
$this->maniaControl->client->unIgnore($targetLogin);
|
$this->maniaControl->client->unIgnore($targetLogin);
|
||||||
} catch(Exception $e) {
|
} catch(\Exception $e) {
|
||||||
$this->maniaControl->chat->sendError('Error occurred: ' . $e->getMessage(), $adminLogin);
|
$this->maniaControl->chat->sendError('Error occurred: ' . $e->getMessage(), $adminLogin);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -235,7 +234,7 @@ class PlayerActions {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
$this->maniaControl->client->ignore($targetLogin);
|
$this->maniaControl->client->ignore($targetLogin);
|
||||||
} catch(Exception $e) {
|
} catch(\Exception $e) {
|
||||||
$this->maniaControl->chat->sendError('Error occurred: ' . $e->getMessage(), $admin->login);
|
$this->maniaControl->chat->sendError('Error occurred: ' . $e->getMessage(), $admin->login);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -350,7 +349,7 @@ class PlayerActions {
|
|||||||
} else {
|
} else {
|
||||||
$this->maniaControl->client->kick($target->login, $message);
|
$this->maniaControl->client->kick($target->login, $message);
|
||||||
}
|
}
|
||||||
} catch(Exception $e) {
|
} catch(\Exception $e) {
|
||||||
$this->maniaControl->chat->sendError('Error occurred: ' . $e->getMessage(), $admin->login);
|
$this->maniaControl->chat->sendError('Error occurred: ' . $e->getMessage(), $admin->login);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -387,7 +386,7 @@ class PlayerActions {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
$this->maniaControl->client->ban($target->login, $message);
|
$this->maniaControl->client->ban($target->login, $message);
|
||||||
} catch(Exception $e) {
|
} catch(\Exception $e) {
|
||||||
$this->maniaControl->chat->sendError('Error occurred: ' . $e->getMessage(), $admin->login);
|
$this->maniaControl->chat->sendError('Error occurred: ' . $e->getMessage(), $admin->login);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -8,7 +8,6 @@ use ManiaControl\Admin\AuthenticationManager;
|
|||||||
use ManiaControl\Commands\CommandListener;
|
use ManiaControl\Commands\CommandListener;
|
||||||
use ManiaControl\ManiaControl;
|
use ManiaControl\ManiaControl;
|
||||||
use ManiaControl\Manialinks\ManialinkPageAnswerListener;
|
use ManiaControl\Manialinks\ManialinkPageAnswerListener;
|
||||||
use Maniaplanet\DedicatedServer\Xmlrpc\Exception;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class offering various Admin Commands related to Players
|
* Class offering various Admin Commands related to Players
|
||||||
@ -86,7 +85,7 @@ class PlayerCommands implements CommandListener, ManialinkPageAnswerListener {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
$this->maniaControl->client->autoTeamBalance();
|
$this->maniaControl->client->autoTeamBalance();
|
||||||
} catch(Exception $e) {
|
} catch(\Exception $e) {
|
||||||
$this->maniaControl->chat->sendError('Error occurred: ' . $e->getMessage(), $player->login);
|
$this->maniaControl->chat->sendError('Error occurred: ' . $e->getMessage(), $player->login);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -252,7 +251,7 @@ class PlayerCommands implements CommandListener, ManialinkPageAnswerListener {
|
|||||||
for($i = 0; $i < $amount; $i++) {
|
for($i = 0; $i < $amount; $i++) {
|
||||||
$this->maniaControl->client->connectFakePlayer();
|
$this->maniaControl->client->connectFakePlayer();
|
||||||
}
|
}
|
||||||
} catch(Exception $e) {
|
} catch(\Exception $e) {
|
||||||
$this->maniaControl->chat->sendError('Error occurred: ' . $e->getMessage(), $player->login);
|
$this->maniaControl->chat->sendError('Error occurred: ' . $e->getMessage(), $player->login);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -274,7 +273,7 @@ class PlayerCommands implements CommandListener, ManialinkPageAnswerListener {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
$this->maniaControl->client->disconnectFakePlayer('*');
|
$this->maniaControl->client->disconnectFakePlayer('*');
|
||||||
} catch(Exception $e) {
|
} catch(\Exception $e) {
|
||||||
$this->maniaControl->chat->sendError('Error occurred: ' . $e->getMessage(), $player->login);
|
$this->maniaControl->chat->sendError('Error occurred: ' . $e->getMessage(), $player->login);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -7,7 +7,6 @@ use ManiaControl\Callbacks\CallbackManager;
|
|||||||
use ManiaControl\ManiaControl;
|
use ManiaControl\ManiaControl;
|
||||||
use ManiaControl\Players\Player;
|
use ManiaControl\Players\Player;
|
||||||
use Maniaplanet\DedicatedServer\Structures\SystemInfos;
|
use Maniaplanet\DedicatedServer\Structures\SystemInfos;
|
||||||
use Maniaplanet\DedicatedServer\Xmlrpc\Exception;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class providing Information about theconnected ManiaPlanet Server
|
* Class providing Information about theconnected ManiaPlanet Server
|
||||||
@ -76,13 +75,13 @@ class Server implements CallbackListener {
|
|||||||
) ON DUPLICATE KEY UPDATE
|
) ON DUPLICATE KEY UPDATE
|
||||||
`index` = LAST_INSERT_ID(`index`);";
|
`index` = LAST_INSERT_ID(`index`);";
|
||||||
$statement = $mysqli->prepare($query);
|
$statement = $mysqli->prepare($query);
|
||||||
if($mysqli->error) {
|
if ($mysqli->error) {
|
||||||
trigger_error($mysqli->error);
|
trigger_error($mysqli->error);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
$statement->bind_param('s', $this->login);
|
$statement->bind_param('s', $this->login);
|
||||||
$statement->execute();
|
$statement->execute();
|
||||||
if($statement->error) {
|
if ($statement->error) {
|
||||||
trigger_error($statement->error);
|
trigger_error($statement->error);
|
||||||
$statement->close();
|
$statement->close();
|
||||||
return;
|
return;
|
||||||
@ -105,12 +104,12 @@ class Server implements CallbackListener {
|
|||||||
UNIQUE KEY `login` (`login`)
|
UNIQUE KEY `login` (`login`)
|
||||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Servers' AUTO_INCREMENT=1;";
|
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Servers' AUTO_INCREMENT=1;";
|
||||||
$statement = $mysqli->prepare($query);
|
$statement = $mysqli->prepare($query);
|
||||||
if($mysqli->error) {
|
if ($mysqli->error) {
|
||||||
trigger_error($mysqli->error, E_USER_ERROR);
|
trigger_error($mysqli->error, E_USER_ERROR);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
$statement->execute();
|
$statement->execute();
|
||||||
if($statement->error) {
|
if ($statement->error) {
|
||||||
trigger_error($statement->error, E_USER_ERROR);
|
trigger_error($statement->error, E_USER_ERROR);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -133,10 +132,10 @@ class Server implements CallbackListener {
|
|||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function getDataDirectory() {
|
public function getDataDirectory() {
|
||||||
if($this->dataDirectory == '') {
|
if ($this->dataDirectory == '') {
|
||||||
try {
|
try {
|
||||||
$this->dataDirectory = $this->maniaControl->client->gameDataDirectory();
|
$this->dataDirectory = $this->maniaControl->client->gameDataDirectory();
|
||||||
} catch(Exception $e) {
|
} catch(\Exception $e) {
|
||||||
trigger_error("Couldn't get data directory. " . $e->getMessage());
|
trigger_error("Couldn't get data directory. " . $e->getMessage());
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@ -151,7 +150,7 @@ class Server implements CallbackListener {
|
|||||||
*/
|
*/
|
||||||
public function getMapsDirectory() {
|
public function getMapsDirectory() {
|
||||||
$dataDirectory = $this->getDataDirectory();
|
$dataDirectory = $this->getDataDirectory();
|
||||||
if(!$dataDirectory) {
|
if (!$dataDirectory) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
return "{$dataDirectory}Maps/";
|
return "{$dataDirectory}Maps/";
|
||||||
@ -164,7 +163,7 @@ class Server implements CallbackListener {
|
|||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public function checkAccess($directory) {
|
public function checkAccess($directory) {
|
||||||
if(!$directory) {
|
if (!$directory) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return (is_dir($directory) && is_writable($directory));
|
return (is_dir($directory) && is_writable($directory));
|
||||||
@ -177,11 +176,11 @@ class Server implements CallbackListener {
|
|||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public function getInfo($detailed = false) {
|
public function getInfo($detailed = false) {
|
||||||
if($detailed) {
|
if ($detailed) {
|
||||||
$login = $this->login;
|
$login = $this->login;
|
||||||
try {
|
try {
|
||||||
$info = $this->maniaControl->client->getDetailedPlayerInfo($login);
|
$info = $this->maniaControl->client->getDetailedPlayerInfo($login);
|
||||||
} catch(Exception $e) {
|
} catch(\Exception $e) {
|
||||||
trigger_error("Couldn't fetch detailed server info. " . $e->getMessage());
|
trigger_error("Couldn't fetch detailed server info. " . $e->getMessage());
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@ -189,7 +188,7 @@ class Server implements CallbackListener {
|
|||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
$info = $this->maniaControl->client->getMainServerPlayerInfo();
|
$info = $this->maniaControl->client->getMainServerPlayerInfo();
|
||||||
} catch(Exception $e) {
|
} catch(\Exception $e) {
|
||||||
trigger_error("Couldn't fetch server info. " . $e->getMessage());
|
trigger_error("Couldn't fetch server info. " . $e->getMessage());
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@ -204,7 +203,7 @@ class Server implements CallbackListener {
|
|||||||
public function getOptions() {
|
public function getOptions() {
|
||||||
try {
|
try {
|
||||||
$options = $this->maniaControl->client->getServerOptions();
|
$options = $this->maniaControl->client->getServerOptions();
|
||||||
} catch(Exception $e) {
|
} catch(\Exception $e) {
|
||||||
trigger_error("Couldn't fetch server options. " . $e->getMessage());
|
trigger_error("Couldn't fetch server options. " . $e->getMessage());
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@ -220,7 +219,7 @@ class Server implements CallbackListener {
|
|||||||
public function getName() {
|
public function getName() {
|
||||||
try {
|
try {
|
||||||
$name = $this->maniaControl->client->getServerName();
|
$name = $this->maniaControl->client->getServerName();
|
||||||
} catch(Exception $e) {
|
} catch(\Exception $e) {
|
||||||
trigger_error("Couldn't fetch server name. " . $e->getMessage());
|
trigger_error("Couldn't fetch server name. " . $e->getMessage());
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@ -236,7 +235,7 @@ class Server implements CallbackListener {
|
|||||||
public function getVersion() {
|
public function getVersion() {
|
||||||
try {
|
try {
|
||||||
$version = $this->maniaControl->client->getVersion();
|
$version = $this->maniaControl->client->getVersion();
|
||||||
} catch(Exception $e) {
|
} catch(\Exception $e) {
|
||||||
trigger_error("Couldn't fetch server version. " . $e->getMessage());
|
trigger_error("Couldn't fetch server version. " . $e->getMessage());
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@ -251,7 +250,7 @@ class Server implements CallbackListener {
|
|||||||
public function getSystemInfo() {
|
public function getSystemInfo() {
|
||||||
try {
|
try {
|
||||||
$systemInfo = $this->maniaControl->client->getSystemInfo();
|
$systemInfo = $this->maniaControl->client->getSystemInfo();
|
||||||
} catch(Exception $e) {
|
} catch(\Exception $e) {
|
||||||
trigger_error("Couldn't fetch server system info. " . $e->getMessage());
|
trigger_error("Couldn't fetch server system info. " . $e->getMessage());
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@ -267,17 +266,17 @@ class Server implements CallbackListener {
|
|||||||
* @return int | string
|
* @return int | string
|
||||||
*/
|
*/
|
||||||
public function getGameMode($stringValue = false, $parseValue = null) {
|
public function getGameMode($stringValue = false, $parseValue = null) {
|
||||||
if(is_int($parseValue)) {
|
if (is_int($parseValue)) {
|
||||||
$gameMode = $parseValue;
|
$gameMode = $parseValue;
|
||||||
} else {
|
} else {
|
||||||
try {
|
try {
|
||||||
$gameMode = $this->maniaControl->client->getGameMode();
|
$gameMode = $this->maniaControl->client->getGameMode();
|
||||||
} catch(Exception $e) {
|
} catch(\Exception $e) {
|
||||||
trigger_error("Couldn't fetch current game mode. " . $e->getMessage());
|
trigger_error("Couldn't fetch current game mode. " . $e->getMessage());
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if($stringValue) {
|
if ($stringValue) {
|
||||||
switch($gameMode) {
|
switch($gameMode) {
|
||||||
case 0:
|
case 0:
|
||||||
return 'Script';
|
return 'Script';
|
||||||
@ -309,7 +308,7 @@ class Server implements CallbackListener {
|
|||||||
public function getValidationReplay(Player $player) {
|
public function getValidationReplay(Player $player) {
|
||||||
try {
|
try {
|
||||||
$replay = $this->maniaControl->client->getValidationReplay($player->login);
|
$replay = $this->maniaControl->client->getValidationReplay($player->login);
|
||||||
} catch(Exception $e) {
|
} catch(\Exception $e) {
|
||||||
trigger_error("Couldn't get validation replay of '{$player->login}'. " . $e->getMessage());
|
trigger_error("Couldn't get validation replay of '{$player->login}'. " . $e->getMessage());
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@ -324,7 +323,7 @@ class Server implements CallbackListener {
|
|||||||
*/
|
*/
|
||||||
public function getGhostReplay(Player $player) {
|
public function getGhostReplay(Player $player) {
|
||||||
$dataDir = $this->getDataDirectory();
|
$dataDir = $this->getDataDirectory();
|
||||||
if(!$this->checkAccess($dataDir)) {
|
if (!$this->checkAccess($dataDir)) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -337,14 +336,14 @@ class Server implements CallbackListener {
|
|||||||
// Save ghost replay
|
// Save ghost replay
|
||||||
try {
|
try {
|
||||||
$this->maniaControl->client->saveBestGhostsReplay($player->login, $fileName);
|
$this->maniaControl->client->saveBestGhostsReplay($player->login, $fileName);
|
||||||
} catch(Exception $e) {
|
} catch(\Exception $e) {
|
||||||
trigger_error("Couldn't save ghost replay. " . $e->getMessage());
|
trigger_error("Couldn't save ghost replay. " . $e->getMessage());
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Load replay file
|
// Load replay file
|
||||||
$ghostReplay = file_get_contents("{$dataDir}Replays/{$fileName}");
|
$ghostReplay = file_get_contents("{$dataDir}Replays/{$fileName}");
|
||||||
if(!$ghostReplay) {
|
if (!$ghostReplay) {
|
||||||
trigger_error("Couldn't retrieve saved ghost replay.");
|
trigger_error("Couldn't retrieve saved ghost replay.");
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@ -360,7 +359,7 @@ class Server implements CallbackListener {
|
|||||||
public function waitForStatus($statusCode = 4) {
|
public function waitForStatus($statusCode = 4) {
|
||||||
$response = $this->maniaControl->client->getStatus();
|
$response = $this->maniaControl->client->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;
|
||||||
}
|
}
|
||||||
// Server not yet in given status - Wait for it...
|
// Server not yet in given status - Wait for it...
|
||||||
@ -372,11 +371,11 @@ class Server implements CallbackListener {
|
|||||||
while($response->code !== 4) {
|
while($response->code !== 4) {
|
||||||
sleep(1);
|
sleep(1);
|
||||||
$response = $this->maniaControl->client->getStatus();
|
$response = $this->maniaControl->client->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'];
|
||||||
}
|
}
|
||||||
if(time() - $maxWaitTime > $waitBegin) {
|
if (time() - $maxWaitTime > $waitBegin) {
|
||||||
// It took too long to reach the status
|
// It took too long to reach the status
|
||||||
trigger_error("Server couldn't reach status {$statusCode} after {$maxWaitTime} seconds! ");
|
trigger_error("Server couldn't reach status {$statusCode} after {$maxWaitTime} seconds! ");
|
||||||
return false;
|
return false;
|
||||||
|
@ -12,7 +12,6 @@ use ManiaControl\Commands\CommandListener;
|
|||||||
use ManiaControl\ManiaControl;
|
use ManiaControl\ManiaControl;
|
||||||
use ManiaControl\Manialinks\ManialinkPageAnswerListener;
|
use ManiaControl\Manialinks\ManialinkPageAnswerListener;
|
||||||
use ManiaControl\Players\Player;
|
use ManiaControl\Players\Player;
|
||||||
use Maniaplanet\DedicatedServer\Xmlrpc\Exception;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class offering various commands related to the dedicated server
|
* Class offering various commands related to the dedicated server
|
||||||
@ -220,7 +219,7 @@ class ServerCommands implements CallbackListener, CommandListener, ManialinkPage
|
|||||||
$serverName = $params[1];
|
$serverName = $params[1];
|
||||||
try {
|
try {
|
||||||
$this->maniaControl->client->setServerName($serverName);
|
$this->maniaControl->client->setServerName($serverName);
|
||||||
} catch(Exception $e) {
|
} catch(\Exception $e) {
|
||||||
$this->maniaControl->chat->sendError('Error occurred: ' . $e->getMessage(), $player->login);
|
$this->maniaControl->chat->sendError('Error occurred: ' . $e->getMessage(), $player->login);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -247,7 +246,7 @@ class ServerCommands implements CallbackListener, CommandListener, ManialinkPage
|
|||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
$this->maniaControl->client->setServerPassword($password);
|
$this->maniaControl->client->setServerPassword($password);
|
||||||
} catch(Exception $e) {
|
} catch(\Exception $e) {
|
||||||
$this->maniaControl->chat->sendError('Error occurred: ' . $e->getMessage(), $player->login);
|
$this->maniaControl->chat->sendError('Error occurred: ' . $e->getMessage(), $player->login);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -274,7 +273,7 @@ class ServerCommands implements CallbackListener, CommandListener, ManialinkPage
|
|||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
$this->maniaControl->client->setServerPasswordForSpectator($password);
|
$this->maniaControl->client->setServerPasswordForSpectator($password);
|
||||||
} catch(Exception $e) {
|
} catch(\Exception $e) {
|
||||||
$this->maniaControl->chat->sendError('Error occurred: ' . $e->getMessage(), $player->login);
|
$this->maniaControl->chat->sendError('Error occurred: ' . $e->getMessage(), $player->login);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -309,7 +308,7 @@ class ServerCommands implements CallbackListener, CommandListener, ManialinkPage
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
$this->maniaControl->client->setMaxPlayers($amount);
|
$this->maniaControl->client->setMaxPlayers($amount);
|
||||||
} catch(Exception $e) {
|
} catch(\Exception $e) {
|
||||||
$this->maniaControl->chat->sendError('Error occurred: ' . $e->getMessage(), $player->login);
|
$this->maniaControl->chat->sendError('Error occurred: ' . $e->getMessage(), $player->login);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -345,7 +344,7 @@ class ServerCommands implements CallbackListener, CommandListener, ManialinkPage
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
$this->maniaControl->client->setMaxSpectators($amount);
|
$this->maniaControl->client->setMaxSpectators($amount);
|
||||||
} catch(Exception $e) {
|
} catch(\Exception $e) {
|
||||||
$this->maniaControl->chat->sendError('Error occurred: ' . $e->getMessage(), $player->login);
|
$this->maniaControl->chat->sendError('Error occurred: ' . $e->getMessage(), $player->login);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -361,7 +360,7 @@ class ServerCommands implements CallbackListener, CommandListener, ManialinkPage
|
|||||||
private function shutdownServer($login = '#') {
|
private function shutdownServer($login = '#') {
|
||||||
try {
|
try {
|
||||||
$this->maniaControl->client->stopServer();
|
$this->maniaControl->client->stopServer();
|
||||||
} catch(Exception $e) {
|
} catch(\Exception $e) {
|
||||||
trigger_error("Server shutdown command from '{login}' failed. " . $e->getMessage());
|
trigger_error("Server shutdown command from '{login}' failed. " . $e->getMessage());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -4,7 +4,6 @@ use ManiaControl\Commands\CommandListener;
|
|||||||
use ManiaControl\ManiaControl;
|
use ManiaControl\ManiaControl;
|
||||||
use ManiaControl\Players\Player;
|
use ManiaControl\Players\Player;
|
||||||
use ManiaControl\Plugins\Plugin;
|
use ManiaControl\Plugins\Plugin;
|
||||||
use Maniaplanet\DedicatedServer\Xmlrpc\Exception;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ManiaControl Chat-Message Plugin
|
* ManiaControl Chat-Message Plugin
|
||||||
@ -25,7 +24,6 @@ class ChatMessagePlugin implements CommandListener, Plugin {
|
|||||||
* Private properties
|
* Private properties
|
||||||
*/
|
*/
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* @var maniaControl $maniaControl
|
* @var maniaControl $maniaControl
|
||||||
*/
|
*/
|
||||||
private $maniaControl = null;
|
private $maniaControl = null;
|
||||||
@ -104,7 +102,7 @@ class ChatMessagePlugin implements CommandListener, Plugin {
|
|||||||
public function chat_hi(array $chat, Player $player) {
|
public function chat_hi(array $chat, Player $player) {
|
||||||
$command = explode(" ", $chat[1][2]);
|
$command = explode(" ", $chat[1][2]);
|
||||||
|
|
||||||
if(isset($command[1])) {
|
if (isset($command[1])) {
|
||||||
$msg = '$g[$<' . $player->nickname . '$>$s] $ff0$iHello $z$<' . $this->getTarget($command[1]) . '$>$i!';
|
$msg = '$g[$<' . $player->nickname . '$>$s] $ff0$iHello $z$<' . $this->getTarget($command[1]) . '$>$i!';
|
||||||
} else {
|
} else {
|
||||||
$msg = '$g[$<' . $player->nickname . '$>$s] $ff0$iHello All!';
|
$msg = '$g[$<' . $player->nickname . '$>$s] $ff0$iHello All!';
|
||||||
@ -121,7 +119,7 @@ class ChatMessagePlugin implements CommandListener, Plugin {
|
|||||||
public function chat_bye(array $chat, Player $player) {
|
public function chat_bye(array $chat, Player $player) {
|
||||||
$command = explode(" ", $chat[1][2]);
|
$command = explode(" ", $chat[1][2]);
|
||||||
|
|
||||||
if(isset($command[1])) {
|
if (isset($command[1])) {
|
||||||
$msg = '$g[$<' . $player->nickname . '$>$s] $ff0$iBye $z$<' . $this->getTarget($command[1]) . '$>$i!';
|
$msg = '$g[$<' . $player->nickname . '$>$s] $ff0$iBye $z$<' . $this->getTarget($command[1]) . '$>$i!';
|
||||||
} else {
|
} else {
|
||||||
$msg = '$g[$<' . $player->nickname . '$>$s] $ff0$iI have to go... Bye All!';
|
$msg = '$g[$<' . $player->nickname . '$>$s] $ff0$iI have to go... Bye All!';
|
||||||
@ -139,7 +137,7 @@ class ChatMessagePlugin implements CommandListener, Plugin {
|
|||||||
public function chat_thx(array $chat, Player $player) {
|
public function chat_thx(array $chat, Player $player) {
|
||||||
$command = explode(" ", $chat[1][2]);
|
$command = explode(" ", $chat[1][2]);
|
||||||
|
|
||||||
if(isset($command[1])) {
|
if (isset($command[1])) {
|
||||||
$msg = '$g[$<' . $player->nickname . '$>$s] $ff0$iThanks $z$<' . $this->getTarget($command[1]) . '$>$i!';
|
$msg = '$g[$<' . $player->nickname . '$>$s] $ff0$iThanks $z$<' . $this->getTarget($command[1]) . '$>$i!';
|
||||||
} else {
|
} else {
|
||||||
$msg = '$g[$<' . $player->nickname . '$>$s] $ff0$iThanks All!';
|
$msg = '$g[$<' . $player->nickname . '$>$s] $ff0$iThanks All!';
|
||||||
@ -157,7 +155,7 @@ class ChatMessagePlugin implements CommandListener, Plugin {
|
|||||||
public function chat_gg(array $chat, Player $player) {
|
public function chat_gg(array $chat, Player $player) {
|
||||||
$command = explode(" ", $chat[1][2]);
|
$command = explode(" ", $chat[1][2]);
|
||||||
|
|
||||||
if(isset($command[1])) {
|
if (isset($command[1])) {
|
||||||
$msg = '$g[$<' . $player->nickname . '$>$s] $ff0$iGood Game $z$<' . $this->getTarget($command[1]) . '$>$i!';
|
$msg = '$g[$<' . $player->nickname . '$>$s] $ff0$iGood Game $z$<' . $this->getTarget($command[1]) . '$>$i!';
|
||||||
} else {
|
} else {
|
||||||
$msg = '$g[$<' . $player->nickname . '$>$s] $ff0$iGood Game All!';
|
$msg = '$g[$<' . $player->nickname . '$>$s] $ff0$iGood Game All!';
|
||||||
@ -175,7 +173,7 @@ class ChatMessagePlugin implements CommandListener, Plugin {
|
|||||||
public function chat_gl(array $chat, Player $player) {
|
public function chat_gl(array $chat, Player $player) {
|
||||||
$command = explode(" ", $chat[1][2]);
|
$command = explode(" ", $chat[1][2]);
|
||||||
|
|
||||||
if(isset($command[1])) {
|
if (isset($command[1])) {
|
||||||
$msg = '$g[$<' . $player->nickname . '$>$s] $ff0$iGood Luck $z$<' . $this->getTarget($command[1]) . '$>$i!';
|
$msg = '$g[$<' . $player->nickname . '$>$s] $ff0$iGood Luck $z$<' . $this->getTarget($command[1]) . '$>$i!';
|
||||||
} else {
|
} else {
|
||||||
$msg = '$g[$<' . $player->nickname . '$>$s] $ff0$iGood Luck All!';
|
$msg = '$g[$<' . $player->nickname . '$>$s] $ff0$iGood Luck All!';
|
||||||
@ -193,7 +191,7 @@ class ChatMessagePlugin implements CommandListener, Plugin {
|
|||||||
public function chat_hf(array $chat, Player $player) {
|
public function chat_hf(array $chat, Player $player) {
|
||||||
$command = explode(" ", $chat[1][2]);
|
$command = explode(" ", $chat[1][2]);
|
||||||
|
|
||||||
if(isset($command[1])) {
|
if (isset($command[1])) {
|
||||||
$msg = '$g[$<' . $player->nickname . '$>$s] $ff0$iHave Fun $z$<' . $this->getTarget($command[1]) . '$>$i!';
|
$msg = '$g[$<' . $player->nickname . '$>$s] $ff0$iHave Fun $z$<' . $this->getTarget($command[1]) . '$>$i!';
|
||||||
} else {
|
} else {
|
||||||
$msg = '$g[$<' . $player->nickname . '$>$s] $ff0$iHave Fun All!';
|
$msg = '$g[$<' . $player->nickname . '$>$s] $ff0$iHave Fun All!';
|
||||||
@ -211,7 +209,7 @@ class ChatMessagePlugin implements CommandListener, Plugin {
|
|||||||
public function chat_glhf(array $chat, Player $player) {
|
public function chat_glhf(array $chat, Player $player) {
|
||||||
$command = explode(" ", $chat[1][2]);
|
$command = explode(" ", $chat[1][2]);
|
||||||
|
|
||||||
if(isset($command[1])) {
|
if (isset($command[1])) {
|
||||||
$msg = '$g[$<' . $player->nickname . '$>$s] $ff0$iGood Luck and Have Fun $z$<' . $this->getTarget($command[1]) . '$>$i!';
|
$msg = '$g[$<' . $player->nickname . '$>$s] $ff0$iGood Luck and Have Fun $z$<' . $this->getTarget($command[1]) . '$>$i!';
|
||||||
} else {
|
} else {
|
||||||
$msg = '$g[$<' . $player->nickname . '$>$s] $ff0$iGood Luck and Have Fun All!';
|
$msg = '$g[$<' . $player->nickname . '$>$s] $ff0$iGood Luck and Have Fun All!';
|
||||||
@ -229,7 +227,7 @@ class ChatMessagePlugin implements CommandListener, Plugin {
|
|||||||
public function chat_ns(array $chat, Player $player) {
|
public function chat_ns(array $chat, Player $player) {
|
||||||
$command = explode(" ", $chat[1][2]);
|
$command = explode(" ", $chat[1][2]);
|
||||||
|
|
||||||
if(isset($command[1])) {
|
if (isset($command[1])) {
|
||||||
$msg = '$g[$<' . $player->nickname . '$>$s] $ff0$iNice Shot $z$<' . $this->getTarget($command[1]) . '$>$i!';
|
$msg = '$g[$<' . $player->nickname . '$>$s] $ff0$iNice Shot $z$<' . $this->getTarget($command[1]) . '$>$i!';
|
||||||
} else {
|
} else {
|
||||||
$msg = '$g[$<' . $player->nickname . '$>$s] $ff0$iNice Shot!';
|
$msg = '$g[$<' . $player->nickname . '$>$s] $ff0$iNice Shot!';
|
||||||
@ -247,7 +245,7 @@ class ChatMessagePlugin implements CommandListener, Plugin {
|
|||||||
public function chat_n1(array $chat, Player $player) {
|
public function chat_n1(array $chat, Player $player) {
|
||||||
$command = explode(" ", $chat[1][2]);
|
$command = explode(" ", $chat[1][2]);
|
||||||
|
|
||||||
if(isset($command[1])) {
|
if (isset($command[1])) {
|
||||||
$msg = '$g[$<' . $player->nickname . '$>$s] $ff0$iNice One $z$<' . $this->getTarget($command[1]) . '$>$i!';
|
$msg = '$g[$<' . $player->nickname . '$>$s] $ff0$iNice One $z$<' . $this->getTarget($command[1]) . '$>$i!';
|
||||||
} else {
|
} else {
|
||||||
$msg = '$g[$<' . $player->nickname . '$>$s] $ff0$iNice One!';
|
$msg = '$g[$<' . $player->nickname . '$>$s] $ff0$iNice One!';
|
||||||
@ -313,7 +311,7 @@ class ChatMessagePlugin implements CommandListener, Plugin {
|
|||||||
$message = '$39F Thanks for Playing, please come back soon!$z';
|
$message = '$39F Thanks for Playing, please come back soon!$z';
|
||||||
try {
|
try {
|
||||||
$this->maniaControl->client->kick($player->login, $message);
|
$this->maniaControl->client->kick($player->login, $message);
|
||||||
} catch(Exception $e) {
|
} catch(\Exception $e) {
|
||||||
$this->maniaControl->chat->sendError('Error occurred: ' . $e->getMessage(), $player->login);
|
$this->maniaControl->chat->sendError('Error occurred: ' . $e->getMessage(), $player->login);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -332,7 +330,7 @@ class ChatMessagePlugin implements CommandListener, Plugin {
|
|||||||
$message = '$39F Thanks for Playing, please come back soon!$z';
|
$message = '$39F Thanks for Playing, please come back soon!$z';
|
||||||
try {
|
try {
|
||||||
$this->maniaControl->client->kick($player->login, $message);
|
$this->maniaControl->client->kick($player->login, $message);
|
||||||
} catch(Exception $e) {
|
} catch(\Exception $e) {
|
||||||
$this->maniaControl->chat->sendError('Error occurred: ' . $e->getMessage(), $player->login);
|
$this->maniaControl->chat->sendError('Error occurred: ' . $e->getMessage(), $player->login);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -348,11 +346,11 @@ class ChatMessagePlugin implements CommandListener, Plugin {
|
|||||||
$msg = '$g[$<' . $player->nickname . '$>$s] $ff0$iAway From Keyboard!';
|
$msg = '$g[$<' . $player->nickname . '$>$s] $ff0$iAway From Keyboard!';
|
||||||
$this->maniaControl->chat->sendChat($msg, null, false);
|
$this->maniaControl->chat->sendChat($msg, null, false);
|
||||||
|
|
||||||
if($this->maniaControl->settingManager->getSetting($this, self::SETTING_AFK_FORCE_SPEC)) {
|
if ($this->maniaControl->settingManager->getSetting($this, self::SETTING_AFK_FORCE_SPEC)) {
|
||||||
// force into spec
|
// force into spec
|
||||||
try {
|
try {
|
||||||
$this->maniaControl->client->forceSpectator($player->login, 3);
|
$this->maniaControl->client->forceSpectator($player->login, 3);
|
||||||
} catch(Exception $e) {
|
} catch(\Exception $e) {
|
||||||
$this->maniaControl->chat->sendError('Error occurred: ' . $e->getMessage(), $player->login);
|
$this->maniaControl->chat->sendError('Error occurred: ' . $e->getMessage(), $player->login);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -360,7 +358,7 @@ class ChatMessagePlugin implements CommandListener, Plugin {
|
|||||||
// free player slot
|
// free player slot
|
||||||
try {
|
try {
|
||||||
$this->maniaControl->client->spectatorReleasePlayerSlot($player->login);
|
$this->maniaControl->client->spectatorReleasePlayerSlot($player->login);
|
||||||
} catch(Exception $e) {
|
} catch(\Exception $e) {
|
||||||
//to nothing
|
//to nothing
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -377,13 +375,13 @@ class ChatMessagePlugin implements CommandListener, Plugin {
|
|||||||
$pid = 1;
|
$pid = 1;
|
||||||
|
|
||||||
foreach($this->maniaControl->playerManager->getPlayers() as $player) {
|
foreach($this->maniaControl->playerManager->getPlayers() as $player) {
|
||||||
if($login == $player->login || $login == $pid || $login == $player->nickname) {
|
if ($login == $player->login || $login == $pid || $login == $player->nickname) {
|
||||||
return $player->nickname;
|
return $player->nickname;
|
||||||
}
|
}
|
||||||
$pid++;
|
$pid++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if($login == 'lj') {
|
if ($login == 'lj') {
|
||||||
return $player->nickname;
|
return $player->nickname;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -16,7 +16,6 @@ use ManiaControl\ManiaControl;
|
|||||||
use ManiaControl\Players\Player;
|
use ManiaControl\Players\Player;
|
||||||
use ManiaControl\Players\PlayerManager;
|
use ManiaControl\Players\PlayerManager;
|
||||||
use ManiaControl\Plugins\Plugin;
|
use ManiaControl\Plugins\Plugin;
|
||||||
use Maniaplanet\DedicatedServer\Xmlrpc\Exception;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Donation plugin
|
* Donation plugin
|
||||||
@ -336,7 +335,7 @@ class DonationPlugin implements CallbackListener, CommandListener, Plugin {
|
|||||||
$message = 'Donate ' . $amount . ' Planets to $<' . $receiverName . '$>?';
|
$message = 'Donate ' . $amount . ' Planets to $<' . $receiverName . '$>?';
|
||||||
try {
|
try {
|
||||||
$bill = $this->maniaControl->client->sendBill($player->login, $amount, $message, $receiver);
|
$bill = $this->maniaControl->client->sendBill($player->login, $amount, $message, $receiver);
|
||||||
} catch(Exception $e) {
|
} catch(\Exception $e) {
|
||||||
trigger_error("Couldn't create donation of {$amount} planets from '{$player->login}' for '{$receiver}'. " . $e->getMessage());
|
trigger_error("Couldn't create donation of {$amount} planets from '{$player->login}' for '{$receiver}'. " . $e->getMessage());
|
||||||
$this->maniaControl->chat->sendError("Creating donation failed.", $player->login);
|
$this->maniaControl->chat->sendError("Creating donation failed.", $player->login);
|
||||||
return false;
|
return false;
|
||||||
@ -379,7 +378,7 @@ class DonationPlugin implements CallbackListener, CommandListener, Plugin {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
$bill = $this->maniaControl->client->pay($receiver, $amount, $message);
|
$bill = $this->maniaControl->client->pay($receiver, $amount, $message);
|
||||||
} catch(Exception $e) {
|
} catch(\Exception $e) {
|
||||||
trigger_error("Couldn't retrieve server planets. " . $e->getMessage());
|
trigger_error("Couldn't retrieve server planets. " . $e->getMessage());
|
||||||
trigger_error("Couldn't create payout of {$amount} planets by '{$player->login}' for '{$receiver}'. " . $e->getMessage());
|
trigger_error("Couldn't create payout of {$amount} planets by '{$player->login}' for '{$receiver}'. " . $e->getMessage());
|
||||||
$this->maniaControl->chat->sendError("Creating payout failed.", $player->login);
|
$this->maniaControl->chat->sendError("Creating payout failed.", $player->login);
|
||||||
@ -404,7 +403,7 @@ class DonationPlugin implements CallbackListener, CommandListener, Plugin {
|
|||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
$planets = $this->maniaControl->client->getServerPlanets();
|
$planets = $this->maniaControl->client->getServerPlanets();
|
||||||
} catch(Exception $e) {
|
} catch(\Exception $e) {
|
||||||
trigger_error("Couldn't retrieve server planets. " . $e->getMessage());
|
trigger_error("Couldn't retrieve server planets. " . $e->getMessage());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -15,7 +15,6 @@ use ManiaControl\Manialinks\ManialinkPageAnswerListener;
|
|||||||
use ManiaControl\Players\Player;
|
use ManiaControl\Players\Player;
|
||||||
use ManiaControl\Players\PlayerManager;
|
use ManiaControl\Players\PlayerManager;
|
||||||
use ManiaControl\Plugins\Plugin;
|
use ManiaControl\Plugins\Plugin;
|
||||||
use Maniaplanet\DedicatedServer\Xmlrpc\Exception;
|
|
||||||
|
|
||||||
class SlotMachinePlugin implements Plugin, CallbackListener, ManialinkPageAnswerListener, TimerListener {
|
class SlotMachinePlugin implements Plugin, CallbackListener, ManialinkPageAnswerListener, TimerListener {
|
||||||
/**
|
/**
|
||||||
@ -468,7 +467,7 @@ class SlotMachinePlugin implements Plugin, CallbackListener, ManialinkPageAnswer
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
$billId = $this->maniaControl->client->pay($player->login, (int)$balance, $message);
|
$billId = $this->maniaControl->client->pay($player->login, (int)$balance, $message);
|
||||||
} catch(Exception $e) {
|
} catch(\Exception $e) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user