Skip to content

Commit d792310

Browse files
author
Damian Staszewski
committed
adding getPlayerAchievements
1 parent 5892fb6 commit d792310

File tree

1 file changed

+21
-3
lines changed

1 file changed

+21
-3
lines changed

src/main/java/pl/stachu540/hirezstudios/games/HiRezGames.java

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -329,9 +329,27 @@ public JSONObject getTopMatches() {
329329
return catchData("gettopmatches");
330330
}
331331

332-
// public JSONObject getPlayerAchievements(String username) {
333-
//
334-
// }
332+
/**
333+
* getting player achievements
334+
* @param username This may either be:
335+
* a.) the Player Name, or
336+
* b.) the Hi-Rez internally stored player_id
337+
* (available to API developers via the {@link #getPlayer(String)} API method).
338+
* @return
339+
*/
340+
public JSONObject getPlayerAchievements(String username) {
341+
int player_id = getPlayer(username).getJSONArray("content").getJSONObject(0).getInt("Id");
342+
return getPlayerAchievements(player_id);
343+
}
344+
345+
/**
346+
* getting player achievements
347+
* @param playerId This is the Player ID
348+
* @return Returns select achievement totals (Double kills, Tower Kills, First Bloods, etc) for the specified playerId.
349+
*/
350+
public JSONObject getPlayerAchievements(int playerId) {
351+
return catchData("getplayerachievements", String.valueOf(playerId));
352+
}
335353

336354
/**
337355
* Getting information about current deployed patch

0 commit comments

Comments
 (0)