Closed nateschickler0 closed 8 years ago
Ahhhh shit. I removed it because I refactored some of the updating for profiles but forgot to add the setters. @Data
is not needed in there anymore, will place the getters in there though
:+1: breaks my project :) maybe we make a release at some point?
Thanks for the fix @mjmfighter @davidmann4 Agreed
still does not work for me :(
Can you need to use the getter to get these attributes : profile.getUsername()
for example
//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by Fernflower decompiler)
//
package com.pokegoapi.api.player;
import POGOProtos.Data.Player.EquippedBadgeOuterClass.EquippedBadge;
import POGOProtos.Data.Player.PlayerStatsOuterClass.PlayerStats;
import POGOProtos.Networking.Requests.Messages.GetPlayerMessageOuterClass.GetPlayerMessage;
import POGOProtos.Networking.Requests.RequestTypeOuterClass.RequestType;
import POGOProtos.Networking.Responses.GetPlayerResponseOuterClass.GetPlayerResponse;
import com.google.protobuf.InvalidProtocolBufferException;
import com.pokegoapi.api.PokemonGo;
import com.pokegoapi.api.player.ContactSettings;
import com.pokegoapi.api.player.DailyBonus;
import com.pokegoapi.api.player.PlayerAvatar;
import com.pokegoapi.api.player.Team;
import com.pokegoapi.exceptions.InvalidCurrencyException;
import com.pokegoapi.exceptions.LoginFailedException;
import com.pokegoapi.exceptions.RemoteServerException;
import com.pokegoapi.main.ServerRequest;
import com.pokegoapi.util.Log;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
public class PlayerProfile {
private static final String TAG = PlayerProfile.class.getSimpleName();
private final PokemonGo api;
private long creationTime;
private String username;
private Team team;
private int pokemonStorage;
private int itemStorage;
private EquippedBadge badge;
private PlayerAvatar avatar;
private DailyBonus dailyBonus;
private ContactSettings contactSettings;
private Map<PlayerProfile.Currency, Integer> currencies = new HashMap();
private PlayerStats stats;
public PlayerProfile(PokemonGo api) throws LoginFailedException, RemoteServerException {
this.api = api;
this.updateProfile();
}
public void updateProfile() throws LoginFailedException, RemoteServerException {
GetPlayerMessage getPlayerReqMsg = GetPlayerMessage.newBuilder().build();
ServerRequest getPlayerServerRequest = new ServerRequest(RequestType.GET_PLAYER, getPlayerReqMsg);
this.api.getRequestHandler().request(getPlayerServerRequest);
this.api.getRequestHandler().sendServerRequests();
GetPlayerResponse playerResponse = null;
try {
playerResponse = GetPlayerResponse.parseFrom(getPlayerServerRequest.getData());
} catch (InvalidProtocolBufferException var11) {
var11.printStackTrace();
}
this.badge = playerResponse.getPlayerData().getEquippedBadge();
this.creationTime = playerResponse.getPlayerData().getCreationTimestampMs();
this.itemStorage = playerResponse.getPlayerData().getMaxItemStorage();
this.pokemonStorage = playerResponse.getPlayerData().getMaxPokemonStorage();
this.team = Team.values()[playerResponse.getPlayerData().getTeam()];
this.username = playerResponse.getPlayerData().getUsername();
PlayerAvatar avatarApi = new PlayerAvatar();
DailyBonus bonusApi = new DailyBonus();
new ContactSettings();
Iterator var7 = playerResponse.getPlayerData().getCurrenciesList().iterator();
while(var7.hasNext()) {
POGOProtos.Data.Player.CurrencyOuterClass.Currency currency = (POGOProtos.Data.Player.CurrencyOuterClass.Currency)var7.next();
try {
this.addCurrency(currency.getName(), currency.getAmount());
} catch (InvalidCurrencyException var10) {
Log.w(TAG, "Error adding currency. You can probably ignore this.", var10);
}
}
avatarApi.setGender(playerResponse.getPlayerData().getAvatar().getGender());
avatarApi.setBackpack(playerResponse.getPlayerData().getAvatar().getBackpack());
avatarApi.setEyes(playerResponse.getPlayerData().getAvatar().getEyes());
avatarApi.setHair(playerResponse.getPlayerData().getAvatar().getHair());
avatarApi.setHat(playerResponse.getPlayerData().getAvatar().getHat());
avatarApi.setPants(playerResponse.getPlayerData().getAvatar().getPants());
avatarApi.setShirt(playerResponse.getPlayerData().getAvatar().getShirt());
avatarApi.setShoes(playerResponse.getPlayerData().getAvatar().getShoes());
avatarApi.setSkin(playerResponse.getPlayerData().getAvatar().getSkin());
bonusApi.setNextCollectionTimestamp(playerResponse.getPlayerData().getDailyBonus().getNextCollectedTimestampMs());
bonusApi.setNextDefenderBonusCollectTimestamp(playerResponse.getPlayerData().getDailyBonus().getNextDefenderBonusCollectTimestampMs());
this.avatar = avatarApi;
this.dailyBonus = bonusApi;
}
public void addCurrency(String name, int amount) throws InvalidCurrencyException {
try {
this.currencies.put(PlayerProfile.Currency.valueOf(name), Integer.valueOf(amount));
} catch (Exception var4) {
throw new InvalidCurrencyException();
}
}
public int getCurrency(PlayerProfile.Currency currency) throws InvalidCurrencyException {
if(this.currencies.containsKey(currency)) {
return ((Integer)this.currencies.get(currency)).intValue();
} else {
throw new InvalidCurrencyException();
}
}
public PlayerStats getStats() {
return this.stats;
}
public void setStats(PlayerStats stats) {
this.stats = stats;
}
public static enum Currency {
STARDUST,
POKECOIN;
private Currency() {
}
}
}
no get read the bug description:
The @Data Lombok annotation in PlayerProfile.java does not function correctly and the getters and setters are not generated when the project compiles.
have you tried: https://discuss.kotlinlang.org/t/kotlin-java-lombok-interop/1442 ?
I use this project: https://github.com/jabbink/PokemonGoBot
it uses this project as a lib via https://jitpack.io/#Grover-c13/PokeGOAPI-Java
This should be solved, use the development branch to get the lastest version but there is multiple bot running without problem (including mine) with this function. Re-open if isnt the case.
The
@Data
Lombok annotation in PlayerProfile.java does not function correctly and the getters and setters are not generated when the project compiles.