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

@ -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;
}