@Override
public GameController createGame(PlayerToken playerToken, String gameName, int playersCount, int botsCount, GameListener gameListener) throws GameException, RemoteException {
if (!players.containsValue(playerToken)) {
throw new GameException("No such user registered on server!");
}
if (playersCount + botsCount >= MAX_NUMBER_OF_PLAYERS || playersCount + botsCount == 0) {
throw new GameException("Bad number of players - game must contain 2-4 players!");
}
if (games.containsKey(gameName)) {
throw new GameException("Not unique game name!");
}
List<Bot> bots = BotFactory.createBots(gameName, botsCount);
GameController gameController = new PanGameController(gameName, playersCount, bots);