if (text == null || text.isEmpty()) {
return options;
}
final JsonWrapper json = new JsonWrapper(text);
final String[] cardSetsParsed = json.getString(GameOptionData.CARD_SETS, "").split(",");
for (final String cardSetId : cardSetsParsed) {
if (!cardSetId.isEmpty()) {
options.cardSetIds.add(Integer.parseInt(cardSetId));
}
}
options.blanksInDeck = Math.max(MIN_BLANK_CARD_LIMIT, Math.min(MAX_BLANK_CARD_LIMIT,
json.getInteger(GameOptionData.BLANKS_LIMIT, options.blanksInDeck)));
options.playerLimit = Math.max(MIN_PLAYER_LIMIT, Math.min(MAX_PLAYER_LIMIT,
json.getInteger(GameOptionData.PLAYER_LIMIT, options.playerLimit)));
options.spectatorLimit = Math.max(MIN_SPECTATOR_LIMIT, Math.min(MAX_SPECTATOR_LIMIT,
json.getInteger(GameOptionData.SPECTATOR_LIMIT, options.spectatorLimit)));
options.scoreGoal = Math.max(MIN_SCORE_LIMIT, Math.min(MAX_SCORE_LIMIT,
json.getInteger(GameOptionData.SCORE_LIMIT, options.scoreGoal)));
options.useIdleTimer = json.getBoolean(GameOptionData.USE_TIMER, options.useIdleTimer);
options.password = json.getString(GameOptionData.PASSWORD, options.password);
return options;
}