small fix

This commit is contained in:
kremsy 2014-02-15 23:08:51 +01:00 committed by Steffen Schröder
parent d4b4161f68
commit b2c2c98c78

View File

@ -164,10 +164,13 @@ class PlayerManager implements CallbackListener {
$login = $callback[1][0]; $login = $callback[1][0];
$player = $this->removePlayer($login); $player = $this->removePlayer($login);
if ($player == null) {
return;
}
// Trigger own callback // Trigger own callback
$this->maniaControl->callbackManager->triggerCallback(self::CB_PLAYERDISCONNECTED, array(self::CB_PLAYERDISCONNECTED, $player)); $this->maniaControl->callbackManager->triggerCallback(self::CB_PLAYERDISCONNECTED, array(self::CB_PLAYERDISCONNECTED, $player));
if ($player == null || $player->isFakePlayer()) { if ($player->isFakePlayer()) {
return; return;
} }
@ -240,13 +243,14 @@ class PlayerManager implements CallbackListener {
/** /**
* Gets the Count of all Player * Gets the Count of all Player
*
* @return int * @return int
*/ */
public function getPlayerCount(){ public function getPlayerCount() {
$count = 0; $count = 0;
foreach($this->players as $player){ foreach($this->players as $player) {
/** @var Player $player */ /** @var Player $player */
if(!$player->isSpectator){ if (!$player->isSpectator) {
$count++; $count++;
} }
} }
@ -255,13 +259,14 @@ class PlayerManager implements CallbackListener {
/** /**
* Gets the Count of all Spectators * Gets the Count of all Spectators
*
* @return int * @return int
*/ */
public function getSpectatorCount(){ public function getSpectatorCount() {
$count = 0; $count = 0;
foreach($this->players as $player){ foreach($this->players as $player) {
/** @var Player $player */ /** @var Player $player */
if($player->isSpectator){ if ($player->isSpectator) {
$count++; $count++;
} }
} }