use of POGOProtos.Networking.Responses.UseItemEggIncubatorResponseOuterClass.UseItemEggIncubatorResponse in project PokeGOAPI-Java by Grover-c13.
the class EggIncubator method hatchEgg.
/**
* Hatch an egg.
*
* @param egg the egg
* @return status of putting egg in incubator
* @throws RequestFailedException if an exception occurred while sending requests
*/
public UseItemEggIncubatorResponse.Result hatchEgg(EggPokemon egg) throws RequestFailedException {
UseItemEggIncubatorMessage reqMsg = UseItemEggIncubatorMessage.newBuilder().setItemId(proto.getId()).setPokemonId(egg.getId()).build();
ServerRequest serverRequest = new ServerRequest(RequestType.USE_ITEM_EGG_INCUBATOR, reqMsg);
api.getRequestHandler().sendServerRequests(serverRequest, true);
UseItemEggIncubatorResponse response;
try {
response = UseItemEggIncubatorResponse.parseFrom(serverRequest.getData());
} catch (InvalidProtocolBufferException e) {
throw new RequestFailedException(e);
}
api.getInventories().updateInventories(true);
return response.getResult();
}
Aggregations