Skip to content

Commit 9bcc995

Browse files
committed
Fix merge issue with package rename (Pokemon -> pokemon) and stylecheck errors.
1 parent 12ee3de commit 9bcc995

8 files changed

Lines changed: 27 additions & 21 deletions

File tree

src/main/java/com/pokegoapi/api/map/Map.java

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
* You should have received a copy of the GNU General Public License
1313
* along with this program. If not, see <http://www.gnu.org/licenses/>.
1414
*/
15+
1516
package com.pokegoapi.api.map;
1617

1718
import POGOProtos.Map.Fort.FortDataOuterClass.FortData;
@@ -25,6 +26,7 @@
2526
import POGOProtos.Networking.Requests.Messages.EncounterMessageOuterClass;
2627
import POGOProtos.Networking.Requests.Messages.FortDetailsMessageOuterClass.FortDetailsMessage;
2728
import POGOProtos.Networking.Requests.Messages.FortSearchMessageOuterClass.FortSearchMessage;
29+
import POGOProtos.Networking.Requests.Messages.GetMapObjectsMessageOuterClass;
2830
import POGOProtos.Networking.Requests.Messages.GetMapObjectsMessageOuterClass.GetMapObjectsMessage;
2931
import POGOProtos.Networking.Requests.RequestTypeOuterClass;
3032
import POGOProtos.Networking.Responses.CatchPokemonResponseOuterClass.CatchPokemonResponse;
@@ -97,7 +99,7 @@ public List<CatchablePokemon> getCatchablePokemon() throws LoginFailedException,
9799
catchablePokemons.add(new CatchablePokemon(api, mapPokemon));
98100
}
99101

100-
for(WildPokemonOuterClass.WildPokemon wildPokemon : objects.getWildPokemons()){
102+
for (WildPokemonOuterClass.WildPokemon wildPokemon : objects.getWildPokemons()) {
101103
catchablePokemons.add(new CatchablePokemon(api, wildPokemon));
102104
}
103105

@@ -243,24 +245,22 @@ public MapObjects getMapObjects(List<Long> cellIds, double latitude, double long
243245
* @return MapObjects in the given cells
244246
*/
245247
public MapObjects getMapObjects(List<Long> cellIds) throws LoginFailedException, RemoteServerException {
246-
GetMapObjectsMessage.Builder builder = GetMapObjectsMessage.newBuilder()
248+
GetMapObjectsMessage.Builder builder = GetMapObjectsMessage.newBuilder();
247249

248-
if(useCache && (System.currentTimeMillis() - lastMapUpdate > mapObjectsExpiry)){
250+
if (useCache && (System.currentTimeMillis() - lastMapUpdate > mapObjectsExpiry)) {
249251
lastMapUpdate = 0;
250252
cachedMapObjects = new MapObjects(api);
251253
}
252254

253-
GetMapObjectsMessageOuterClass.GetMapObjectsMessage.Builder builder = GetMapObjectsMessageOuterClass.GetMapObjectsMessage.newBuilder()
255+
builder = GetMapObjectsMessageOuterClass.GetMapObjectsMessage.newBuilder()
254256
.setLatitude(api.getLatitude())
255257
.setLongitude(api.getLongitude());
256258

257259
int index = 0;
258260
for (Long cellId : cellIds) {
259261
builder.addCellId(cellId);
260262
long time = 0;
261-
if (trackUpdate) {
262-
time = lastMapUpdate;
263-
}
263+
264264
builder.addSinceTimestampMs(lastMapUpdate);
265265
index++;
266266

@@ -295,7 +295,7 @@ public FortType apply(FortData fortData) {
295295
result.addPokestops(groupedForts.get(FortType.CHECKPOINT));
296296
}
297297

298-
if(useCache){
298+
if (useCache) {
299299
cachedMapObjects.update(result);
300300
result = cachedMapObjects;
301301
lastMapUpdate = System.currentTimeMillis();
@@ -318,8 +318,7 @@ public List<Long> getCellIds(double latitude, double longitude, int width) {
318318

319319
MutableInteger index = new MutableInteger(0);
320320
MutableInteger jindex = new MutableInteger(0);
321-
MutableInteger i = new MutableInteger(0);
322-
MutableInteger j = new MutableInteger(0);
321+
323322

324323
int level = cellId.level();
325324
int size = 1 << (S2CellId.MAX_LEVEL - level);

src/main/java/com/pokegoapi/api/map/MapObjects.java

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515

1616
package com.pokegoapi.api.map;
1717

18+
import POGOProtos.Map.Fort.FortDataOuterClass;
1819
import POGOProtos.Map.Fort.FortDataOuterClass.FortData;
1920
import POGOProtos.Map.Pokemon.MapPokemonOuterClass.MapPokemon;
2021
import POGOProtos.Map.Pokemon.NearbyPokemonOuterClass.NearbyPokemon;
@@ -160,7 +161,13 @@ public boolean isComplete() {
160161
return complete;
161162
}
162163

163-
public void update(MapObjects other){
164+
165+
/**
166+
* updates the object.
167+
*
168+
*
169+
*/
170+
public void update(MapObjects other) {
164171

165172
nearbyPokemons.clear();
166173
addNearbyPokemons(other.getNearbyPokemons());
@@ -177,19 +184,19 @@ public void update(MapObjects other){
177184
spawnPoints.clear();
178185
addSpawnPoints(other.getSpawnPoints());
179186

180-
for(FortDataOuterClass.FortData otherGym : other.getGyms()){
181-
for(FortDataOuterClass.FortData gym : getGyms()){
182-
if(otherGym.getId().equals(gym.getId())){
187+
for (FortData otherGym : other.getGyms()) {
188+
for (FortData gym : getGyms()) {
189+
if (otherGym.getId().equals(gym.getId())) {
183190
gyms.remove(gym);
184191
break;
185192
}
186193
}
187194
gyms.add(otherGym);
188195
}
189196

190-
for(Pokestop otherPokestop : other.getPokestops()){
191-
for(Pokestop pokestop : pokestops){
192-
if(otherPokestop.getId().equals(pokestop.getId())){
197+
for (Pokestop otherPokestop : other.getPokestops()) {
198+
for (Pokestop pokestop : pokestops) {
199+
if (otherPokestop.getId().equals(pokestop.getId())) {
193200
pokestops.remove(pokestop);
194201
break;
195202
}

src/main/java/com/pokegoapi/api/map/Pokemon/CatchPokemonResult.java renamed to src/main/java/com/pokegoapi/api/map/pokemon/CatchPokemonResult.java

File renamed without changes.

src/main/java/com/pokegoapi/api/map/Pokemon/CatchResult.java renamed to src/main/java/com/pokegoapi/api/map/pokemon/CatchResult.java

File renamed without changes.

src/main/java/com/pokegoapi/api/map/Pokemon/CatchablePokemon.java renamed to src/main/java/com/pokegoapi/api/map/pokemon/CatchablePokemon.java

File renamed without changes.

src/main/java/com/pokegoapi/api/map/Pokemon/EncounterResult.java renamed to src/main/java/com/pokegoapi/api/map/pokemon/EncounterResult.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,19 +36,19 @@ public boolean wasSuccessful() {
3636
return response != null && getStatus() != null && getStatus().equals(EncounterResponse.Status.ENCOUNTER_SUCCESS);
3737
}
3838

39-
public EncounterResponse.Background getBackground(){
39+
public EncounterResponse.Background getBackground() {
4040
return response.getBackground();
4141
}
4242

43-
public CaptureProbabilityOuterClass.CaptureProbability getCaptureProbability(){
43+
public CaptureProbabilityOuterClass.CaptureProbability getCaptureProbability() {
4444
return response.getCaptureProbability();
4545
}
4646

47-
public WildPokemonOuterClass.WildPokemon getWildPokemon(){
47+
public WildPokemonOuterClass.WildPokemon getWildPokemon() {
4848
return response.getWildPokemon();
4949
}
5050

51-
public EncounterResponse toPrimitive(){
51+
public EncounterResponse toPrimitive() {
5252
return response;
5353
}
5454
}

src/main/java/com/pokegoapi/api/map/Pokemon/EvolutionResult.java renamed to src/main/java/com/pokegoapi/api/map/pokemon/EvolutionResult.java

File renamed without changes.

src/main/java/com/pokegoapi/api/map/Pokemon/NearbyPokemon.java renamed to src/main/java/com/pokegoapi/api/map/pokemon/NearbyPokemon.java

File renamed without changes.

0 commit comments

Comments
 (0)