protected function forcePlayerTeam($login)
 {
     $team = $this->match->getTeam($login);
     if ($team) {
         // -1 because :
         // 0 for server = team 1
         // 1 for server = team 2
         $this->connection->forcePlayerTeam($login, $team - 1);
     }
 }
 /**
  * Register a match in database, the match Server will use this to ready up
  * @param string $serverLogin
  * @param \ManiaLivePlugins\MatchMakingLobby\Services\Match $match
  * @param string $scriptName
  * @param string $titleIdString
  * @return int $matchId
  */
 function registerMatch($serverLogin, Match $match, $scriptName, $titleIdString, $lobbyLogin)
 {
     $this->db->execute('BEGIN');
     try {
         $this->db->execute('INSERT INTO Matches (creationDate, state, matchServerLogin, scriptName, titleIdString, lobbyLogin) ' . 'VALUES (NOW(), -1, %s, %s, %s, %s)', $this->db->quote($serverLogin), $this->db->quote($scriptName), $this->db->quote($titleIdString), $this->db->quote($lobbyLogin));
         $matchId = $this->db->insertID();
         $this->updateServerCurrentMatchId($matchId, $serverLogin, $scriptName, $titleIdString);
         foreach ($match->players as $player) {
             $this->addMatchPlayer($matchId, $player, $match->getTeam($player));
         }
         $this->db->execute('COMMIT');
     } catch (\Exception $e) {
         $this->db->execute('ROLLBACK');
         throw $e;
     }
     return $matchId;
 }