@Override public ObservableList<PlayerAchievement> getPlayerAchievements(String username) { if (userService.getUsername().equals(username)) { if (readOnlyPlayerAchievements.isEmpty()) { updatePlayerAchievementsFromServer(); } return readOnlyPlayerAchievements; } int playerId = playerService.getPlayerForUsername(username).getId(); return FXCollections.observableList(fafApiAccessor.getPlayerAchievements(playerId)); }
private void updatePlayerAchievementsFromServer() { playerAchievements.setAll(fafApiAccessor.getPlayerAchievements(userService.getUid())); }
@Override public CompletableFuture<AchievementDefinition> getAchievementDefinition(String achievementId) { return CompletableFuture.completedFuture( fafApiAccessor.getAchievementDefinition(achievementId)); }
@Override public CompletableFuture<List<AchievementDefinition>> getAchievementDefinitions() { // TODO make async again return CompletableFuture.completedFuture(fafApiAccessor.getAchievementDefinitions()); }