fixed exceptions
This commit is contained in:
committed by
Steffen Schröder
parent
689e572c62
commit
d3cc9db29c
@ -132,7 +132,16 @@ class PlayerActions {
|
||||
$this->forcePlayerToPlay($adminLogin, $targetLogin, true, false);
|
||||
}
|
||||
|
||||
$this->maniaControl->client->forcePlayerTeam($target->login, $teamId);
|
||||
try {
|
||||
$this->maniaControl->client->forcePlayerTeam($target->login, $teamId);
|
||||
} catch(Exception $e) {
|
||||
if ($e->getMessage() == "Not in Team mode.") {
|
||||
$this->forcePlayerToPlay($adminLogin, $targetLogin);
|
||||
return;
|
||||
} else {
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
|
||||
$chatMessage = false;
|
||||
$title = $this->maniaControl->authenticationManager->getAuthLevelName($admin->authLevel);
|
||||
|
@ -9,6 +9,7 @@ use ManiaControl\Callbacks\TimerListener;
|
||||
use ManiaControl\Formatter;
|
||||
use ManiaControl\ManiaControl;
|
||||
use ManiaControl\Statistics\StatisticManager;
|
||||
use Maniaplanet\DedicatedServer\Xmlrpc\Exception;
|
||||
|
||||
/**
|
||||
* Class managing Players
|
||||
@ -143,11 +144,17 @@ class PlayerManager implements CallbackListener, TimerListener {
|
||||
* @param array $callback
|
||||
*/
|
||||
public function playerConnect(array $callback) {
|
||||
$login = $callback[1][0];
|
||||
$playerInfo = $this->maniaControl->client->getDetailedPlayerInfo($login);
|
||||
$player = new Player($playerInfo);
|
||||
$login = $callback[1][0];
|
||||
try {
|
||||
$playerInfo = $this->maniaControl->client->getDetailedPlayerInfo($login);
|
||||
$player = new Player($playerInfo);
|
||||
|
||||
$this->addPlayer($player);
|
||||
$this->addPlayer($player);
|
||||
} catch(Exception $e) {
|
||||
if ($e->getMessage() != 'Login unknown.') {
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user