Skip to content
Merged
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
19 changes: 19 additions & 0 deletions src/main/java/io/github/archipelagomw/LocationManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -92,4 +92,23 @@ public void setMissingLocations(Set<Long> missingLocations) {
this.missingLocations.clear();
this.missingLocations.addAll(missingLocations);
}

/**
Helper to get the location ID from an inputted location name as a String. Only use this
if you know what you're dealing with, and can accept that getting this from the datapackage
is not 100% reliable.

@param locationName The name of the location you wish to look up.
@return The ID of the location that you have looked up from the datapackage.
*/
public Optional<Long> getLocationNameFromID(String locationName){
return Optional.ofNullable(
this.client
.getDataPackage()
.getGame(this.client.getGame())
)
.map(game -> game.locationNameToId
.get(locationName)
);
}
}