use of POGOProtos.Networking.Requests.Messages.GetInventoryMessageOuterClass.GetInventoryMessage in project PokeGOAPI-Java by Grover-c13.
the class Inventories method updateInventories.
/**
* Updates the inventories with the latest data.
*
* @param forceUpdate For a full update if true
* @return the response to the update message
* @throws RequestFailedException if an exception occurred while sending requests
*/
public GetInventoryResponse updateInventories(boolean forceUpdate) throws RequestFailedException {
if (forceUpdate) {
lastInventoryUpdate = 0;
itemBag.reset();
pokebank.reset();
candyjar.reset();
pokedex.reset();
synchronized (this.lock) {
incubators.clear();
}
hatchery.reset();
}
GetInventoryMessage invReqMsg = GetInventoryMessage.newBuilder().setLastTimestampMs(lastInventoryUpdate).build();
ServerRequest inventoryRequest = new ServerRequest(RequestTypeOuterClass.RequestType.GET_INVENTORY, invReqMsg);
api.getRequestHandler().sendServerRequests(inventoryRequest);
GetInventoryResponse response;
try {
response = GetInventoryResponse.parseFrom(inventoryRequest.getData());
} catch (InvalidProtocolBufferException e) {
throw new RequestFailedException(e);
}
return response;
}
Aggregations