small callback stability improvement
This commit is contained in:
parent
05f688b99f
commit
37e12ebf88
@ -30,8 +30,11 @@ class OnScoresStructure extends CommonScoresStructure {
|
|||||||
$jsonObj = $this->getPlainJsonObject();
|
$jsonObj = $this->getPlainJsonObject();
|
||||||
|
|
||||||
foreach ($jsonObj->players as $jsonPlayer) {
|
foreach ($jsonObj->players as $jsonPlayer) {
|
||||||
|
$player = $this->maniaControl->getPlayerManager()->getPlayer($jsonPlayer->login);
|
||||||
|
if($player){
|
||||||
$playerScore = new PlayerScore();
|
$playerScore = new PlayerScore();
|
||||||
$playerScore->setPlayer($this->maniaControl->getPlayerManager()->getPlayer($jsonPlayer->login));
|
$playerScore->setPlayer($this->maniaControl->getPlayerManager()->getPlayer($jsonPlayer->login));
|
||||||
|
|
||||||
$playerScore->setRank($jsonPlayer->rank);
|
$playerScore->setRank($jsonPlayer->rank);
|
||||||
$playerScore->setRoundPoints($jsonPlayer->roundpoints);
|
$playerScore->setRoundPoints($jsonPlayer->roundpoints);
|
||||||
$playerScore->setMapPoints($jsonPlayer->mappoints);
|
$playerScore->setMapPoints($jsonPlayer->mappoints);
|
||||||
@ -39,6 +42,6 @@ class OnScoresStructure extends CommonScoresStructure {
|
|||||||
|
|
||||||
$this->playerScores[$jsonPlayer->login] = $playerScore;
|
$this->playerScores[$jsonPlayer->login] = $playerScore;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -4,7 +4,6 @@ namespace ManiaControl\Callbacks\Structures\TrackMania;
|
|||||||
|
|
||||||
use ManiaControl\Callbacks\Structures\Common\CommonScoresStructure;
|
use ManiaControl\Callbacks\Structures\Common\CommonScoresStructure;
|
||||||
use ManiaControl\Callbacks\Structures\TrackMania\Models\PlayerScore;
|
use ManiaControl\Callbacks\Structures\TrackMania\Models\PlayerScore;
|
||||||
use ManiaControl\Callbacks\Structures\TrackMania\Models\TeamScore;
|
|
||||||
use ManiaControl\ManiaControl;
|
use ManiaControl\ManiaControl;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -29,6 +28,8 @@ class OnScoresStructure extends CommonScoresStructure {
|
|||||||
$jsonObj = $this->getPlainJsonObject();
|
$jsonObj = $this->getPlainJsonObject();
|
||||||
|
|
||||||
foreach ($jsonObj->players as $jsonPlayer) {
|
foreach ($jsonObj->players as $jsonPlayer) {
|
||||||
|
$player = $this->maniaControl->getPlayerManager()->getPlayer($jsonPlayer->login);
|
||||||
|
if ($player) {
|
||||||
$playerScore = new PlayerScore();
|
$playerScore = new PlayerScore();
|
||||||
$playerScore->setPlayer($this->maniaControl->getPlayerManager()->getPlayer($jsonPlayer->login));
|
$playerScore->setPlayer($this->maniaControl->getPlayerManager()->getPlayer($jsonPlayer->login));
|
||||||
$playerScore->setRank($jsonPlayer->rank);
|
$playerScore->setRank($jsonPlayer->rank);
|
||||||
@ -45,4 +46,5 @@ class OnScoresStructure extends CommonScoresStructure {
|
|||||||
$this->playerScores[$jsonPlayer->login] = $playerScore;
|
$this->playerScores[$jsonPlayer->login] = $playerScore;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user