use of POGOProtos.Networking.Requests.Messages.ReleasePokemonMessageOuterClass.ReleasePokemonMessage in project PokeGOAPI-Java by Grover-c13.
the class Pokemon method transferPokemon.
/**
* Transfers the pokemon.
*
* @return the result
* @throws RequestFailedException if an exception occurred while sending requests
*/
public Result transferPokemon() throws RequestFailedException {
if (this.isFavorite() || this.isDeployed()) {
return Result.FAILED;
}
ReleasePokemonMessage reqMsg = ReleasePokemonMessage.newBuilder().setPokemonId(getId()).build();
ServerRequest serverRequest = new ServerRequest(RequestType.RELEASE_POKEMON, reqMsg);
api.requestHandler.sendServerRequests(serverRequest, true);
ReleasePokemonResponse response;
try {
response = ReleasePokemonResponse.parseFrom(serverRequest.getData());
} catch (InvalidProtocolBufferException e) {
return ReleasePokemonResponse.Result.FAILED;
}
if (response.getResult() == Result.SUCCESS) {
api.inventories.pokebank.removePokemon(this);
}
return response.getResult();
}
Aggregations