Exemple #1
0
  public static void getCurrentGameInfo(String username, String region)
      throws IOException, JSONException {
    Request r = new Request(region);
    // String username = "******";
    String summonerResponse = r.getSummonerByName(username);

    JSONObject obj = new JSONObject(summonerResponse);
    String summonerID = String.valueOf(obj.getJSONObject(username.split(",")[0]).getInt("id"));

    String currentGameResponse = r.getCurrentGameByID(summonerID);
    obj = new JSONObject(currentGameResponse);
    JSONArray participants = obj.getJSONArray("participants");

    String ids = getPlayerIDs(participants);

    String ranks = r.getRankByID(ids);
    obj = new JSONObject(ranks);

    printCurrentGameInfo(obj, ids);
  }