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

@ -7,7 +7,7 @@ use ManiaControl\ManiaControl;
use ManiaControl\Players\Player;
use ManiaControl\Plugins\Plugin;
use Maniaplanet\DedicatedServer\Xmlrpc\Exception;
use Maniaplanet\DedicatedServer\Xmlrpc\LoginUnknownException;
use Maniaplanet\DedicatedServer\Xmlrpc\UnknownPlayerException;
/**
* ManiaControl Chat-Message Plugin
@ -384,7 +384,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 (LoginUnknownException $e) {
} catch (UnknownPlayerException $e) {
$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\Utils\ColorUtil;
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');
$this->addVoteMenuItem($itemQuad, 10, 'Vote for a pause of Current Game');
}
} catch (NotInScriptModeException $e) {
} catch (GameModeException $e) {
}
//Menu SkipMap

View File

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

View File

@ -166,7 +166,7 @@ class WidgetPlugin implements CallbackListener, TimerListener, Plugin {
private function displayWidgets() {
// Display Map Widget
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();
}
if ($this->maniaControl->settingManager->getSettingValue($this, self::SETTING_CLOCK_WIDGET_ACTIVATED)) {
@ -397,7 +397,7 @@ class WidgetPlugin implements CallbackListener, TimerListener, Plugin {
*/
public function unload() {
//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_SERVERINFOWIDGET);