use of POGOProtos.Networking.Requests.Messages.UseIncenseMessageOuterClass.UseIncenseMessage in project PokeGOAPI-Java by Grover-c13.
the class ItemBag method useIncense.
/**
* use an incense
*
* @param type type of item
* @throws RequestFailedException if an exception occurred while sending requests
*/
public void useIncense(ItemId type) throws RequestFailedException {
UseIncenseMessage useIncenseMessage = UseIncenseMessage.newBuilder().setIncenseType(type).setIncenseTypeValue(type.getNumber()).build();
ServerRequest useIncenseRequest = new ServerRequest(RequestType.USE_INCENSE, useIncenseMessage);
api.getRequestHandler().sendServerRequests(useIncenseRequest, true);
try {
UseIncenseResponse response = UseIncenseResponse.parseFrom(useIncenseRequest.getData());
Log.i("Main", "Use incense result: " + response.getResult());
} catch (InvalidProtocolBufferException e) {
throw new RequestFailedException(e);
}
}
Aggregations