player speccount methods
This commit is contained in:
parent
0e118840fe
commit
de54e45b59
@ -238,6 +238,36 @@ class PlayerManager implements CallbackListener {
|
|||||||
return $this->players;
|
return $this->players;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the Count of all Player
|
||||||
|
* @return int
|
||||||
|
*/
|
||||||
|
public function getPlayerCount(){
|
||||||
|
$count = 0;
|
||||||
|
foreach($this->players as $player){
|
||||||
|
/** @var Player $player */
|
||||||
|
if(!$player->isSpectator){
|
||||||
|
$count++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $count;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the Count of all Spectators
|
||||||
|
* @return int
|
||||||
|
*/
|
||||||
|
public function getSpectatorCount(){
|
||||||
|
$count = 0;
|
||||||
|
foreach($this->players as $player){
|
||||||
|
/** @var Player $player */
|
||||||
|
if($player->isSpectator){
|
||||||
|
$count++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $count;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets a Player by his index
|
* Gets a Player by his index
|
||||||
*
|
*
|
||||||
@ -248,7 +278,6 @@ class PlayerManager implements CallbackListener {
|
|||||||
foreach($this->players as $player) {
|
foreach($this->players as $player) {
|
||||||
/** @var Player $player */
|
/** @var Player $player */
|
||||||
if ($player->index == $index) {
|
if ($player->index == $index) {
|
||||||
|
|
||||||
return $player;
|
return $player;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -53,7 +53,7 @@ class UsageReporter implements TimerListener {
|
|||||||
$properties['ServerLogin'] = $this->maniaControl->server->login;
|
$properties['ServerLogin'] = $this->maniaControl->server->login;
|
||||||
$properties['TitleId'] = $this->maniaControl->server->titleId;
|
$properties['TitleId'] = $this->maniaControl->server->titleId;
|
||||||
$properties['ServerName'] = $this->maniaControl->server->getName();
|
$properties['ServerName'] = $this->maniaControl->server->getName();
|
||||||
$properties['PlayerCount'] = count($this->maniaControl->playerManager->getPlayers());
|
$properties['PlayerCount'] = $this->maniaControl->playerManager->getPlayerCount();
|
||||||
try {
|
try {
|
||||||
$maxPlayers = $this->maniaControl->client->getMaxPlayers();
|
$maxPlayers = $this->maniaControl->client->getMaxPlayers();
|
||||||
$properties['MaxPlayers'] = $maxPlayers["CurrentValue"];
|
$properties['MaxPlayers'] = $maxPlayers["CurrentValue"];
|
||||||
|
Loading…
Reference in New Issue
Block a user