added getSpectators to PlayerManager

This commit is contained in:
kremsy
2015-06-26 13:25:29 +02:00
parent 491ac03078
commit 0b02f63309
3 changed files with 19 additions and 1 deletions

View File

@ -535,6 +535,22 @@ class PlayerManager implements CallbackListener, TimerListener, CommunicationLis
return $this->players;
}
/**
* Get a List of Spectators
*
* @return Player[]
*/
public function getSpectators() {
$spectators = array();
foreach ($this->players as $player) {
if ($player->isSpectator) {
$spectators[] = $player;
}
}
return $spectators;
}
/**
* Get the count of all spectators
*