changed all client Exceptions from Exception to \Exception

This commit is contained in:
kremsy 2014-01-31 16:11:14 +01:00 committed by Steffen Schröder
parent 34db6ea31b
commit f825c0c111
12 changed files with 74 additions and 86 deletions

View File

@ -3,7 +3,6 @@
namespace ManiaControl\Callbacks;
use ManiaControl\ManiaControl;
use Maniaplanet\DedicatedServer\Xmlrpc\Exception;
/**
* Class for managing Server and ManiaControl Callbacks
@ -193,7 +192,7 @@ class CallbackManager {
try {
$callbacks = $this->maniaControl->client->executeCallbacks();
} catch(Exception $e) {
} catch(\Exception $e) {
trigger_error("Error reading server callbacks. " . $e->getMessage());
return;
}

View File

@ -13,7 +13,6 @@ use ManiaControl\Callbacks\CallbackListener;
use ManiaControl\Callbacks\CallbackManager;
use ManiaControl\ManiaControl;
use ManiaControl\Players\Player;
use Maniaplanet\DedicatedServer\Xmlrpc\Exception;
/**
* Class offering a Configurator for Script Settings
@ -126,7 +125,7 @@ class ScriptSettings implements ConfiguratorMenu, CallbackListener {
try {
$this->maniaControl->client->setModeScriptSettings($loadedSettings);
} catch(Exception $e) {
} catch(\Exception $e) {
trigger_error('Error occured: ' . $e->getMessage());
return false;
}
@ -379,7 +378,7 @@ class ScriptSettings implements ConfiguratorMenu, CallbackListener {
try {
$success = $this->maniaControl->client->setModeScriptSettings($newSettings);
} catch(Exception $e) {
} catch(\Exception $e) {
$this->maniaControl->chat->sendError('Error occurred: ' . $e->getMessage(), $player->login);
return false;
}

View File

@ -13,7 +13,7 @@ use ManiaControl\Callbacks\CallbackListener;
use ManiaControl\Callbacks\CallbackManager;
use ManiaControl\ManiaControl;
use ManiaControl\Players\Player;
use Maniaplanet\DedicatedServer\Xmlrpc\Exception;
/**
* Class offering a Configurator for Server Settings
@ -115,7 +115,7 @@ class ServerSettings implements ConfiguratorMenu, CallbackListener {
try {
$this->maniaControl->client->setServerOptions($serverSettings);
} catch(Exception $e) {
} catch(\Exception $e) {
trigger_error('Error occured: ' . $e->getMessage());
return false;
}
@ -332,7 +332,7 @@ class ServerSettings implements ConfiguratorMenu, CallbackListener {
try {
$this->maniaControl->client->setServerOptions($newSettings);
} catch(Exception $e) {
} catch(\Exception $e) {
trigger_error('Error occured: ' . $e->getMessage());
return false;
}

View File

@ -19,7 +19,6 @@ use ManiaControl\Server\Server;
use ManiaControl\Settings\SettingManager;
use ManiaControl\Statistics\StatisticManager;
use Maniaplanet\DedicatedServer\Connection;
use Maniaplanet\DedicatedServer\Xmlrpc\Exception;
require_once __DIR__ . '/Maniaplanet/DedicatedServer/Connection.php';
require_once __DIR__ . '/GbxDataFetcher/gbxdatafetcher.inc.php';
@ -322,14 +321,14 @@ class ManiaControl implements CommandListener {
try {
$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);
}
// Enable callback system
try {
$this->client->enableCallbacks(true);
} catch(Exception $e) {
} catch(\Exception $e) {
trigger_error("Couldn't enable callbacks! " . $e->getMessage(), E_USER_ERROR);
}
@ -357,7 +356,7 @@ class ManiaControl implements CommandListener {
try {
$scriptSettings = $this->client->getModeScriptSettings();
} catch(Exception $e) {
} catch(\Exception $e) {
trigger_error("Couldn't get mode script settings. " . $e->getMessage());
return;
}
@ -369,7 +368,7 @@ class ManiaControl implements CommandListener {
$scriptSettings['S_UseScriptCallbacks'] = true;
try {
$this->client->setModeScriptSettings($scriptSettings);
} catch(Exception $e) {
} catch(\Exception $e) {
trigger_error("Couldn't set mode script settings to enable script callbacks. " . $e->getMessage());
return;
}

View File

@ -10,7 +10,6 @@ use ManiaControl\Callbacks\CallbackListener;
use ManiaControl\Callbacks\CallbackManager;
use ManiaControl\ManiaControl;
use ManiaControl\Players\Player;
use Maniaplanet\DedicatedServer\Xmlrpc\Exception;
/**
* Manialink manager class
@ -149,7 +148,7 @@ class ManialinkManager implements ManialinkPageAnswerListener, CallbackListener
return $success;
}
} catch(Exception $e) {
} catch(\Exception $e) {
return false;
}

View File

@ -11,7 +11,6 @@ use ManiaControl\Admin\AuthenticationManager;
use ManiaControl\Formatter;
use ManiaControl\ManiaControl;
use ManiaControl\Manialinks\ManialinkManager;
use Maniaplanet\DedicatedServer\Xmlrpc\Exception;
/**
* PlayerActions Class
@ -86,7 +85,7 @@ class PlayerActions {
try {
$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);
return;
}
@ -94,7 +93,7 @@ class PlayerActions {
if($userIsAbleToSelect) {
try {
$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);
return;
}
@ -131,7 +130,7 @@ class PlayerActions {
try {
$this->maniaControl->client->forcePlayerTeam($target->login, $teamId);
} catch(Exception $e) {
} catch(\Exception $e) {
$this->maniaControl->chat->sendError('Error occurred: ' . $e->getMessage(), $admin->login);
return;
}
@ -168,7 +167,7 @@ class PlayerActions {
try {
$this->maniaControl->client->forceSpectator($target->login, $spectatorState);
} catch(Exception $e) {
} catch(\Exception $e) {
$this->maniaControl->chat->sendError('Error occurred: ' . $e->getMessage(), $admin->login);
return;
}
@ -182,7 +181,7 @@ class PlayerActions {
// Free player slot
try {
$this->maniaControl->client->spectatorReleasePlayerSlot($target->login);
} catch(Exception $e) {
} catch(\Exception $e) {
//do nothing
}
}
@ -206,7 +205,7 @@ class PlayerActions {
try {
$this->maniaControl->client->unIgnore($targetLogin);
} catch(Exception $e) {
} catch(\Exception $e) {
$this->maniaControl->chat->sendError('Error occurred: ' . $e->getMessage(), $adminLogin);
return;
}
@ -235,7 +234,7 @@ class PlayerActions {
try {
$this->maniaControl->client->ignore($targetLogin);
} catch(Exception $e) {
} catch(\Exception $e) {
$this->maniaControl->chat->sendError('Error occurred: ' . $e->getMessage(), $admin->login);
return;
}
@ -350,7 +349,7 @@ class PlayerActions {
} else {
$this->maniaControl->client->kick($target->login, $message);
}
} catch(Exception $e) {
} catch(\Exception $e) {
$this->maniaControl->chat->sendError('Error occurred: ' . $e->getMessage(), $admin->login);
return;
}
@ -387,7 +386,7 @@ class PlayerActions {
try {
$this->maniaControl->client->ban($target->login, $message);
} catch(Exception $e) {
} catch(\Exception $e) {
$this->maniaControl->chat->sendError('Error occurred: ' . $e->getMessage(), $admin->login);
return;
}

View File

@ -8,7 +8,6 @@ use ManiaControl\Admin\AuthenticationManager;
use ManiaControl\Commands\CommandListener;
use ManiaControl\ManiaControl;
use ManiaControl\Manialinks\ManialinkPageAnswerListener;
use Maniaplanet\DedicatedServer\Xmlrpc\Exception;
/**
* Class offering various Admin Commands related to Players
@ -86,7 +85,7 @@ class PlayerCommands implements CommandListener, ManialinkPageAnswerListener {
try {
$this->maniaControl->client->autoTeamBalance();
} catch(Exception $e) {
} catch(\Exception $e) {
$this->maniaControl->chat->sendError('Error occurred: ' . $e->getMessage(), $player->login);
return;
}
@ -252,7 +251,7 @@ class PlayerCommands implements CommandListener, ManialinkPageAnswerListener {
for($i = 0; $i < $amount; $i++) {
$this->maniaControl->client->connectFakePlayer();
}
} catch(Exception $e) {
} catch(\Exception $e) {
$this->maniaControl->chat->sendError('Error occurred: ' . $e->getMessage(), $player->login);
return;
}
@ -274,7 +273,7 @@ class PlayerCommands implements CommandListener, ManialinkPageAnswerListener {
try {
$this->maniaControl->client->disconnectFakePlayer('*');
} catch(Exception $e) {
} catch(\Exception $e) {
$this->maniaControl->chat->sendError('Error occurred: ' . $e->getMessage(), $player->login);
return;
}

View File

@ -7,7 +7,6 @@ use ManiaControl\Callbacks\CallbackManager;
use ManiaControl\ManiaControl;
use ManiaControl\Players\Player;
use Maniaplanet\DedicatedServer\Structures\SystemInfos;
use Maniaplanet\DedicatedServer\Xmlrpc\Exception;
/**
* Class providing Information about theconnected ManiaPlanet Server
@ -76,13 +75,13 @@ class Server implements CallbackListener {
) ON DUPLICATE KEY UPDATE
`index` = LAST_INSERT_ID(`index`);";
$statement = $mysqli->prepare($query);
if($mysqli->error) {
if ($mysqli->error) {
trigger_error($mysqli->error);
return;
}
$statement->bind_param('s', $this->login);
$statement->execute();
if($statement->error) {
if ($statement->error) {
trigger_error($statement->error);
$statement->close();
return;
@ -105,12 +104,12 @@ class Server implements CallbackListener {
UNIQUE KEY `login` (`login`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Servers' AUTO_INCREMENT=1;";
$statement = $mysqli->prepare($query);
if($mysqli->error) {
if ($mysqli->error) {
trigger_error($mysqli->error, E_USER_ERROR);
return false;
}
$statement->execute();
if($statement->error) {
if ($statement->error) {
trigger_error($statement->error, E_USER_ERROR);
return false;
}
@ -133,10 +132,10 @@ class Server implements CallbackListener {
* @return string
*/
public function getDataDirectory() {
if($this->dataDirectory == '') {
if ($this->dataDirectory == '') {
try {
$this->dataDirectory = $this->maniaControl->client->gameDataDirectory();
} catch(Exception $e) {
} catch(\Exception $e) {
trigger_error("Couldn't get data directory. " . $e->getMessage());
return null;
}
@ -151,7 +150,7 @@ class Server implements CallbackListener {
*/
public function getMapsDirectory() {
$dataDirectory = $this->getDataDirectory();
if(!$dataDirectory) {
if (!$dataDirectory) {
return null;
}
return "{$dataDirectory}Maps/";
@ -164,7 +163,7 @@ class Server implements CallbackListener {
* @return bool
*/
public function checkAccess($directory) {
if(!$directory) {
if (!$directory) {
return false;
}
return (is_dir($directory) && is_writable($directory));
@ -177,11 +176,11 @@ class Server implements CallbackListener {
* @return array
*/
public function getInfo($detailed = false) {
if($detailed) {
if ($detailed) {
$login = $this->login;
try {
$info = $this->maniaControl->client->getDetailedPlayerInfo($login);
} catch(Exception $e) {
} catch(\Exception $e) {
trigger_error("Couldn't fetch detailed server info. " . $e->getMessage());
return null;
}
@ -189,7 +188,7 @@ class Server implements CallbackListener {
}
try {
$info = $this->maniaControl->client->getMainServerPlayerInfo();
} catch(Exception $e) {
} catch(\Exception $e) {
trigger_error("Couldn't fetch server info. " . $e->getMessage());
return null;
}
@ -204,7 +203,7 @@ class Server implements CallbackListener {
public function getOptions() {
try {
$options = $this->maniaControl->client->getServerOptions();
} catch(Exception $e) {
} catch(\Exception $e) {
trigger_error("Couldn't fetch server options. " . $e->getMessage());
return null;
}
@ -220,7 +219,7 @@ class Server implements CallbackListener {
public function getName() {
try {
$name = $this->maniaControl->client->getServerName();
} catch(Exception $e) {
} catch(\Exception $e) {
trigger_error("Couldn't fetch server name. " . $e->getMessage());
return null;
}
@ -236,7 +235,7 @@ class Server implements CallbackListener {
public function getVersion() {
try {
$version = $this->maniaControl->client->getVersion();
} catch(Exception $e) {
} catch(\Exception $e) {
trigger_error("Couldn't fetch server version. " . $e->getMessage());
return null;
}
@ -251,7 +250,7 @@ class Server implements CallbackListener {
public function getSystemInfo() {
try {
$systemInfo = $this->maniaControl->client->getSystemInfo();
} catch(Exception $e) {
} catch(\Exception $e) {
trigger_error("Couldn't fetch server system info. " . $e->getMessage());
return null;
}
@ -267,17 +266,17 @@ class Server implements CallbackListener {
* @return int | string
*/
public function getGameMode($stringValue = false, $parseValue = null) {
if(is_int($parseValue)) {
if (is_int($parseValue)) {
$gameMode = $parseValue;
} else {
try {
$gameMode = $this->maniaControl->client->getGameMode();
} catch(Exception $e) {
} catch(\Exception $e) {
trigger_error("Couldn't fetch current game mode. " . $e->getMessage());
return null;
}
}
if($stringValue) {
if ($stringValue) {
switch($gameMode) {
case 0:
return 'Script';
@ -309,7 +308,7 @@ class Server implements CallbackListener {
public function getValidationReplay(Player $player) {
try {
$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());
return null;
}
@ -324,7 +323,7 @@ class Server implements CallbackListener {
*/
public function getGhostReplay(Player $player) {
$dataDir = $this->getDataDirectory();
if(!$this->checkAccess($dataDir)) {
if (!$this->checkAccess($dataDir)) {
return null;
}
@ -337,14 +336,14 @@ class Server implements CallbackListener {
// Save ghost replay
try {
$this->maniaControl->client->saveBestGhostsReplay($player->login, $fileName);
} catch(Exception $e) {
} catch(\Exception $e) {
trigger_error("Couldn't save ghost replay. " . $e->getMessage());
return null;
}
// Load replay file
$ghostReplay = file_get_contents("{$dataDir}Replays/{$fileName}");
if(!$ghostReplay) {
if (!$ghostReplay) {
trigger_error("Couldn't retrieve saved ghost replay.");
return null;
}
@ -360,7 +359,7 @@ class Server implements CallbackListener {
public function waitForStatus($statusCode = 4) {
$response = $this->maniaControl->client->getStatus();
// Check if server has the given status
if($response->code === 4) {
if ($response->code === 4) {
return true;
}
// Server not yet in given status - Wait for it...
@ -372,11 +371,11 @@ class Server implements CallbackListener {
while($response->code !== 4) {
sleep(1);
$response = $this->maniaControl->client->getStatus();
if($lastStatus !== $response['Name']) {
if ($lastStatus !== $response['Name']) {
$this->maniaControl->log("New Status: {$response['Name']}");
$lastStatus = $response['Name'];
}
if(time() - $maxWaitTime > $waitBegin) {
if (time() - $maxWaitTime > $waitBegin) {
// It took too long to reach the status
trigger_error("Server couldn't reach status {$statusCode} after {$maxWaitTime} seconds! ");
return false;

View File

@ -12,7 +12,6 @@ use ManiaControl\Commands\CommandListener;
use ManiaControl\ManiaControl;
use ManiaControl\Manialinks\ManialinkPageAnswerListener;
use ManiaControl\Players\Player;
use Maniaplanet\DedicatedServer\Xmlrpc\Exception;
/**
* Class offering various commands related to the dedicated server
@ -220,7 +219,7 @@ class ServerCommands implements CallbackListener, CommandListener, ManialinkPage
$serverName = $params[1];
try {
$this->maniaControl->client->setServerName($serverName);
} catch(Exception $e) {
} catch(\Exception $e) {
$this->maniaControl->chat->sendError('Error occurred: ' . $e->getMessage(), $player->login);
return;
}
@ -247,7 +246,7 @@ class ServerCommands implements CallbackListener, CommandListener, ManialinkPage
}
try {
$this->maniaControl->client->setServerPassword($password);
} catch(Exception $e) {
} catch(\Exception $e) {
$this->maniaControl->chat->sendError('Error occurred: ' . $e->getMessage(), $player->login);
return;
}
@ -274,7 +273,7 @@ class ServerCommands implements CallbackListener, CommandListener, ManialinkPage
}
try {
$this->maniaControl->client->setServerPasswordForSpectator($password);
} catch(Exception $e) {
} catch(\Exception $e) {
$this->maniaControl->chat->sendError('Error occurred: ' . $e->getMessage(), $player->login);
return;
}
@ -309,7 +308,7 @@ class ServerCommands implements CallbackListener, CommandListener, ManialinkPage
try {
$this->maniaControl->client->setMaxPlayers($amount);
} catch(Exception $e) {
} catch(\Exception $e) {
$this->maniaControl->chat->sendError('Error occurred: ' . $e->getMessage(), $player->login);
return;
}
@ -345,7 +344,7 @@ class ServerCommands implements CallbackListener, CommandListener, ManialinkPage
try {
$this->maniaControl->client->setMaxSpectators($amount);
} catch(Exception $e) {
} catch(\Exception $e) {
$this->maniaControl->chat->sendError('Error occurred: ' . $e->getMessage(), $player->login);
return;
}
@ -361,7 +360,7 @@ class ServerCommands implements CallbackListener, CommandListener, ManialinkPage
private function shutdownServer($login = '#') {
try {
$this->maniaControl->client->stopServer();
} catch(Exception $e) {
} catch(\Exception $e) {
trigger_error("Server shutdown command from '{login}' failed. " . $e->getMessage());
return false;
}

View File

@ -4,7 +4,6 @@ use ManiaControl\Commands\CommandListener;
use ManiaControl\ManiaControl;
use ManiaControl\Players\Player;
use ManiaControl\Plugins\Plugin;
use Maniaplanet\DedicatedServer\Xmlrpc\Exception;
/**
* ManiaControl Chat-Message Plugin
@ -25,7 +24,6 @@ class ChatMessagePlugin implements CommandListener, Plugin {
* Private properties
*/
/**
*
* @var maniaControl $maniaControl
*/
private $maniaControl = null;
@ -104,7 +102,7 @@ class ChatMessagePlugin implements CommandListener, Plugin {
public function chat_hi(array $chat, Player $player) {
$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!';
} else {
$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) {
$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!';
} else {
$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) {
$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!';
} else {
$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) {
$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!';
} else {
$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) {
$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!';
} else {
$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) {
$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!';
} else {
$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) {
$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!';
} else {
$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) {
$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!';
} else {
$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) {
$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!';
} else {
$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';
try {
$this->maniaControl->client->kick($player->login, $message);
} catch(Exception $e) {
} catch(\Exception $e) {
$this->maniaControl->chat->sendError('Error occurred: ' . $e->getMessage(), $player->login);
return;
}
@ -332,7 +330,7 @@ class ChatMessagePlugin implements CommandListener, Plugin {
$message = '$39F Thanks for Playing, please come back soon!$z';
try {
$this->maniaControl->client->kick($player->login, $message);
} catch(Exception $e) {
} catch(\Exception $e) {
$this->maniaControl->chat->sendError('Error occurred: ' . $e->getMessage(), $player->login);
return;
}
@ -348,11 +346,11 @@ class ChatMessagePlugin implements CommandListener, Plugin {
$msg = '$g[$<' . $player->nickname . '$>$s] $ff0$iAway From Keyboard!';
$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
try {
$this->maniaControl->client->forceSpectator($player->login, 3);
} catch(Exception $e) {
} catch(\Exception $e) {
$this->maniaControl->chat->sendError('Error occurred: ' . $e->getMessage(), $player->login);
return;
}
@ -360,7 +358,7 @@ class ChatMessagePlugin implements CommandListener, Plugin {
// free player slot
try {
$this->maniaControl->client->spectatorReleasePlayerSlot($player->login);
} catch(Exception $e) {
} catch(\Exception $e) {
//to nothing
}
}
@ -377,13 +375,13 @@ class ChatMessagePlugin implements CommandListener, Plugin {
$pid = 1;
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;
}
$pid++;
}
if($login == 'lj') {
if ($login == 'lj') {
return $player->nickname;
}

View File

@ -16,7 +16,6 @@ use ManiaControl\ManiaControl;
use ManiaControl\Players\Player;
use ManiaControl\Players\PlayerManager;
use ManiaControl\Plugins\Plugin;
use Maniaplanet\DedicatedServer\Xmlrpc\Exception;
/**
* Donation plugin
@ -336,7 +335,7 @@ class DonationPlugin implements CallbackListener, CommandListener, Plugin {
$message = 'Donate ' . $amount . ' Planets to $<' . $receiverName . '$>?';
try {
$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());
$this->maniaControl->chat->sendError("Creating donation failed.", $player->login);
return false;
@ -379,7 +378,7 @@ class DonationPlugin implements CallbackListener, CommandListener, Plugin {
try {
$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 create payout of {$amount} planets by '{$player->login}' for '{$receiver}'. " . $e->getMessage());
$this->maniaControl->chat->sendError("Creating payout failed.", $player->login);
@ -404,7 +403,7 @@ class DonationPlugin implements CallbackListener, CommandListener, Plugin {
}
try {
$planets = $this->maniaControl->client->getServerPlanets();
} catch(Exception $e) {
} catch(\Exception $e) {
trigger_error("Couldn't retrieve server planets. " . $e->getMessage());
return false;
}

View File

@ -15,7 +15,6 @@ use ManiaControl\Manialinks\ManialinkPageAnswerListener;
use ManiaControl\Players\Player;
use ManiaControl\Players\PlayerManager;
use ManiaControl\Plugins\Plugin;
use Maniaplanet\DedicatedServer\Xmlrpc\Exception;
class SlotMachinePlugin implements Plugin, CallbackListener, ManialinkPageAnswerListener, TimerListener {
/**
@ -468,7 +467,7 @@ class SlotMachinePlugin implements Plugin, CallbackListener, ManialinkPageAnswer
try {
$billId = $this->maniaControl->client->pay($player->login, (int)$balance, $message);
} catch(Exception $e) {
} catch(\Exception $e) {
return;
}