fixed bug (getPlayer($shown) ???)
improved coding
This commit is contained in:
parent
2c066f7b62
commit
d6cbba3d4b
@ -767,20 +767,21 @@ class PlayerList implements ManialinkPageAnswerListener, CallbackListener, Timer
|
|||||||
* @param Player $player
|
* @param Player $player
|
||||||
*/
|
*/
|
||||||
public function updateWidget(Player $player) {
|
public function updateWidget(Player $player) {
|
||||||
foreach($this->playersListShown as $login => $shown) {
|
foreach ($this->playersListShown as $login => $shown) {
|
||||||
if ($shown) {
|
if (!$shown) continue;
|
||||||
// Check if Shown player still exists
|
|
||||||
if ($shown != self::SHOWN_MAIN_WINDOW && $this->maniaControl->playerManager->getPlayer($shown) == null) {
|
// Check if shown player still exists
|
||||||
$this->playersListShown[$login] = false;
|
$player = $this->maniaControl->playerManager->getPlayer($login);
|
||||||
}
|
if (!$player) {
|
||||||
$player = $this->maniaControl->playerManager->getPlayer($login);
|
unset($this->playersListShown[$login]);
|
||||||
if ($player) {
|
continue;
|
||||||
$this->showPlayerList($player);
|
|
||||||
} else {
|
|
||||||
// if player with the open widget disconnected remove him from the shownlist
|
|
||||||
unset($this->playersListShown[$login]);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Reopen widget
|
||||||
|
if ($shown != self::SHOWN_MAIN_WINDOW) {
|
||||||
|
$this->playersListShown[$login] = false;
|
||||||
|
}
|
||||||
|
$this->showPlayerList($player);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user