Skip to content

Commit 562781f

Browse files
committed
find Pokemon by ID
update inventory after hatching eggs add missing license
1 parent 80c8052 commit 562781f

File tree

3 files changed

+31
-0
lines changed

3 files changed

+31
-0
lines changed

src/main/java/com/pokegoapi/api/inventory/Hatchery.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ public List<HatchedEgg> queryHatchedEggs() throws RemoteServerException, LoginFa
6666
} catch (InvalidProtocolBufferException e) {
6767
throw new RemoteServerException(e);
6868
}
69+
instance.getInventories().updateInventories();
6970
List<HatchedEgg> eggs = new ArrayList<HatchedEgg>();
7071
for (int i = 0; i < response.getPokemonIdCount(); i++) {
7172
eggs.add(new HatchedEgg(response.getPokemonId(i),

src/main/java/com/pokegoapi/api/inventory/PokeBank.java

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,4 +82,19 @@ public boolean test(Pokemon pokemn) {
8282
}
8383
}).collect(Collectors.<Pokemon>toList());
8484
}
85+
86+
/**
87+
* Get a pokemon by id.
88+
*
89+
* @param id the id
90+
* @return the pokemon
91+
*/
92+
public Pokemon getPokemonById(final Long id) {
93+
for (Pokemon pokemon : pokemons) {
94+
if (pokemon.getId() == id) {
95+
return pokemon;
96+
}
97+
}
98+
return null;
99+
}
85100
}

src/main/java/com/pokegoapi/api/pokemon/HatchedEgg.java

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,18 @@
1+
/*
2+
* This program is free software: you can redistribute it and/or modify
3+
* it under the terms of the GNU General Public License as published by
4+
* the Free Software Foundation, either version 3 of the License, or
5+
* (at your option) any later version.
6+
*
7+
* This program is distributed in the hope that it will be useful,
8+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
9+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10+
* GNU General Public License for more details.
11+
*
12+
* You should have received a copy of the GNU General Public License
13+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
14+
*/
15+
116
package com.pokegoapi.api.pokemon;
217

318
import lombok.AllArgsConstructor;

0 commit comments

Comments
 (0)