Skip to content

Commit 33c67a2

Browse files
committed
clean up datapackage
1 parent e2b4f30 commit 33c67a2

File tree

2 files changed

+3
-48
lines changed

2 files changed

+3
-48
lines changed

src/main/java/dev/koifysh/archipelago/Client.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -334,8 +334,7 @@ public boolean checkLocations(Collection<Long> locationIDs) {
334334
* @param locationIDs List of location ID's to request info on.
335335
*/
336336
public void scoutLocations(ArrayList<Long> locationIDs) {
337-
HashMap<Long, String> locations = dataPackage.getLocationsForGame(game);
338-
locationIDs.removeIf( location -> !locations.containsKey(location));
337+
locationIDs.removeIf( location -> !dataPackage.getGame(game).locationNameToId.containsValue(location));
339338
webSocket.scoutLocation(locationIDs);
340339
}
341340

src/main/java/dev/koifysh/archipelago/parts/DataPackage.java

Lines changed: 2 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,6 @@ public class DataPackage implements Serializable {
1414
@SerializedName("games")
1515
HashMap<String, Game> games = new HashMap<>();
1616

17-
HashMap<Long, String> itemIdToName = new HashMap<>();
18-
19-
HashMap<Long, String> locationIdToName = new HashMap<>();
20-
2117
public String uuid = UUID.randomUUID().toString();
2218

2319
public String getItem(long itemID, String game) {
@@ -50,48 +46,8 @@ public HashMap<String, Game> getGames() {
5046
return games;
5147
}
5248

53-
public HashMap<Long, String> getItems() {
54-
if(itemIdToName.isEmpty()) {
55-
for (Map.Entry<String, Game> gameEntry : games.entrySet()) {
56-
for (Map.Entry<String, Long> items : gameEntry.getValue().itemNameToId.entrySet()) {
57-
itemIdToName.put(items.getValue(), items.getKey());
58-
}
59-
}
60-
}
61-
return itemIdToName;
62-
}
63-
64-
public HashMap<Long, String> getItemsForGame(String game) {
65-
HashMap<Long, String> ret = new HashMap<>();
66-
for (Map.Entry<String, Game> gameEntry : games.entrySet()) {
67-
if(!gameEntry.getKey().equals(game)) continue;
68-
for (Map.Entry<String, Long> items : gameEntry.getValue().itemNameToId.entrySet()) {
69-
ret.put(items.getValue(), items.getKey());
70-
}
71-
}
72-
return ret;
73-
}
74-
75-
public HashMap<Long, String> getLocations() {
76-
if(locationIdToName.isEmpty()) {
77-
for (Map.Entry<String, Game> gameEntry : games.entrySet()) {
78-
for (Map.Entry<String, Long> locations : gameEntry.getValue().locationNameToId.entrySet()) {
79-
itemIdToName.put(locations.getValue(), locations.getKey());
80-
}
81-
}
82-
}
83-
return itemIdToName;
84-
}
85-
86-
public HashMap<Long, String> getLocationsForGame(String game) {
87-
HashMap<Long, String> ret = new HashMap<>();
88-
for (Map.Entry<String, Game> gameEntry : games.entrySet()) {
89-
if(!gameEntry.getKey().equals(game)) continue;
90-
for (Map.Entry<String, Long> locations : gameEntry.getValue().locationNameToId.entrySet()) {
91-
ret.put(locations.getValue(), locations.getKey());
92-
}
93-
}
94-
return ret;
49+
public Game getGame(String game) {
50+
return games.get(game);
9551
}
9652

9753

0 commit comments

Comments
 (0)