updated dedicated-server-api exception usages
This commit is contained in:
parent
d16e89d13d
commit
16d2571485
@ -4,7 +4,7 @@ namespace ManiaControl;
|
||||
|
||||
use ManiaControl\Admin\AuthenticationManager;
|
||||
use ManiaControl\Players\Player;
|
||||
use Maniaplanet\DedicatedServer\Xmlrpc\LoginUnknownException;
|
||||
use Maniaplanet\DedicatedServer\Xmlrpc\UnknownPlayerException;
|
||||
|
||||
/**
|
||||
* Chat Utility Class
|
||||
@ -57,35 +57,6 @@ class Chat {
|
||||
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
|
||||
*
|
||||
@ -105,12 +76,10 @@ class Chat {
|
||||
$this->maniaControl->client->chatSend($chatMessage, null, true);
|
||||
} else {
|
||||
$chatMessage = '$<$z$ff0' . $this->getPrefix($prefix) . $message . '$>';
|
||||
if (is_object($login) && property_exists($login, 'login')) {
|
||||
$login = $login->login;
|
||||
}
|
||||
$login = Player::parseLogin($login);
|
||||
try {
|
||||
$this->maniaControl->client->chatSend($chatMessage, $login, true);
|
||||
} catch (LoginUnknownException $e) {
|
||||
} catch (UnknownPlayerException $e) {
|
||||
}
|
||||
}
|
||||
return true;
|
||||
@ -132,6 +101,35 @@ class Chat {
|
||||
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
|
||||
*
|
||||
|
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
namespace ManiaControl\Utils;
|
||||
namespace ManiaControl;
|
||||
|
||||
/**
|
||||
* Command Line Helper Class
|
||||
|
@ -18,7 +18,7 @@ use ManiaControl\ManiaControl;
|
||||
use ManiaControl\Maps\Map;
|
||||
use ManiaControl\Players\Player;
|
||||
use Maniaplanet\DedicatedServer\Xmlrpc\Exception;
|
||||
use Maniaplanet\DedicatedServer\Xmlrpc\NotInScriptModeException;
|
||||
use Maniaplanet\DedicatedServer\Xmlrpc\GameModeException;
|
||||
|
||||
/**
|
||||
* Class offering a Configurator for Script Settings
|
||||
@ -108,7 +108,7 @@ class ScriptSettings implements ConfiguratorMenu, CallbackListener {
|
||||
public function loadSettingsFromDatabase() {
|
||||
try {
|
||||
$scriptSettings = $this->maniaControl->client->getModeScriptSettings();
|
||||
} catch (NotInScriptModeException $e) {
|
||||
} catch (GameModeException $e) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -164,7 +164,7 @@ class ScriptSettings implements ConfiguratorMenu, CallbackListener {
|
||||
|
||||
try {
|
||||
$scriptInfo = $this->maniaControl->client->getModeScriptInfo();
|
||||
} catch (NotInScriptModeException $e) {
|
||||
} catch (GameModeException $e) {
|
||||
$label = new Label();
|
||||
$frame->add($label);
|
||||
$label->setText($e->getMessage());
|
||||
@ -175,8 +175,7 @@ class ScriptSettings implements ConfiguratorMenu, CallbackListener {
|
||||
|
||||
try {
|
||||
$scriptSettings = $this->maniaControl->client->getModeScriptSettings();
|
||||
} catch (NotInScriptModeException $e) {
|
||||
//do nothing
|
||||
} catch (GameModeException $e) {
|
||||
}
|
||||
|
||||
// Config
|
||||
@ -328,7 +327,7 @@ class ScriptSettings implements ConfiguratorMenu, CallbackListener {
|
||||
public function toggleBooleanSetting($setting, Player $player) {
|
||||
try {
|
||||
$scriptSettings = $this->maniaControl->client->getModeScriptSettings();
|
||||
} catch (NotInScriptModeException $e) {
|
||||
} catch (GameModeException $e) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -442,7 +441,7 @@ class ScriptSettings implements ConfiguratorMenu, CallbackListener {
|
||||
|
||||
try {
|
||||
$scriptSettings = $this->maniaControl->client->getModeScriptSettings();
|
||||
} catch (NotInScriptModeException $e) {
|
||||
} catch (GameModeException $e) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
namespace ManiaControl\Utils;
|
||||
namespace ManiaControl;
|
||||
|
||||
/**
|
||||
* Class offering Methods to format Texts and Values
|
||||
|
@ -5,7 +5,7 @@ namespace ManiaControl\ManiaExchange;
|
||||
use ManiaControl\ManiaControl;
|
||||
use ManiaControl\Maps\Map;
|
||||
use ManiaControl\Maps\MapManager;
|
||||
use Maniaplanet\DedicatedServer\Xmlrpc\NotInScriptModeException;
|
||||
use Maniaplanet\DedicatedServer\Xmlrpc\GameModeException;
|
||||
|
||||
/**
|
||||
* Mania Exchange Info Searcher Class
|
||||
@ -306,7 +306,7 @@ class ManiaExchangeManager {
|
||||
$scriptInfos = $this->maniaControl->client->getModeScriptInfo();
|
||||
$mapTypes = $scriptInfos->compatibleMapTypes;
|
||||
$url .= '&mtype=' . $mapTypes;
|
||||
} catch (NotInScriptModeException $e) {
|
||||
} catch (GameModeException $e) {
|
||||
}
|
||||
|
||||
$success = $this->maniaControl->fileReader->loadFile($url, function ($mapInfo, $error) use (&$function, $titlePrefix) {
|
||||
|
@ -10,8 +10,8 @@ use ManiaControl\Callbacks\CallbackListener;
|
||||
use ManiaControl\Callbacks\CallbackManager;
|
||||
use ManiaControl\ManiaControl;
|
||||
use ManiaControl\Players\Player;
|
||||
use Maniaplanet\DedicatedServer\Xmlrpc\LoginUnknownException;
|
||||
use Maniaplanet\DedicatedServer\Xmlrpc\NotInScriptModeException;
|
||||
use Maniaplanet\DedicatedServer\Xmlrpc\GameModeException;
|
||||
use Maniaplanet\DedicatedServer\Xmlrpc\UnknownPlayerException;
|
||||
|
||||
/**
|
||||
* Manialink Manager Class
|
||||
@ -215,7 +215,7 @@ class ManialinkManager implements ManialinkPageAnswerListener, CallbackListener
|
||||
|
||||
return $success;
|
||||
}
|
||||
} catch (LoginUnknownException $e) {
|
||||
} catch (UnknownPlayerException $e) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -250,7 +250,7 @@ class ManialinkManager implements ManialinkPageAnswerListener, CallbackListener
|
||||
public function disableAltMenu(Player $player) {
|
||||
try {
|
||||
$success = $this->maniaControl->client->triggerModeScriptEvent('LibXmlRpc_DisableAltMenu', $player->login);
|
||||
} catch (NotInScriptModeException $e) {
|
||||
} catch (GameModeException $e) {
|
||||
return false;
|
||||
}
|
||||
return $success;
|
||||
@ -295,7 +295,7 @@ class ManialinkManager implements ManialinkPageAnswerListener, CallbackListener
|
||||
public function enableAltMenu(Player $player) {
|
||||
try {
|
||||
$success = $this->maniaControl->client->triggerModeScriptEvent('LibXmlRpc_EnableAltMenu', $player->login);
|
||||
} catch (NotInScriptModeException $e) {
|
||||
} catch (GameModeException $e) {
|
||||
return false;
|
||||
}
|
||||
return $success;
|
||||
|
@ -118,7 +118,7 @@ class StyleManager {
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the default list widget width
|
||||
* Get the Default List Widgets Width
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
|
@ -17,14 +17,14 @@ use FML\Script\Features\Paging;
|
||||
use ManiaControl\Callbacks\CallbackListener;
|
||||
use ManiaControl\Callbacks\CallbackManager;
|
||||
use ManiaControl\Callbacks\Callbacks;
|
||||
use ManiaControl\Utils\ColorUtil;
|
||||
use ManiaControl\Utils\Formatter;
|
||||
use ManiaControl\ManiaControl;
|
||||
use ManiaControl\Manialinks\IconManager;
|
||||
use ManiaControl\Manialinks\ManialinkManager;
|
||||
use ManiaControl\Manialinks\ManialinkPageAnswerListener;
|
||||
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\KarmaPlugin;
|
||||
|
||||
@ -613,7 +613,7 @@ class MapList implements ManialinkPageAnswerListener, CallbackListener {
|
||||
$this->maniaControl->mapManager->mapQueue->dontQueueNextMapChange();
|
||||
try {
|
||||
$this->maniaControl->client->jumpToMapIdent($mapUid);
|
||||
} catch (MapNotFoundException $e) {
|
||||
} catch (NotInListException $e) {
|
||||
$this->maniaControl->chat->sendError("Error on Jumping to Map Ident!");
|
||||
break;
|
||||
}
|
||||
@ -645,7 +645,7 @@ class MapList implements ManialinkPageAnswerListener, CallbackListener {
|
||||
|
||||
try {
|
||||
$self->maniaControl->client->JumpToMapIdent($map->uid);
|
||||
} catch (MapNotFoundException $e) {
|
||||
} catch (NotInListException $e) {
|
||||
}
|
||||
});
|
||||
break;
|
||||
|
@ -13,11 +13,11 @@ use ManiaControl\ManiaExchange\ManiaExchangeManager;
|
||||
use ManiaControl\ManiaExchange\MXMapInfo;
|
||||
use ManiaControl\Players\Player;
|
||||
use Maniaplanet\DedicatedServer\InvalidArgumentException;
|
||||
use Maniaplanet\DedicatedServer\Xmlrpc\CouldNotWritePlaylistFileException;
|
||||
use Maniaplanet\DedicatedServer\Xmlrpc\Exception;
|
||||
use Maniaplanet\DedicatedServer\Xmlrpc\MapNotCompatibleOrCompleteException;
|
||||
use Maniaplanet\DedicatedServer\Xmlrpc\MapNotInCurrentSelectionException;
|
||||
use Maniaplanet\DedicatedServer\Xmlrpc\StartIndexOutOfBoundException;
|
||||
use Maniaplanet\DedicatedServer\Xmlrpc\FileException;
|
||||
use Maniaplanet\DedicatedServer\Xmlrpc\IndexOutOfBoundException;
|
||||
use Maniaplanet\DedicatedServer\Xmlrpc\InvalidMapException;
|
||||
use Maniaplanet\DedicatedServer\Xmlrpc\NotInListException;
|
||||
|
||||
// TODO: adding of local maps
|
||||
|
||||
@ -209,7 +209,7 @@ class MapManager implements CallbackListener {
|
||||
// Remove map
|
||||
try {
|
||||
$this->maniaControl->client->removeMap($map->fileName);
|
||||
} catch (MapNotInCurrentSelectionException $e) {
|
||||
} catch (NotInListException $e) {
|
||||
}
|
||||
|
||||
unset($this->maps[$uid]);
|
||||
@ -322,7 +322,7 @@ class MapManager implements CallbackListener {
|
||||
// Check for valid map
|
||||
try {
|
||||
$this->maniaControl->client->checkMapForCurrentServerParams($relativeMapFileName);
|
||||
} catch (MapNotCompatibleOrCompleteException $e) {
|
||||
} catch (InvalidMapException $e) {
|
||||
trigger_error("Couldn't check if map is valid ('{$relativeMapFileName}'). " . $e->getMessage());
|
||||
$this->maniaControl->chat->sendError('Wrong MapType or not validated!', $login);
|
||||
return;
|
||||
@ -394,7 +394,7 @@ class MapManager implements CallbackListener {
|
||||
|
||||
$i += 150;
|
||||
}
|
||||
} catch (StartIndexOutOfBoundException $e) {
|
||||
} catch (IndexOutOfBoundException $e) {
|
||||
}
|
||||
|
||||
// restore Sorted MapList
|
||||
@ -408,7 +408,7 @@ class MapManager implements CallbackListener {
|
||||
$matchSettingsFileName = $this->maniaControl->settingManager->getSettingValue($this, self::SETTING_MAPLIST_FILE);
|
||||
try {
|
||||
$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!");
|
||||
}
|
||||
}
|
||||
|
@ -8,16 +8,16 @@ use FML\Controls\Quad;
|
||||
use FML\Controls\Quads\Quad_Icons64x64_1;
|
||||
use FML\ManiaLink;
|
||||
use ManiaControl\Admin\AuthenticationManager;
|
||||
use ManiaControl\Utils\Formatter;
|
||||
use ManiaControl\ManiaControl;
|
||||
use ManiaControl\Manialinks\ManialinkManager;
|
||||
use ManiaControl\Utils\Formatter;
|
||||
use Maniaplanet\DedicatedServer\Xmlrpc\AlreadyInListException;
|
||||
use Maniaplanet\DedicatedServer\Xmlrpc\Exception;
|
||||
use Maniaplanet\DedicatedServer\Xmlrpc\FaultException;
|
||||
use Maniaplanet\DedicatedServer\Xmlrpc\LoginUnknownException;
|
||||
use Maniaplanet\DedicatedServer\Xmlrpc\NotInTeamModeException;
|
||||
use Maniaplanet\DedicatedServer\Xmlrpc\PlayerAlreadyIgnoredException;
|
||||
use Maniaplanet\DedicatedServer\Xmlrpc\PlayerIsNotSpectatorException;
|
||||
use Maniaplanet\DedicatedServer\Xmlrpc\PlayerNotIgnoredException;
|
||||
use Maniaplanet\DedicatedServer\Xmlrpc\GameModeException;
|
||||
use Maniaplanet\DedicatedServer\Xmlrpc\NotInListException;
|
||||
use Maniaplanet\DedicatedServer\Xmlrpc\PlayerStateException;
|
||||
use Maniaplanet\DedicatedServer\Xmlrpc\UnknownPlayerException;
|
||||
|
||||
/**
|
||||
* Player Actions Class
|
||||
@ -95,7 +95,7 @@ class PlayerActions {
|
||||
|
||||
try {
|
||||
$this->maniaControl->client->forcePlayerTeam($target->login, $teamId);
|
||||
} catch (NotInTeamModeException $e) {
|
||||
} catch (GameModeException $e) {
|
||||
$this->forcePlayerToPlay($adminLogin, $targetLogin);
|
||||
return;
|
||||
}
|
||||
@ -194,7 +194,7 @@ class PlayerActions {
|
||||
// Free player slot
|
||||
try {
|
||||
$this->maniaControl->client->spectatorReleasePlayerSlot($target->login);
|
||||
} catch (PlayerIsNotSpectatorException $e) {
|
||||
} catch (PlayerStateException $e) {
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -220,7 +220,7 @@ class PlayerActions {
|
||||
|
||||
try {
|
||||
$this->maniaControl->client->unIgnore($targetLogin);
|
||||
} catch (PlayerNotIgnoredException $e) {
|
||||
} catch (NotInListException $e) {
|
||||
$this->maniaControl->chat->sendError("Player is not ignored!");
|
||||
return;
|
||||
}
|
||||
@ -252,7 +252,7 @@ class PlayerActions {
|
||||
|
||||
try {
|
||||
$this->maniaControl->client->ignore($targetLogin);
|
||||
} catch (PlayerAlreadyIgnoredException $e) {
|
||||
} catch (AlreadyInListException $e) {
|
||||
$this->maniaControl->chat->sendError("Player already ignored!");
|
||||
return;
|
||||
}
|
||||
@ -369,7 +369,7 @@ class PlayerActions {
|
||||
} else {
|
||||
$this->maniaControl->client->kick($target->login, $message);
|
||||
}
|
||||
} catch (LoginUnknownException $e) {
|
||||
} catch (UnknownPlayerException $e) {
|
||||
$this->maniaControl->chat->sendException($e, $admin->login);
|
||||
return;
|
||||
}
|
||||
|
@ -10,10 +10,10 @@ use FML\Controls\Quad;
|
||||
use FML\Controls\Quads\Quad_BgsPlayerCard;
|
||||
use FML\ManiaLink;
|
||||
use FML\Script\Script;
|
||||
use ManiaControl\Utils\Formatter;
|
||||
use ManiaControl\ManiaControl;
|
||||
use ManiaControl\Manialinks\ManialinkManager;
|
||||
use ManiaControl\Statistics\StatisticManager;
|
||||
use ManiaControl\Utils\Formatter;
|
||||
|
||||
/**
|
||||
* Player Detailed Page
|
||||
@ -34,7 +34,7 @@ class PlayerDetailed {
|
||||
private $maniaControl = null;
|
||||
|
||||
/**
|
||||
* Create a new Player Detailed instance
|
||||
* Create a new Player Detailed Instance
|
||||
*
|
||||
* @param ManiaControl $maniaControl
|
||||
*/
|
||||
|
@ -18,12 +18,12 @@ use ManiaControl\Admin\AuthenticationManager;
|
||||
use ManiaControl\Callbacks\CallbackListener;
|
||||
use ManiaControl\Callbacks\CallbackManager;
|
||||
use ManiaControl\Callbacks\TimerListener;
|
||||
use ManiaControl\Utils\Formatter;
|
||||
use ManiaControl\ManiaControl;
|
||||
use ManiaControl\Manialinks\ManialinkManager;
|
||||
use ManiaControl\Manialinks\ManialinkPageAnswerListener;
|
||||
use Maniaplanet\DedicatedServer\Xmlrpc\LoginUnknownException;
|
||||
use Maniaplanet\DedicatedServer\Xmlrpc\PlayerIsNotSpectatorException;
|
||||
use ManiaControl\Utils\Formatter;
|
||||
use Maniaplanet\DedicatedServer\Xmlrpc\PlayerStateException;
|
||||
use Maniaplanet\DedicatedServer\Xmlrpc\UnknownPlayerException;
|
||||
use MCTeam\CustomVotesPlugin;
|
||||
|
||||
/**
|
||||
@ -641,7 +641,7 @@ class PlayerList implements ManialinkPageAnswerListener, CallbackListener, Timer
|
||||
try {
|
||||
$this->maniaControl->client->forceSpectator($adminLogin, PlayerActions::SPECTATOR_BUT_KEEP_SELECTABLE);
|
||||
$this->maniaControl->client->forceSpectatorTarget($adminLogin, $targetLogin, 1);
|
||||
} catch (PlayerIsNotSpectatorException $e) {
|
||||
} catch (PlayerStateException $e) {
|
||||
}
|
||||
break;
|
||||
case self::ACTION_OPEN_PLAYER_DETAILED:
|
||||
@ -713,7 +713,7 @@ class PlayerList implements ManialinkPageAnswerListener, CallbackListener, Timer
|
||||
try {
|
||||
$self->maniaControl->client->forceSpectator($target->login, PlayerActions::SPECTATOR_BUT_KEEP_SELECTABLE);
|
||||
$self->maniaControl->client->spectatorReleasePlayerSlot($target->login);
|
||||
} catch (PlayerIsNotSpectatorException $e) {
|
||||
} catch (PlayerStateException $e) {
|
||||
}
|
||||
});
|
||||
break;
|
||||
@ -737,7 +737,7 @@ class PlayerList implements ManialinkPageAnswerListener, CallbackListener, Timer
|
||||
$message = '$39F You got kicked due a Public vote!$z ';
|
||||
try {
|
||||
$self->maniaControl->client->kick($target->login, $message);
|
||||
} catch (LoginUnknownException $e) {
|
||||
} catch (UnknownPlayerException $e) {
|
||||
}
|
||||
});
|
||||
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 $login
|
||||
* @param string $login
|
||||
*/
|
||||
public function advancedPlayerWidget(Player $caller, $login) {
|
||||
// Set status to target player login
|
||||
|
@ -6,10 +6,10 @@ use ManiaControl\Admin\AdminLists;
|
||||
use ManiaControl\Callbacks\CallbackListener;
|
||||
use ManiaControl\Callbacks\CallbackManager;
|
||||
use ManiaControl\Callbacks\TimerListener;
|
||||
use ManiaControl\Utils\Formatter;
|
||||
use ManiaControl\ManiaControl;
|
||||
use ManiaControl\Statistics\StatisticManager;
|
||||
use Maniaplanet\DedicatedServer\Xmlrpc\LoginUnknownException;
|
||||
use ManiaControl\Utils\Formatter;
|
||||
use Maniaplanet\DedicatedServer\Xmlrpc\UnknownPlayerException;
|
||||
|
||||
/**
|
||||
* Class managing Players
|
||||
@ -216,7 +216,7 @@ class PlayerManager implements CallbackListener, TimerListener {
|
||||
$player->setDetailedInfo($playerInfo);
|
||||
|
||||
$this->addPlayer($player);
|
||||
} catch (LoginUnknownException $e) {
|
||||
} catch (UnknownPlayerException $e) {
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -298,8 +298,6 @@ class PluginMenu implements CallbackListener, ConfiguratorMenu, ManialinkPageAns
|
||||
$nameLabel->setText($setting->setting);
|
||||
$nameLabel->setTextColor("FFF");
|
||||
|
||||
$substyle = '';
|
||||
|
||||
$entry = new Entry();
|
||||
$settingFrame->add($entry);
|
||||
$entry->setStyle(Label_Text::STYLE_TextValueSmall);
|
||||
|
@ -6,7 +6,7 @@ use ManiaControl\Callbacks\CallbackListener;
|
||||
use ManiaControl\Callbacks\CallbackManager;
|
||||
use ManiaControl\Callbacks\Callbacks;
|
||||
use ManiaControl\ManiaControl;
|
||||
use Maniaplanet\DedicatedServer\Xmlrpc\NotInScriptModeException;
|
||||
use Maniaplanet\DedicatedServer\Xmlrpc\GameModeException;
|
||||
|
||||
/**
|
||||
* Class managing Rankings
|
||||
@ -42,7 +42,7 @@ class RankingManager implements CallbackListener {
|
||||
public function onInit() {
|
||||
try {
|
||||
$this->maniaControl->client->triggerModeScriptEvent('LibXmlRpc_GetRankings', '');
|
||||
} catch (NotInScriptModeException $e) {
|
||||
} catch (GameModeException $e) {
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -13,7 +13,7 @@ use ManiaControl\Commands\CommandListener;
|
||||
use ManiaControl\ManiaControl;
|
||||
use ManiaControl\Manialinks\ManialinkPageAnswerListener;
|
||||
use ManiaControl\Players\Player;
|
||||
use Maniaplanet\DedicatedServer\Xmlrpc\NotInScriptModeException;
|
||||
use Maniaplanet\DedicatedServer\Xmlrpc\GameModeException;
|
||||
|
||||
/**
|
||||
* 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
|
||||
try {
|
||||
$scriptInfos = $this->maniaControl->client->getModeScriptInfo();
|
||||
} catch (NotInScriptModeException $e) {
|
||||
} catch (GameModeException $e) {
|
||||
return;
|
||||
}
|
||||
$pauseExists = false;
|
||||
@ -161,7 +161,7 @@ class ServerCommands implements CallbackListener, CommandListener, ManialinkPage
|
||||
|
||||
try {
|
||||
$this->maniaControl->client->triggerModeScriptEvent('WarmUp_Extend', '10');
|
||||
} catch (NotInScriptModeException $e) {
|
||||
} catch (GameModeException $e) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -182,7 +182,7 @@ class ServerCommands implements CallbackListener, CommandListener, ManialinkPage
|
||||
|
||||
try {
|
||||
$this->maniaControl->client->triggerModeScriptEvent('WarmUp_Stop', '');
|
||||
} catch (NotInScriptModeException $e) {
|
||||
} catch (GameModeException $e) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -202,7 +202,7 @@ class ServerCommands implements CallbackListener, CommandListener, ManialinkPage
|
||||
}
|
||||
try {
|
||||
$this->maniaControl->client->sendModeScriptCommands(array('Command_ForceWarmUp' => true));
|
||||
} catch (NotInScriptModeException $e) {
|
||||
} catch (GameModeException $e) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -6,7 +6,7 @@ use ManiaControl\Callbacks\TimerListener;
|
||||
use ManiaControl\ManiaControl;
|
||||
use ManiaControl\Plugins\Plugin;
|
||||
use ManiaControl\Utils\Formatter;
|
||||
use Maniaplanet\DedicatedServer\Xmlrpc\NotInScriptModeException;
|
||||
use Maniaplanet\DedicatedServer\Xmlrpc\GameModeException;
|
||||
|
||||
/**
|
||||
* Class reporting ManiaControl Usage for the Server
|
||||
@ -69,7 +69,7 @@ class UsageReporter implements TimerListener {
|
||||
try {
|
||||
$scriptName = $this->maniaControl->client->getScriptName();
|
||||
$properties['ScriptName'] = $scriptName['CurrentValue'];
|
||||
} catch (NotInScriptModeException $e) {
|
||||
} catch (GameModeException $e) {
|
||||
$properties['ScriptName'] = '';
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
@ -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
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
|
@ -9,7 +9,7 @@ use ManiaControl\Commands\CommandListener;
|
||||
use ManiaControl\ManiaControl;
|
||||
use ManiaControl\Players\Player;
|
||||
use ManiaControl\Plugins\Plugin;
|
||||
use Maniaplanet\DedicatedServer\Xmlrpc\NotInScriptModeException;
|
||||
use Maniaplanet\DedicatedServer\Xmlrpc\GameModeException;
|
||||
|
||||
/**
|
||||
* ManiaControl Obstacle Plugin
|
||||
@ -120,7 +120,7 @@ class ObstaclePlugin implements CallbackListener, CommandListener, Plugin {
|
||||
$param = $player->login . ";" . $params[1] . ";";
|
||||
try {
|
||||
$this->maniaControl->client->triggerModeScriptEvent(self::CB_JUMPTO, $param);
|
||||
} catch (NotInScriptModeException $e) {
|
||||
} catch (GameModeException $e) {
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user