Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 9 additions & 5 deletions src/main/java/com/pokegoapi/api/inventory/EggIncubator.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,6 @@
public class EggIncubator {
private final EggIncubatorOuterClass.EggIncubator proto;
private final PokemonGo pgo;
@Getter
private boolean inUse = false;

/**
* Create new EggIncubator with given proto.
Expand All @@ -43,7 +41,6 @@ public class EggIncubator {
public EggIncubator(PokemonGo pgo, EggIncubatorOuterClass.EggIncubator proto) {
this.pgo = pgo;
this.proto = proto;
this.inUse = proto.getPokemonId() != 0;
}

/**
Expand Down Expand Up @@ -83,8 +80,6 @@ public UseItemEggIncubatorResponse.Result hatchEgg(EggPokemon egg)

pgo.getInventories().updateInventories(true);

this.inUse = true;

return response.getResult();
}

Expand Down Expand Up @@ -123,4 +118,13 @@ public double getKmTarget() {
public double getKmWalked() {
return proto.getStartKmWalked();
}

/**
* Returns whether this incubator is hatching an egg.
*
* @return true if it is currently hatching an egg
*/
public boolean isInUse() {
return getKmTarget() > pgo.getPlayerProfile().getStats().getKmWalked();
}
}