Closed ghost closed 8 years ago
pokemons().stream()
.filter(pkmn -> pkmn.getPokemonId().name().equals(targetId))
.sorted((a, b) -> Long.compare(b.getCreationTimeMs(), a.getCreationTimeMs()))
.findFirst()
.ifPresent(p -> {
String output = null;
try {
output = String.format("Caught a %s [CP: %d] [Candy: %d]", StringConverter.titleCase(targetId), p.getCp(), p.getCandy());
} catch (LoginFailedException e) {
e.printStackTrace();
} catch (RemoteServerException e) {
e.printStackTrace();
}
if (p.getCp() > Config.getMinimumCPForMessage()) {
PokeMateUI.toast(output, Config.POKE + "mon caught!", "icons/" + target.getPokemonId().getNumber() + ".png");
} else {
log(output + " [IV: " + getIvRatio(p) + "%]");
}
});
this could be done outside the loop ,keep a list of pokemons that was captured and then instead of equals use contains.
Can you please fix the conflicts so that it can be merged?
If not, I can update it, but its a real pita to resolve merge reqs.
Allows to recover all the Pokemon in one place. Currently, only the first Pokemon is recovered