Adds a player to the team.

@param  \RecAnalyst\Model\Player  $player  The player we wish to add
@return void
976689
public function addPlayer(Player $player)
    {
        $this->players[] = $player;
        if ($this->index == -1) {
            $this->index = $player->team;
        }
    }
1020134
public function onVoteCancelled(Player $player, $cmdName, $cmdValue)
    {

        if ($cmdValue instanceof Vote) {
            $this->voteWidgetFactory->destroy($this->players);
            $this->updateVoteWidgetFactory->destroy($this->players);
        } else {
            $this->voteService->cancel();
        }
    }
439127
public function addChild($child)
    {
        $children = $this->getChildren();
        array_push($children, $child);
        $this->setChildren($children);
    }
958862
public function add($object)
    {
        $this->hasUnpersistedChanges = true;
        $this->addedObjects->attach($object);
        $this->removedObjects->detach($object);
    }
932367
protected function buildTeams($players)
    {
        $teams = [];
        $teamsByIndex = [];
        foreach ($players as $player) {
            /**
             * Team = 0 can mean two things: either this player has no team,
             * i.e. is in a team on their own, or this player is cooping with
             * another player who _is_ part of a team.
             */
            if ($player->team == 0) {
                $found = false;
                foreach ($teams as $team) {
                    if ($team->index() != $player->team) {
                        continue;
                    }
                    foreach ($team->players() as $coopPlayer) {
                        if ($coopPlayer->index == $player->index) {
                            $team->addPlayer($player);
                            $found = true;
                            break;
                        }
                    }
                }
                // Not a cooping player, so add them to their own team.
                if (!$found) {
                    $team = new Team();
                    $team->addPlayer($player);
                    $teams[] = $team;
                    $teamsByIndex[$player->team] = $team;
                }
            } else {
                if (array_key_exists($player->team, $teamsByIndex)) {
                    $teamsByIndex[$player->team]->addPlayer($player);
                } else {
                    $team = new Team();
                    $team ->addPlayer($player);
                    $teams[] = $team;
                    $teamsByIndex[$player->team] = $team;
                }
            }
        }

        return $teams;
    }
835518
public function addItem($item)
    {
        $indentation = $this->indent($this->indentation);

        $this->buffer[] = $indentation.$item;
    }
614861
def _set_player(self):
        
        players = []
        for name, p in self._mpris_players.items():
            # we set the priority here as we need to establish the player name
            # which might not be immediately available.
            if "_priority" not in p:
                if self.player_priority:
                    try:
                        priority = self.player_priority.index(p["name"])
                    except ValueError:
                        try:
                            priority = self.player_priority.index("*")
                        except ValueError:
                            priority = None
                else:
                    priority = 0
                if priority is not None:
                    p["_priority"] = priority
            if p.get("_priority") is not None:
                players.append((p["_state_priority"], p["_priority"], p["index"], name))
        if players:
            top_player = self._mpris_players.get(sorted(players)[0][3])
        else:
            top_player = {}

        self._player = top_player.get("_dbus_player")
        self._player_details = top_player

        self.py3.update()
1072632
public function setCurrentPlayer($extraPlayer = 0)
    {
        try {
            $player = $this->gameBackendService->getCurrentPlayerNumber();
        } catch (\Exception $e) {
            $player = 0;
        }

        if ($player > 0) {
            $player += $extraPlayer;
        }

        $class = $this->collectionOptions->getEntityOptions()->getPlayerHistory();
        /** @var \PServerCore\Entity\PlayerHistory $playerHistory */
        $playerHistory = new $class();
        $playerHistory->setPlayer($player);

        $this->entityManager->persist($playerHistory);
        $this->entityManager->flush();
    }
1260259
public function addColumn($col)
    {
        $col = $this->createColumn($col);
        $this->columns[$col->getUniqueId()] = $col;
    }
363514
public function save(Player $player)
    {
        if (self::playerExists($player->get('steamid'))) {
            $this->update($player);
        } else {
            $this->insert($player);
        }
    }
550572
function() {
            // set player position (player is not added to the enitity manager)
            this.entityManager.add(this.player.x, this.player.y, this.player);
            this.player.updateFov();
            this.lighting.update();
            this.renderer.setCenter(this.player.x, this.player.y);
            this.renderer.draw();
        }
36592
protected function init(PlayerId $playerId, MiniGameId $gameId, $name)
    {
        $this->playerId = $playerId;
        $this->gameId = $gameId;
        $this->name = $name;
    }
437739
public function add_item(cc_i_item &$item) {
        if (is_null($this->itemlist)) {
            $this->itemlist = array();
        }
        $this->itemlist[$item->identifier] = $item;
    }
1011482
public function addChild($child)
    {
        if ($child == null) return;
        $child->onAddChild($this);
        $this->child_list[$child->core_name] = $child;
    }
649745
public function save(Player $player)
    {
        // First clear references. Player has no references that needs saving.
        $player->clearAllReferences(false);

        // Save and free memory.
        $player->save();
        PlayerTableMap::clearInstancePool();
    }
286192
public function move($player, $move)
    {
        $this->checkPlayer($player);
        $this->checkMove($move);

        // Take seeds in hand
        $hand = $this->grid[$player]['seeds'][$move];
        $this->grid[$player]['seeds'][$move] = 0;

        $row = $player;
        $box = $move;

        /**
         * Dispatch seeds
         */
        while ($hand > 0) {
            if (0 === $row) {
                if (0 === $box) {
                    $row = 1;
                } else {
                    $box--;
                }
            } else {
                if (5 === $box) {
                    $row = 0;
                } else {
                    $box++;
                }
            }

            // Feed box
            if (($row !== $player) || ($box !== $move)) {
                $hand--;
                $this->grid[$row]['seeds'][$box]++;
            }
        }

        /**
         * Anti starve check
         */
        if ((0 === $row && 0 === $box) || (1 === $row && 5 === $box)) {
            if (($row !== $player) && self::allSeedsVulnerable($this->grid[$row]['seeds'])) {
                return $this;
            }
        }

        /**
         * Store opponent seeds
         */
        while (($row !== $player) && in_array($this->grid[$row]['seeds'][$box], array(2, 3))) {
            // Store his seeds
            $this->grid[$player]['attic'] += $this->grid[$row]['seeds'][$box];
            $this->grid[$row]['seeds'][$box] = 0;

            // Check previous box
            if (0 === $row) {
                if (5 === $box) {
                    $row = 1;
                } else {
                    $box++;
                }
            } else {
                if (0 === $box) {
                    $row = 0;
                } else {
                    $box--;
                }
            }
        }

        return $this;
    }
182402
public static function playerStillNeedsToAct(Player $player, $message = null)
    {
        $defaultMessage = sprintf('%s still needs to act.', $player);
        $message = null === $message ? $defaultMessage : $message;

        return new static($message);
    }