Skip to content

Commit

Permalink
Trophies
Browse files Browse the repository at this point in the history
  • Loading branch information
roccodev committed Oct 31, 2018
1 parent 7d0bd63 commit f1d1275
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 4 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -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;
Expand Down Expand Up @@ -99,6 +100,15 @@ static void parseAchievements(JSONObject rawAchievements, List<Achievement> achi
}
}

public List<Trophy> getTrophies() {
List<Trophy> parsedTrophies = new ArrayList<>();
JSONArray trophies = source.getJSONArray("trophies");
for(Object trophy : trophies) {
parsedTrophies.add(new Trophy(new JObject((JSONObject)trophy)));
}
return parsedTrophies;
}

public List<Achievement> getUnlockedAchievements() {
return getAchievements().stream().filter(Achievement::isUnlocked).collect(Collectors.toList());
}
Expand Down
Original file line number Diff line number Diff line change
@@ -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");
}

}

0 comments on commit f1d1275

Please sign in to comment.