updated dedicated-server-api exception usages

This commit is contained in:
Steffen Schröder 2014-05-13 17:59:37 +02:00
parent d16e89d13d
commit 16d2571485
22 changed files with 106 additions and 111 deletions

View File

@ -4,7 +4,7 @@ namespace ManiaControl;
use ManiaControl\Admin\AuthenticationManager; use ManiaControl\Admin\AuthenticationManager;
use ManiaControl\Players\Player; use ManiaControl\Players\Player;
use Maniaplanet\DedicatedServer\Xmlrpc\LoginUnknownException; use Maniaplanet\DedicatedServer\Xmlrpc\UnknownPlayerException;
/** /**
* Chat Utility Class * Chat Utility Class
@ -57,35 +57,6 @@ class Chat {
return $this->sendChat($format . $message, $login, $prefix); return $this->sendChat($format . $message, $login, $prefix);
} }
/**
* Sends a Message to all Connected Admins
*
* @param $message
* @param int $minLevel (Constant from AuthenticationManager)
* @param bool $prefix
*/
public function sendMessageToAdmins($message, $minLevel = AuthenticationManager::AUTH_LEVEL_MODERATOR, $prefix = true) {
//TODO specifiy in player or adminmanager a getAdmins() with minlevel function
foreach($this->maniaControl->playerManager->getPlayers() as $player){
/** @var Player $player */
if($this->maniaControl->authenticationManager->checkRight($player, $minLevel)){
$this->sendChat($message, $player->login, $prefix);
}
}
}
/**
* Sends a Error Message to all Connected Admins
*
* @param $message
* @param int $minLevel (Constant from AuthenticationManager)
* @param bool $prefix
*/
public function sendErrorToAdmins($message, $minLevel = AuthenticationManager::AUTH_LEVEL_MODERATOR, $prefix = true) {
$format = $this->maniaControl->settingManager->getSettingValue($this, self::SETTING_FORMAT_ERROR);
$this->sendMessageToAdmins($format . $message, $prefix);
}
/** /**
* Send a chat message to the given login * Send a chat message to the given login
* *
@ -105,12 +76,10 @@ class Chat {
$this->maniaControl->client->chatSend($chatMessage, null, true); $this->maniaControl->client->chatSend($chatMessage, null, true);
} else { } else {
$chatMessage = '$<$z$ff0' . $this->getPrefix($prefix) . $message . '$>'; $chatMessage = '$<$z$ff0' . $this->getPrefix($prefix) . $message . '$>';
if (is_object($login) && property_exists($login, 'login')) { $login = Player::parseLogin($login);
$login = $login->login;
}
try { try {
$this->maniaControl->client->chatSend($chatMessage, $login, true); $this->maniaControl->client->chatSend($chatMessage, $login, true);
} catch (LoginUnknownException $e) { } catch (UnknownPlayerException $e) {
} }
} }
return true; return true;
@ -132,6 +101,35 @@ class Chat {
return ''; return '';
} }
/**
* Sends a Error Message to all Connected Admins
*
* @param $message
* @param int $minLevel (Constant from AuthenticationManager)
* @param bool $prefix
*/
public function sendErrorToAdmins($message, $minLevel = AuthenticationManager::AUTH_LEVEL_MODERATOR, $prefix = true) {
$format = $this->maniaControl->settingManager->getSettingValue($this, self::SETTING_FORMAT_ERROR);
$this->sendMessageToAdmins($format . $message, $prefix);
}
/**
* Sends a Message to all Connected Admins
*
* @param $message
* @param int $minLevel (Constant from AuthenticationManager)
* @param bool $prefix
*/
public function sendMessageToAdmins($message, $minLevel = AuthenticationManager::AUTH_LEVEL_MODERATOR, $prefix = true) {
//TODO specifiy in player or adminmanager a getAdmins() with minlevel function
foreach ($this->maniaControl->playerManager->getPlayers() as $player) {
/** @var Player $player */
if ($this->maniaControl->authenticationManager->checkRight($player, $minLevel)) {
$this->sendChat($message, $player->login, $prefix);
}
}
}
/** /**
* Send a success message to the given login * Send a success message to the given login
* *

View File

@ -1,6 +1,6 @@
<?php <?php
namespace ManiaControl\Utils; namespace ManiaControl;
/** /**
* Command Line Helper Class * Command Line Helper Class

View File

@ -18,7 +18,7 @@ use ManiaControl\ManiaControl;
use ManiaControl\Maps\Map; use ManiaControl\Maps\Map;
use ManiaControl\Players\Player; use ManiaControl\Players\Player;
use Maniaplanet\DedicatedServer\Xmlrpc\Exception; use Maniaplanet\DedicatedServer\Xmlrpc\Exception;
use Maniaplanet\DedicatedServer\Xmlrpc\NotInScriptModeException; use Maniaplanet\DedicatedServer\Xmlrpc\GameModeException;
/** /**
* Class offering a Configurator for Script Settings * Class offering a Configurator for Script Settings
@ -108,7 +108,7 @@ class ScriptSettings implements ConfiguratorMenu, CallbackListener {
public function loadSettingsFromDatabase() { public function loadSettingsFromDatabase() {
try { try {
$scriptSettings = $this->maniaControl->client->getModeScriptSettings(); $scriptSettings = $this->maniaControl->client->getModeScriptSettings();
} catch (NotInScriptModeException $e) { } catch (GameModeException $e) {
return false; return false;
} }
@ -164,7 +164,7 @@ class ScriptSettings implements ConfiguratorMenu, CallbackListener {
try { try {
$scriptInfo = $this->maniaControl->client->getModeScriptInfo(); $scriptInfo = $this->maniaControl->client->getModeScriptInfo();
} catch (NotInScriptModeException $e) { } catch (GameModeException $e) {
$label = new Label(); $label = new Label();
$frame->add($label); $frame->add($label);
$label->setText($e->getMessage()); $label->setText($e->getMessage());
@ -175,8 +175,7 @@ class ScriptSettings implements ConfiguratorMenu, CallbackListener {
try { try {
$scriptSettings = $this->maniaControl->client->getModeScriptSettings(); $scriptSettings = $this->maniaControl->client->getModeScriptSettings();
} catch (NotInScriptModeException $e) { } catch (GameModeException $e) {
//do nothing
} }
// Config // Config
@ -328,7 +327,7 @@ class ScriptSettings implements ConfiguratorMenu, CallbackListener {
public function toggleBooleanSetting($setting, Player $player) { public function toggleBooleanSetting($setting, Player $player) {
try { try {
$scriptSettings = $this->maniaControl->client->getModeScriptSettings(); $scriptSettings = $this->maniaControl->client->getModeScriptSettings();
} catch (NotInScriptModeException $e) { } catch (GameModeException $e) {
return; return;
} }
@ -442,7 +441,7 @@ class ScriptSettings implements ConfiguratorMenu, CallbackListener {
try { try {
$scriptSettings = $this->maniaControl->client->getModeScriptSettings(); $scriptSettings = $this->maniaControl->client->getModeScriptSettings();
} catch (NotInScriptModeException $e) { } catch (GameModeException $e) {
return; return;
} }

View File

@ -1,6 +1,6 @@
<?php <?php
namespace ManiaControl\Utils; namespace ManiaControl;
/** /**
* Class offering Methods to format Texts and Values * Class offering Methods to format Texts and Values

View File

@ -5,7 +5,7 @@ namespace ManiaControl\ManiaExchange;
use ManiaControl\ManiaControl; use ManiaControl\ManiaControl;
use ManiaControl\Maps\Map; use ManiaControl\Maps\Map;
use ManiaControl\Maps\MapManager; use ManiaControl\Maps\MapManager;
use Maniaplanet\DedicatedServer\Xmlrpc\NotInScriptModeException; use Maniaplanet\DedicatedServer\Xmlrpc\GameModeException;
/** /**
* Mania Exchange Info Searcher Class * Mania Exchange Info Searcher Class
@ -306,7 +306,7 @@ class ManiaExchangeManager {
$scriptInfos = $this->maniaControl->client->getModeScriptInfo(); $scriptInfos = $this->maniaControl->client->getModeScriptInfo();
$mapTypes = $scriptInfos->compatibleMapTypes; $mapTypes = $scriptInfos->compatibleMapTypes;
$url .= '&mtype=' . $mapTypes; $url .= '&mtype=' . $mapTypes;
} catch (NotInScriptModeException $e) { } catch (GameModeException $e) {
} }
$success = $this->maniaControl->fileReader->loadFile($url, function ($mapInfo, $error) use (&$function, $titlePrefix) { $success = $this->maniaControl->fileReader->loadFile($url, function ($mapInfo, $error) use (&$function, $titlePrefix) {

View File

@ -10,8 +10,8 @@ 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\LoginUnknownException; use Maniaplanet\DedicatedServer\Xmlrpc\GameModeException;
use Maniaplanet\DedicatedServer\Xmlrpc\NotInScriptModeException; use Maniaplanet\DedicatedServer\Xmlrpc\UnknownPlayerException;
/** /**
* Manialink Manager Class * Manialink Manager Class
@ -215,7 +215,7 @@ class ManialinkManager implements ManialinkPageAnswerListener, CallbackListener
return $success; return $success;
} }
} catch (LoginUnknownException $e) { } catch (UnknownPlayerException $e) {
return false; return false;
} }
@ -250,7 +250,7 @@ class ManialinkManager implements ManialinkPageAnswerListener, CallbackListener
public function disableAltMenu(Player $player) { public function disableAltMenu(Player $player) {
try { try {
$success = $this->maniaControl->client->triggerModeScriptEvent('LibXmlRpc_DisableAltMenu', $player->login); $success = $this->maniaControl->client->triggerModeScriptEvent('LibXmlRpc_DisableAltMenu', $player->login);
} catch (NotInScriptModeException $e) { } catch (GameModeException $e) {
return false; return false;
} }
return $success; return $success;
@ -295,7 +295,7 @@ class ManialinkManager implements ManialinkPageAnswerListener, CallbackListener
public function enableAltMenu(Player $player) { public function enableAltMenu(Player $player) {
try { try {
$success = $this->maniaControl->client->triggerModeScriptEvent('LibXmlRpc_EnableAltMenu', $player->login); $success = $this->maniaControl->client->triggerModeScriptEvent('LibXmlRpc_EnableAltMenu', $player->login);
} catch (NotInScriptModeException $e) { } catch (GameModeException $e) {
return false; return false;
} }
return $success; return $success;

View File

@ -118,7 +118,7 @@ class StyleManager {
} }
/** /**
* Get the default list widget width * Get the Default List Widgets Width
* *
* @return string * @return string
*/ */

View File

@ -17,14 +17,14 @@ use FML\Script\Features\Paging;
use ManiaControl\Callbacks\CallbackListener; use ManiaControl\Callbacks\CallbackListener;
use ManiaControl\Callbacks\CallbackManager; use ManiaControl\Callbacks\CallbackManager;
use ManiaControl\Callbacks\Callbacks; use ManiaControl\Callbacks\Callbacks;
use ManiaControl\Utils\ColorUtil;
use ManiaControl\Utils\Formatter;
use ManiaControl\ManiaControl; use ManiaControl\ManiaControl;
use ManiaControl\Manialinks\IconManager; use ManiaControl\Manialinks\IconManager;
use ManiaControl\Manialinks\ManialinkManager; use ManiaControl\Manialinks\ManialinkManager;
use ManiaControl\Manialinks\ManialinkPageAnswerListener; use ManiaControl\Manialinks\ManialinkPageAnswerListener;
use ManiaControl\Players\Player; use ManiaControl\Players\Player;
use Maniaplanet\DedicatedServer\Xmlrpc\MapNotFoundException; use ManiaControl\Utils\ColorUtil;
use ManiaControl\Utils\Formatter;
use Maniaplanet\DedicatedServer\Xmlrpc\NotInListException;
use MCTeam\CustomVotesPlugin; use MCTeam\CustomVotesPlugin;
use MCTeam\KarmaPlugin; use MCTeam\KarmaPlugin;
@ -613,7 +613,7 @@ class MapList implements ManialinkPageAnswerListener, CallbackListener {
$this->maniaControl->mapManager->mapQueue->dontQueueNextMapChange(); $this->maniaControl->mapManager->mapQueue->dontQueueNextMapChange();
try { try {
$this->maniaControl->client->jumpToMapIdent($mapUid); $this->maniaControl->client->jumpToMapIdent($mapUid);
} catch (MapNotFoundException $e) { } catch (NotInListException $e) {
$this->maniaControl->chat->sendError("Error on Jumping to Map Ident!"); $this->maniaControl->chat->sendError("Error on Jumping to Map Ident!");
break; break;
} }
@ -645,7 +645,7 @@ class MapList implements ManialinkPageAnswerListener, CallbackListener {
try { try {
$self->maniaControl->client->JumpToMapIdent($map->uid); $self->maniaControl->client->JumpToMapIdent($map->uid);
} catch (MapNotFoundException $e) { } catch (NotInListException $e) {
} }
}); });
break; break;

View File

@ -13,11 +13,11 @@ use ManiaControl\ManiaExchange\ManiaExchangeManager;
use ManiaControl\ManiaExchange\MXMapInfo; use ManiaControl\ManiaExchange\MXMapInfo;
use ManiaControl\Players\Player; use ManiaControl\Players\Player;
use Maniaplanet\DedicatedServer\InvalidArgumentException; use Maniaplanet\DedicatedServer\InvalidArgumentException;
use Maniaplanet\DedicatedServer\Xmlrpc\CouldNotWritePlaylistFileException;
use Maniaplanet\DedicatedServer\Xmlrpc\Exception; use Maniaplanet\DedicatedServer\Xmlrpc\Exception;
use Maniaplanet\DedicatedServer\Xmlrpc\MapNotCompatibleOrCompleteException; use Maniaplanet\DedicatedServer\Xmlrpc\FileException;
use Maniaplanet\DedicatedServer\Xmlrpc\MapNotInCurrentSelectionException; use Maniaplanet\DedicatedServer\Xmlrpc\IndexOutOfBoundException;
use Maniaplanet\DedicatedServer\Xmlrpc\StartIndexOutOfBoundException; use Maniaplanet\DedicatedServer\Xmlrpc\InvalidMapException;
use Maniaplanet\DedicatedServer\Xmlrpc\NotInListException;
// TODO: adding of local maps // TODO: adding of local maps
@ -209,7 +209,7 @@ class MapManager implements CallbackListener {
// Remove map // Remove map
try { try {
$this->maniaControl->client->removeMap($map->fileName); $this->maniaControl->client->removeMap($map->fileName);
} catch (MapNotInCurrentSelectionException $e) { } catch (NotInListException $e) {
} }
unset($this->maps[$uid]); unset($this->maps[$uid]);
@ -322,7 +322,7 @@ class MapManager implements CallbackListener {
// Check for valid map // Check for valid map
try { try {
$this->maniaControl->client->checkMapForCurrentServerParams($relativeMapFileName); $this->maniaControl->client->checkMapForCurrentServerParams($relativeMapFileName);
} catch (MapNotCompatibleOrCompleteException $e) { } catch (InvalidMapException $e) {
trigger_error("Couldn't check if map is valid ('{$relativeMapFileName}'). " . $e->getMessage()); trigger_error("Couldn't check if map is valid ('{$relativeMapFileName}'). " . $e->getMessage());
$this->maniaControl->chat->sendError('Wrong MapType or not validated!', $login); $this->maniaControl->chat->sendError('Wrong MapType or not validated!', $login);
return; return;
@ -394,7 +394,7 @@ class MapManager implements CallbackListener {
$i += 150; $i += 150;
} }
} catch (StartIndexOutOfBoundException $e) { } catch (IndexOutOfBoundException $e) {
} }
// restore Sorted MapList // restore Sorted MapList
@ -408,7 +408,7 @@ class MapManager implements CallbackListener {
$matchSettingsFileName = $this->maniaControl->settingManager->getSettingValue($this, self::SETTING_MAPLIST_FILE); $matchSettingsFileName = $this->maniaControl->settingManager->getSettingValue($this, self::SETTING_MAPLIST_FILE);
try { try {
$this->maniaControl->client->saveMatchSettings($matchSettingsFileName); $this->maniaControl->client->saveMatchSettings($matchSettingsFileName);
} catch (CouldNotWritePlaylistFileException $e) { } catch (FileException $e) {
$this->maniaControl->log("Unable to write the playlist file, please checkout your MX-Folders File permissions!"); $this->maniaControl->log("Unable to write the playlist file, please checkout your MX-Folders File permissions!");
} }
} }

View File

@ -8,16 +8,16 @@ use FML\Controls\Quad;
use FML\Controls\Quads\Quad_Icons64x64_1; use FML\Controls\Quads\Quad_Icons64x64_1;
use FML\ManiaLink; use FML\ManiaLink;
use ManiaControl\Admin\AuthenticationManager; use ManiaControl\Admin\AuthenticationManager;
use ManiaControl\Utils\Formatter;
use ManiaControl\ManiaControl; use ManiaControl\ManiaControl;
use ManiaControl\Manialinks\ManialinkManager; use ManiaControl\Manialinks\ManialinkManager;
use ManiaControl\Utils\Formatter;
use Maniaplanet\DedicatedServer\Xmlrpc\AlreadyInListException;
use Maniaplanet\DedicatedServer\Xmlrpc\Exception; use Maniaplanet\DedicatedServer\Xmlrpc\Exception;
use Maniaplanet\DedicatedServer\Xmlrpc\FaultException; use Maniaplanet\DedicatedServer\Xmlrpc\FaultException;
use Maniaplanet\DedicatedServer\Xmlrpc\LoginUnknownException; use Maniaplanet\DedicatedServer\Xmlrpc\GameModeException;
use Maniaplanet\DedicatedServer\Xmlrpc\NotInTeamModeException; use Maniaplanet\DedicatedServer\Xmlrpc\NotInListException;
use Maniaplanet\DedicatedServer\Xmlrpc\PlayerAlreadyIgnoredException; use Maniaplanet\DedicatedServer\Xmlrpc\PlayerStateException;
use Maniaplanet\DedicatedServer\Xmlrpc\PlayerIsNotSpectatorException; use Maniaplanet\DedicatedServer\Xmlrpc\UnknownPlayerException;
use Maniaplanet\DedicatedServer\Xmlrpc\PlayerNotIgnoredException;
/** /**
* Player Actions Class * Player Actions Class
@ -95,7 +95,7 @@ class PlayerActions {
try { try {
$this->maniaControl->client->forcePlayerTeam($target->login, $teamId); $this->maniaControl->client->forcePlayerTeam($target->login, $teamId);
} catch (NotInTeamModeException $e) { } catch (GameModeException $e) {
$this->forcePlayerToPlay($adminLogin, $targetLogin); $this->forcePlayerToPlay($adminLogin, $targetLogin);
return; return;
} }
@ -194,7 +194,7 @@ class PlayerActions {
// Free player slot // Free player slot
try { try {
$this->maniaControl->client->spectatorReleasePlayerSlot($target->login); $this->maniaControl->client->spectatorReleasePlayerSlot($target->login);
} catch (PlayerIsNotSpectatorException $e) { } catch (PlayerStateException $e) {
} }
} }
} }
@ -220,7 +220,7 @@ class PlayerActions {
try { try {
$this->maniaControl->client->unIgnore($targetLogin); $this->maniaControl->client->unIgnore($targetLogin);
} catch (PlayerNotIgnoredException $e) { } catch (NotInListException $e) {
$this->maniaControl->chat->sendError("Player is not ignored!"); $this->maniaControl->chat->sendError("Player is not ignored!");
return; return;
} }
@ -252,7 +252,7 @@ class PlayerActions {
try { try {
$this->maniaControl->client->ignore($targetLogin); $this->maniaControl->client->ignore($targetLogin);
} catch (PlayerAlreadyIgnoredException $e) { } catch (AlreadyInListException $e) {
$this->maniaControl->chat->sendError("Player already ignored!"); $this->maniaControl->chat->sendError("Player already ignored!");
return; return;
} }
@ -369,7 +369,7 @@ class PlayerActions {
} else { } else {
$this->maniaControl->client->kick($target->login, $message); $this->maniaControl->client->kick($target->login, $message);
} }
} catch (LoginUnknownException $e) { } catch (UnknownPlayerException $e) {
$this->maniaControl->chat->sendException($e, $admin->login); $this->maniaControl->chat->sendException($e, $admin->login);
return; return;
} }

View File

@ -10,10 +10,10 @@ use FML\Controls\Quad;
use FML\Controls\Quads\Quad_BgsPlayerCard; use FML\Controls\Quads\Quad_BgsPlayerCard;
use FML\ManiaLink; use FML\ManiaLink;
use FML\Script\Script; use FML\Script\Script;
use ManiaControl\Utils\Formatter;
use ManiaControl\ManiaControl; use ManiaControl\ManiaControl;
use ManiaControl\Manialinks\ManialinkManager; use ManiaControl\Manialinks\ManialinkManager;
use ManiaControl\Statistics\StatisticManager; use ManiaControl\Statistics\StatisticManager;
use ManiaControl\Utils\Formatter;
/** /**
* Player Detailed Page * Player Detailed Page
@ -34,7 +34,7 @@ class PlayerDetailed {
private $maniaControl = null; private $maniaControl = null;
/** /**
* Create a new Player Detailed instance * Create a new Player Detailed Instance
* *
* @param ManiaControl $maniaControl * @param ManiaControl $maniaControl
*/ */

View File

@ -18,12 +18,12 @@ use ManiaControl\Admin\AuthenticationManager;
use ManiaControl\Callbacks\CallbackListener; use ManiaControl\Callbacks\CallbackListener;
use ManiaControl\Callbacks\CallbackManager; use ManiaControl\Callbacks\CallbackManager;
use ManiaControl\Callbacks\TimerListener; use ManiaControl\Callbacks\TimerListener;
use ManiaControl\Utils\Formatter;
use ManiaControl\ManiaControl; use ManiaControl\ManiaControl;
use ManiaControl\Manialinks\ManialinkManager; use ManiaControl\Manialinks\ManialinkManager;
use ManiaControl\Manialinks\ManialinkPageAnswerListener; use ManiaControl\Manialinks\ManialinkPageAnswerListener;
use Maniaplanet\DedicatedServer\Xmlrpc\LoginUnknownException; use ManiaControl\Utils\Formatter;
use Maniaplanet\DedicatedServer\Xmlrpc\PlayerIsNotSpectatorException; use Maniaplanet\DedicatedServer\Xmlrpc\PlayerStateException;
use Maniaplanet\DedicatedServer\Xmlrpc\UnknownPlayerException;
use MCTeam\CustomVotesPlugin; use MCTeam\CustomVotesPlugin;
/** /**
@ -641,7 +641,7 @@ class PlayerList implements ManialinkPageAnswerListener, CallbackListener, Timer
try { try {
$this->maniaControl->client->forceSpectator($adminLogin, PlayerActions::SPECTATOR_BUT_KEEP_SELECTABLE); $this->maniaControl->client->forceSpectator($adminLogin, PlayerActions::SPECTATOR_BUT_KEEP_SELECTABLE);
$this->maniaControl->client->forceSpectatorTarget($adminLogin, $targetLogin, 1); $this->maniaControl->client->forceSpectatorTarget($adminLogin, $targetLogin, 1);
} catch (PlayerIsNotSpectatorException $e) { } catch (PlayerStateException $e) {
} }
break; break;
case self::ACTION_OPEN_PLAYER_DETAILED: case self::ACTION_OPEN_PLAYER_DETAILED:
@ -713,7 +713,7 @@ class PlayerList implements ManialinkPageAnswerListener, CallbackListener, Timer
try { try {
$self->maniaControl->client->forceSpectator($target->login, PlayerActions::SPECTATOR_BUT_KEEP_SELECTABLE); $self->maniaControl->client->forceSpectator($target->login, PlayerActions::SPECTATOR_BUT_KEEP_SELECTABLE);
$self->maniaControl->client->spectatorReleasePlayerSlot($target->login); $self->maniaControl->client->spectatorReleasePlayerSlot($target->login);
} catch (PlayerIsNotSpectatorException $e) { } catch (PlayerStateException $e) {
} }
}); });
break; break;
@ -737,7 +737,7 @@ class PlayerList implements ManialinkPageAnswerListener, CallbackListener, Timer
$message = '$39F You got kicked due a Public vote!$z '; $message = '$39F You got kicked due a Public vote!$z ';
try { try {
$self->maniaControl->client->kick($target->login, $message); $self->maniaControl->client->kick($target->login, $message);
} catch (LoginUnknownException $e) { } catch (UnknownPlayerException $e) {
} }
}); });
break; break;
@ -745,10 +745,10 @@ class PlayerList implements ManialinkPageAnswerListener, CallbackListener, Timer
} }
/** /**
* Displays the Advanced Player Window * Display the Advanced Player Window
* *
* @param Player $caller * @param Player $caller
* @param $login * @param string $login
*/ */
public function advancedPlayerWidget(Player $caller, $login) { public function advancedPlayerWidget(Player $caller, $login) {
// Set status to target player login // Set status to target player login

View File

@ -6,10 +6,10 @@ use ManiaControl\Admin\AdminLists;
use ManiaControl\Callbacks\CallbackListener; use ManiaControl\Callbacks\CallbackListener;
use ManiaControl\Callbacks\CallbackManager; use ManiaControl\Callbacks\CallbackManager;
use ManiaControl\Callbacks\TimerListener; use ManiaControl\Callbacks\TimerListener;
use ManiaControl\Utils\Formatter;
use ManiaControl\ManiaControl; use ManiaControl\ManiaControl;
use ManiaControl\Statistics\StatisticManager; use ManiaControl\Statistics\StatisticManager;
use Maniaplanet\DedicatedServer\Xmlrpc\LoginUnknownException; use ManiaControl\Utils\Formatter;
use Maniaplanet\DedicatedServer\Xmlrpc\UnknownPlayerException;
/** /**
* Class managing Players * Class managing Players
@ -216,7 +216,7 @@ class PlayerManager implements CallbackListener, TimerListener {
$player->setDetailedInfo($playerInfo); $player->setDetailedInfo($playerInfo);
$this->addPlayer($player); $this->addPlayer($player);
} catch (LoginUnknownException $e) { } catch (UnknownPlayerException $e) {
} }
} }

View File

@ -298,8 +298,6 @@ class PluginMenu implements CallbackListener, ConfiguratorMenu, ManialinkPageAns
$nameLabel->setText($setting->setting); $nameLabel->setText($setting->setting);
$nameLabel->setTextColor("FFF"); $nameLabel->setTextColor("FFF");
$substyle = '';
$entry = new Entry(); $entry = new Entry();
$settingFrame->add($entry); $settingFrame->add($entry);
$entry->setStyle(Label_Text::STYLE_TextValueSmall); $entry->setStyle(Label_Text::STYLE_TextValueSmall);

View File

@ -6,7 +6,7 @@ use ManiaControl\Callbacks\CallbackListener;
use ManiaControl\Callbacks\CallbackManager; use ManiaControl\Callbacks\CallbackManager;
use ManiaControl\Callbacks\Callbacks; use ManiaControl\Callbacks\Callbacks;
use ManiaControl\ManiaControl; use ManiaControl\ManiaControl;
use Maniaplanet\DedicatedServer\Xmlrpc\NotInScriptModeException; use Maniaplanet\DedicatedServer\Xmlrpc\GameModeException;
/** /**
* Class managing Rankings * Class managing Rankings
@ -42,7 +42,7 @@ class RankingManager implements CallbackListener {
public function onInit() { public function onInit() {
try { try {
$this->maniaControl->client->triggerModeScriptEvent('LibXmlRpc_GetRankings', ''); $this->maniaControl->client->triggerModeScriptEvent('LibXmlRpc_GetRankings', '');
} catch (NotInScriptModeException $e) { } catch (GameModeException $e) {
} }
} }

View File

@ -13,7 +13,7 @@ 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\NotInScriptModeException; use Maniaplanet\DedicatedServer\Xmlrpc\GameModeException;
/** /**
* Class offering various Commands related to the Dedicated Server * Class offering various Commands related to the Dedicated Server
@ -106,7 +106,7 @@ class ServerCommands implements CallbackListener, CommandListener, ManialinkPage
//Check if Pause exists in current GameMode //Check if Pause exists in current GameMode
try { try {
$scriptInfos = $this->maniaControl->client->getModeScriptInfo(); $scriptInfos = $this->maniaControl->client->getModeScriptInfo();
} catch (NotInScriptModeException $e) { } catch (GameModeException $e) {
return; return;
} }
$pauseExists = false; $pauseExists = false;
@ -161,7 +161,7 @@ class ServerCommands implements CallbackListener, CommandListener, ManialinkPage
try { try {
$this->maniaControl->client->triggerModeScriptEvent('WarmUp_Extend', '10'); $this->maniaControl->client->triggerModeScriptEvent('WarmUp_Extend', '10');
} catch (NotInScriptModeException $e) { } catch (GameModeException $e) {
return; return;
} }
@ -182,7 +182,7 @@ class ServerCommands implements CallbackListener, CommandListener, ManialinkPage
try { try {
$this->maniaControl->client->triggerModeScriptEvent('WarmUp_Stop', ''); $this->maniaControl->client->triggerModeScriptEvent('WarmUp_Stop', '');
} catch (NotInScriptModeException $e) { } catch (GameModeException $e) {
return; return;
} }
@ -202,7 +202,7 @@ class ServerCommands implements CallbackListener, CommandListener, ManialinkPage
} }
try { try {
$this->maniaControl->client->sendModeScriptCommands(array('Command_ForceWarmUp' => true)); $this->maniaControl->client->sendModeScriptCommands(array('Command_ForceWarmUp' => true));
} catch (NotInScriptModeException $e) { } catch (GameModeException $e) {
return; return;
} }

View File

@ -6,7 +6,7 @@ use ManiaControl\Callbacks\TimerListener;
use ManiaControl\ManiaControl; use ManiaControl\ManiaControl;
use ManiaControl\Plugins\Plugin; use ManiaControl\Plugins\Plugin;
use ManiaControl\Utils\Formatter; use ManiaControl\Utils\Formatter;
use Maniaplanet\DedicatedServer\Xmlrpc\NotInScriptModeException; use Maniaplanet\DedicatedServer\Xmlrpc\GameModeException;
/** /**
* Class reporting ManiaControl Usage for the Server * Class reporting ManiaControl Usage for the Server
@ -69,7 +69,7 @@ class UsageReporter implements TimerListener {
try { try {
$scriptName = $this->maniaControl->client->getScriptName(); $scriptName = $this->maniaControl->client->getScriptName();
$properties['ScriptName'] = $scriptName['CurrentValue']; $properties['ScriptName'] = $scriptName['CurrentValue'];
} catch (NotInScriptModeException $e) { } catch (GameModeException $e) {
$properties['ScriptName'] = ''; $properties['ScriptName'] = '';
} }

View File

@ -7,7 +7,7 @@ use ManiaControl\ManiaControl;
use ManiaControl\Players\Player; use ManiaControl\Players\Player;
use ManiaControl\Plugins\Plugin; use ManiaControl\Plugins\Plugin;
use Maniaplanet\DedicatedServer\Xmlrpc\Exception; use Maniaplanet\DedicatedServer\Xmlrpc\Exception;
use Maniaplanet\DedicatedServer\Xmlrpc\LoginUnknownException; use Maniaplanet\DedicatedServer\Xmlrpc\UnknownPlayerException;
/** /**
* ManiaControl Chat-Message Plugin * ManiaControl Chat-Message Plugin
@ -384,7 +384,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 (LoginUnknownException $e) { } catch (UnknownPlayerException $e) {
$this->maniaControl->chat->sendError('Error occurred: ' . $e->getMessage(), $player); $this->maniaControl->chat->sendError('Error occurred: ' . $e->getMessage(), $player);
} }
} }

View File

@ -28,7 +28,7 @@ use ManiaControl\Server\Server;
use ManiaControl\Server\ServerCommands; use ManiaControl\Server\ServerCommands;
use ManiaControl\Utils\ColorUtil; use ManiaControl\Utils\ColorUtil;
use Maniaplanet\DedicatedServer\Structures\VoteRatio; use Maniaplanet\DedicatedServer\Structures\VoteRatio;
use Maniaplanet\DedicatedServer\Xmlrpc\NotInScriptModeException; use Maniaplanet\DedicatedServer\Xmlrpc\GameModeException;
/** /**
@ -235,7 +235,7 @@ class CustomVotesPlugin implements CommandListener, CallbackListener, ManialinkP
$itemQuad->setAction(self::ACTION_START_VOTE . 'pausegame'); $itemQuad->setAction(self::ACTION_START_VOTE . 'pausegame');
$this->addVoteMenuItem($itemQuad, 10, 'Vote for a pause of Current Game'); $this->addVoteMenuItem($itemQuad, 10, 'Vote for a pause of Current Game');
} }
} catch (NotInScriptModeException $e) { } catch (GameModeException $e) {
} }
//Menu SkipMap //Menu SkipMap

View File

@ -193,7 +193,7 @@ class ServerRankingPlugin implements Plugin, CallbackListener, CommandListener {
break; break;
case self::RANKING_TYPE_RECORDS: //TODO verify workable status case self::RANKING_TYPE_RECORDS: //TODO verify workable status
if (!$this->maniaControl->pluginManager->isPluginActive('MCTeam\LocalRecordsPlugin')) { if (!$this->maniaControl->pluginManager->isPluginActive(__NAMESPACE__ . '\LocalRecordsPlugin')) {
return; return;
} }
@ -201,7 +201,7 @@ class ServerRankingPlugin implements Plugin, CallbackListener, CommandListener {
$maxRecords = $this->maniaControl->settingManager->getSettingValue($this, self::SETTING_MAX_STORED_RECORDS); $maxRecords = $this->maniaControl->settingManager->getSettingValue($this, self::SETTING_MAX_STORED_RECORDS);
$query = 'SELECT playerIndex, COUNT(*) AS Cnt $query = 'SELECT playerIndex, COUNT(*) AS Cnt
FROM ' . \MCTeam\LocalRecordsPlugin::TABLE_RECORDS . ' FROM ' . LocalRecordsPlugin::TABLE_RECORDS . '
GROUP BY PlayerIndex GROUP BY PlayerIndex
HAVING Cnt >=' . $requiredRecords; HAVING Cnt >=' . $requiredRecords;
@ -212,8 +212,8 @@ class ServerRankingPlugin implements Plugin, CallbackListener, CommandListener {
} }
$result->free_result(); $result->free_result();
/** @var \MCTeam\LocalRecordsPlugin $localRecordsPlugin */ /** @var LocalRecordsPlugin $localRecordsPlugin */
$localRecordsPlugin = $this->maniaControl->pluginManager->getPlugin('MCTeam\LocalRecordsPlugin'); $localRecordsPlugin = $this->maniaControl->pluginManager->getPlugin(__NAMESPACE__ . '\LocalRecordsPlugin');
$maps = $this->maniaControl->mapManager->getMaps(); $maps = $this->maniaControl->mapManager->getMaps();
foreach ($maps as $map) { foreach ($maps as $map) {
$records = $localRecordsPlugin->getLocalRecords($map, $maxRecords); $records = $localRecordsPlugin->getLocalRecords($map, $maxRecords);

View File

@ -166,7 +166,7 @@ class WidgetPlugin implements CallbackListener, TimerListener, Plugin {
private function displayWidgets() { private function displayWidgets() {
// Display Map Widget // Display Map Widget
if ($this->maniaControl->settingManager->getSettingValue($this, self::SETTING_MAP_WIDGET_ACTIVATED)) { if ($this->maniaControl->settingManager->getSettingValue($this, self::SETTING_MAP_WIDGET_ACTIVATED)) {
$this->maniaControl->client->triggerModeScriptEventArray("Siege_SetProgressionLayerPosition", array("160.", "-67.", "0.")); $this->maniaControl->client->triggerModeScriptEvent("Siege_SetProgressionLayerPosition", array("160.", "-67.", "0."));
$this->displayMapWidget(); $this->displayMapWidget();
} }
if ($this->maniaControl->settingManager->getSettingValue($this, self::SETTING_CLOCK_WIDGET_ACTIVATED)) { if ($this->maniaControl->settingManager->getSettingValue($this, self::SETTING_CLOCK_WIDGET_ACTIVATED)) {
@ -397,7 +397,7 @@ class WidgetPlugin implements CallbackListener, TimerListener, Plugin {
*/ */
public function unload() { public function unload() {
//Restore Siege Progression Layer //Restore Siege Progression Layer
$this->maniaControl->client->triggerModeScriptEventArray("Siege_SetProgressionLayerPosition", array("160.", "90.", "0.")); $this->maniaControl->client->triggerModeScriptEvent("Siege_SetProgressionLayerPosition", array("160.", "90.", "0."));
$this->closeWidget(self::MLID_CLOCKWIDGET); $this->closeWidget(self::MLID_CLOCKWIDGET);
$this->closeWidget(self::MLID_SERVERINFOWIDGET); $this->closeWidget(self::MLID_SERVERINFOWIDGET);

View File

@ -9,7 +9,7 @@ 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\NotInScriptModeException; use Maniaplanet\DedicatedServer\Xmlrpc\GameModeException;
/** /**
* ManiaControl Obstacle Plugin * ManiaControl Obstacle Plugin
@ -120,7 +120,7 @@ class ObstaclePlugin implements CallbackListener, CommandListener, Plugin {
$param = $player->login . ";" . $params[1] . ";"; $param = $player->login . ";" . $params[1] . ";";
try { try {
$this->maniaControl->client->triggerModeScriptEvent(self::CB_JUMPTO, $param); $this->maniaControl->client->triggerModeScriptEvent(self::CB_JUMPTO, $param);
} catch (NotInScriptModeException $e) { } catch (GameModeException $e) {
} }
} }