@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())); }