use of com.pokegoapi.exceptions.InvalidCurrencyException in project PokeGOAPI-Java by Grover-c13.
the class PlayerProfile method updateProfile.
/**
* Update the profile with the given player data
*
* @param playerData the data for update
*/
public void updateProfile(PlayerData playerData) {
this.playerData = playerData;
avatar = new PlayerAvatar(playerData.getAvatar());
dailyBonus = new DailyBonus(playerData.getDailyBonus());
contactSettings = new ContactSettings(playerData.getContactSettings());
// maybe something more graceful?
for (CurrencyOuterClass.Currency currency : playerData.getCurrenciesList()) {
try {
addCurrency(currency.getName(), currency.getAmount());
} catch (InvalidCurrencyException e) {
Log.w(TAG, "Error adding currency. You can probably ignore this.", e);
}
}
// Tutorial state
tutorialState = new TutorialState(playerData.getTutorialStateList());
if (playerData.hasBuddyPokemon() && playerData.getBuddyPokemon().getId() != 0) {
buddy = new Buddy(api, playerData.getBuddyPokemon());
} else {
buddy = null;
}
}
Aggregations