diff --git a/README.md b/README.md index 8306ca2..66e1c2f 100644 --- a/README.md +++ b/README.md @@ -45,10 +45,10 @@ dependencies { ### Hive API Coverage - [x] Global player stats - [x] Gamemode stats -- [ ] Full player game stats -- [ ] Game leaderboards -- [ ] Game maps -- [ ] Server stats +- [x] Full player game stats +- [x] Game leaderboards +- [x] Game maps +- [x] Server stats - [ ] GameData ### Monthlies diff --git a/src/main/java/pw/roccodev/beezig/hiveapi/wrapper/player/HivePlayer.java b/src/main/java/pw/roccodev/beezig/hiveapi/wrapper/player/HivePlayer.java index 00ba0bd..59fd0a8 100644 --- a/src/main/java/pw/roccodev/beezig/hiveapi/wrapper/player/HivePlayer.java +++ b/src/main/java/pw/roccodev/beezig/hiveapi/wrapper/player/HivePlayer.java @@ -1,5 +1,6 @@ package pw.roccodev.beezig.hiveapi.wrapper.player; +import org.json.simple.JSONArray; import org.json.simple.JSONObject; import pw.roccodev.beezig.hiveapi.wrapper.mojang.UsernameToUuid; import pw.roccodev.beezig.hiveapi.wrapper.player.rank.PlayerRank; @@ -99,6 +100,15 @@ static void parseAchievements(JSONObject rawAchievements, List achi } } + public List getTrophies() { + List parsedTrophies = new ArrayList<>(); + JSONArray trophies = source.getJSONArray("trophies"); + for(Object trophy : trophies) { + parsedTrophies.add(new Trophy(new JObject((JSONObject)trophy))); + } + return parsedTrophies; + } + public List getUnlockedAchievements() { return getAchievements().stream().filter(Achievement::isUnlocked).collect(Collectors.toList()); } diff --git a/src/main/java/pw/roccodev/beezig/hiveapi/wrapper/player/Trophy.java b/src/main/java/pw/roccodev/beezig/hiveapi/wrapper/player/Trophy.java new file mode 100644 index 0000000..0a3a0d7 --- /dev/null +++ b/src/main/java/pw/roccodev/beezig/hiveapi/wrapper/player/Trophy.java @@ -0,0 +1,21 @@ +package pw.roccodev.beezig.hiveapi.wrapper.player; + +import pw.roccodev.beezig.hiveapi.wrapper.utils.json.JObject; + +public class Trophy { + + private JObject source; + + public Trophy(JObject source) { + this.source = source; + } + + public String getGame() { + return source.getString("game"); + } + + public String getAchievement() { + return source.getString("achievement"); + } + +}