1
0
Fork 0
mirror of https://codeberg.org/demostf/api.git synced 2026-06-04 10:24:07 +02:00

handle reconnected players better

This commit is contained in:
Robin Appelman 2022-06-07 15:16:48 +02:00
commit 76ee1f6cc3
5 changed files with 51 additions and 25 deletions

View file

@ -6,14 +6,16 @@ namespace Demostf\API\Data;
class ParsedPlayer {
private string $name;
private int $demoUserId;
/** @var int[] */
private array $demoUserIds;
private string $steamId;
private string $team;
private string $class;
public function __construct(string $name, int $demoUserId, string $steamId, string $team, string $class) {
public function __construct(string $name, string $steamId, string $team, string $class) {
$this->name = $name;
$this->demoUserId = $demoUserId;
$this->demoUserIds = [];
$this->steamId = $steamId;
$this->team = $team;
$this->class = $class;
@ -23,8 +25,16 @@ class ParsedPlayer {
return $this->name;
}
public function getDemoUserId(): int {
return $this->demoUserId;
public function addDemoUserId(int $userId): ParsedPlayer {
$this->demoUserIds[] = $userId;
return $this;
}
/**
* @return int[]
*/
public function getDemoUserIds(): array {
return $this->demoUserIds;
}
public function getSteamId(): string {