small callback stability improvement
This commit is contained in:
parent
05f688b99f
commit
37e12ebf88
@ -30,15 +30,18 @@ class OnScoresStructure extends CommonScoresStructure {
|
||||
$jsonObj = $this->getPlainJsonObject();
|
||||
|
||||
foreach ($jsonObj->players as $jsonPlayer) {
|
||||
$playerScore = new PlayerScore();
|
||||
$playerScore->setPlayer($this->maniaControl->getPlayerManager()->getPlayer($jsonPlayer->login));
|
||||
$playerScore->setRank($jsonPlayer->rank);
|
||||
$playerScore->setRoundPoints($jsonPlayer->roundpoints);
|
||||
$playerScore->setMapPoints($jsonPlayer->mappoints);
|
||||
$playerScore->setMatchPoints($jsonPlayer->matchpoints);
|
||||
$player = $this->maniaControl->getPlayerManager()->getPlayer($jsonPlayer->login);
|
||||
if($player){
|
||||
$playerScore = new PlayerScore();
|
||||
$playerScore->setPlayer($this->maniaControl->getPlayerManager()->getPlayer($jsonPlayer->login));
|
||||
|
||||
$this->playerScores[$jsonPlayer->login] = $playerScore;
|
||||
$playerScore->setRank($jsonPlayer->rank);
|
||||
$playerScore->setRoundPoints($jsonPlayer->roundpoints);
|
||||
$playerScore->setMapPoints($jsonPlayer->mappoints);
|
||||
$playerScore->setMatchPoints($jsonPlayer->matchpoints);
|
||||
|
||||
$this->playerScores[$jsonPlayer->login] = $playerScore;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
@ -4,7 +4,6 @@ namespace ManiaControl\Callbacks\Structures\TrackMania;
|
||||
|
||||
use ManiaControl\Callbacks\Structures\Common\CommonScoresStructure;
|
||||
use ManiaControl\Callbacks\Structures\TrackMania\Models\PlayerScore;
|
||||
use ManiaControl\Callbacks\Structures\TrackMania\Models\TeamScore;
|
||||
use ManiaControl\ManiaControl;
|
||||
|
||||
/**
|
||||
@ -29,20 +28,23 @@ class OnScoresStructure extends CommonScoresStructure {
|
||||
$jsonObj = $this->getPlainJsonObject();
|
||||
|
||||
foreach ($jsonObj->players as $jsonPlayer) {
|
||||
$playerScore = new PlayerScore();
|
||||
$playerScore->setPlayer($this->maniaControl->getPlayerManager()->getPlayer($jsonPlayer->login));
|
||||
$playerScore->setRank($jsonPlayer->rank);
|
||||
$playerScore->setRoundPoints($jsonPlayer->roundpoints);
|
||||
$playerScore->setMapPoints($jsonPlayer->mappoints);
|
||||
$playerScore->setBestRaceTime($jsonPlayer->bestracetime);
|
||||
$playerScore->setBestLapTime($jsonPlayer->bestlaptime);
|
||||
$playerScore->setStuntScore($jsonPlayer->stuntsscore);
|
||||
$playerScore->setBestRaceRespawns($jsonPlayer->bestracerespawns);
|
||||
$playerScore->setBestRaceCheckpoints($jsonPlayer->bestracecheckpoints);
|
||||
$playerScore->setBestLapRespawns($jsonPlayer->bestlaprespawns);
|
||||
$playerScore->setBestLapCheckpoints($jsonPlayer->bestlapcheckpoints);
|
||||
$player = $this->maniaControl->getPlayerManager()->getPlayer($jsonPlayer->login);
|
||||
if ($player) {
|
||||
$playerScore = new PlayerScore();
|
||||
$playerScore->setPlayer($this->maniaControl->getPlayerManager()->getPlayer($jsonPlayer->login));
|
||||
$playerScore->setRank($jsonPlayer->rank);
|
||||
$playerScore->setRoundPoints($jsonPlayer->roundpoints);
|
||||
$playerScore->setMapPoints($jsonPlayer->mappoints);
|
||||
$playerScore->setBestRaceTime($jsonPlayer->bestracetime);
|
||||
$playerScore->setBestLapTime($jsonPlayer->bestlaptime);
|
||||
$playerScore->setStuntScore($jsonPlayer->stuntsscore);
|
||||
$playerScore->setBestRaceRespawns($jsonPlayer->bestracerespawns);
|
||||
$playerScore->setBestRaceCheckpoints($jsonPlayer->bestracecheckpoints);
|
||||
$playerScore->setBestLapRespawns($jsonPlayer->bestlaprespawns);
|
||||
$playerScore->setBestLapCheckpoints($jsonPlayer->bestlapcheckpoints);
|
||||
|
||||
$this->playerScores[$jsonPlayer->login] = $playerScore;
|
||||
$this->playerScores[$jsonPlayer->login] = $playerScore;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user