From 5162bab1a664f066fa02933c17c8a16f873e6f9f Mon Sep 17 00:00:00 2001 From: Benny Dreamly Date: Sat, 11 Oct 2025 20:30:49 -0600 Subject: [PATCH 1/7] add a helper to get the location ID from the name (it's a bit cursed) --- src/main/java/io/github/archipelagomw/LocationManager.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/main/java/io/github/archipelagomw/LocationManager.java b/src/main/java/io/github/archipelagomw/LocationManager.java index 59359b7..ca55b96 100644 --- a/src/main/java/io/github/archipelagomw/LocationManager.java +++ b/src/main/java/io/github/archipelagomw/LocationManager.java @@ -92,4 +92,8 @@ public void setMissingLocations(Set missingLocations) { this.missingLocations.clear(); this.missingLocations.addAll(missingLocations); } + + public long getLocationNameFromID(String locationName){ + return this.client.getDataPackage().getGame(this.client.getGame()).locationNameToId.get(locationName); + } } From 302fa2480f155bb5c366f89050e4f1e795785eb4 Mon Sep 17 00:00:00 2001 From: Benny Dreamly Date: Sat, 11 Oct 2025 20:32:14 -0600 Subject: [PATCH 2/7] add a small docstring --- src/main/java/io/github/archipelagomw/LocationManager.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/main/java/io/github/archipelagomw/LocationManager.java b/src/main/java/io/github/archipelagomw/LocationManager.java index ca55b96..d036684 100644 --- a/src/main/java/io/github/archipelagomw/LocationManager.java +++ b/src/main/java/io/github/archipelagomw/LocationManager.java @@ -93,6 +93,11 @@ public void setMissingLocations(Set missingLocations) { 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. + */ public long getLocationNameFromID(String locationName){ return this.client.getDataPackage().getGame(this.client.getGame()).locationNameToId.get(locationName); } From 0c766f9d319aeb1ea7c03d9088aeb09e9ca7ad5d Mon Sep 17 00:00:00 2001 From: Benny Dreamly Date: Sat, 11 Oct 2025 20:47:18 -0600 Subject: [PATCH 3/7] Fix the javadoc docstring comment --- src/main/java/io/github/archipelagomw/LocationManager.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/main/java/io/github/archipelagomw/LocationManager.java b/src/main/java/io/github/archipelagomw/LocationManager.java index d036684..922b633 100644 --- a/src/main/java/io/github/archipelagomw/LocationManager.java +++ b/src/main/java/io/github/archipelagomw/LocationManager.java @@ -93,10 +93,13 @@ public void setMissingLocations(Set missingLocations) { 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 long getLocationNameFromID(String locationName){ return this.client.getDataPackage().getGame(this.client.getGame()).locationNameToId.get(locationName); From dbdfd5f487e3ecbfaffbe08f29484f76f83f9c4b Mon Sep 17 00:00:00 2001 From: Benny Dreamly Date: Sat, 11 Oct 2025 21:45:17 -0600 Subject: [PATCH 4/7] make the argument optional --- src/main/java/io/github/archipelagomw/LocationManager.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/io/github/archipelagomw/LocationManager.java b/src/main/java/io/github/archipelagomw/LocationManager.java index 922b633..3dd9987 100644 --- a/src/main/java/io/github/archipelagomw/LocationManager.java +++ b/src/main/java/io/github/archipelagomw/LocationManager.java @@ -101,7 +101,7 @@ public void setMissingLocations(Set missingLocations) { @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 long getLocationNameFromID(String locationName){ + public Optional getLocationNameFromID(String locationName){ return this.client.getDataPackage().getGame(this.client.getGame()).locationNameToId.get(locationName); } } From 1595ab0cdfbde7348e1fbe6ace67550af6d94adc Mon Sep 17 00:00:00 2001 From: Benny Dreamly Date: Sat, 11 Oct 2025 21:50:25 -0600 Subject: [PATCH 5/7] make the return sane --- .../java/io/github/archipelagomw/LocationManager.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/main/java/io/github/archipelagomw/LocationManager.java b/src/main/java/io/github/archipelagomw/LocationManager.java index 3dd9987..b5aef7f 100644 --- a/src/main/java/io/github/archipelagomw/LocationManager.java +++ b/src/main/java/io/github/archipelagomw/LocationManager.java @@ -102,6 +102,12 @@ public void setMissingLocations(Set missingLocations) { @return The ID of the location that you have looked up from the datapackage. */ public Optional getLocationNameFromID(String locationName){ - return this.client.getDataPackage().getGame(this.client.getGame()).locationNameToId.get(locationName); + return Optional.ofNullable( + this.client + .getDataPackage() + .getGame(this.client.getGame()) + .locationNameToId + .get(locationName) + ); } } From c8c23045363fc8780f5698a4da8befadbd59dc74 Mon Sep 17 00:00:00 2001 From: Benny D <78334662+benny-dreamly@users.noreply.github.com> Date: Sat, 11 Oct 2025 22:09:29 -0600 Subject: [PATCH 6/7] add the correct mapping Co-authored-by: PlatanoBailando <13842799+cjmang@users.noreply.github.com> --- src/main/java/io/github/archipelagomw/LocationManager.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/main/java/io/github/archipelagomw/LocationManager.java b/src/main/java/io/github/archipelagomw/LocationManager.java index b5aef7f..3c961e4 100644 --- a/src/main/java/io/github/archipelagomw/LocationManager.java +++ b/src/main/java/io/github/archipelagomw/LocationManager.java @@ -106,8 +106,10 @@ public Optional getLocationNameFromID(String locationName){ this.client .getDataPackage() .getGame(this.client.getGame()) - .locationNameToId + ) + .map(game -> game.locationNameToId .get(locationName) + ) ); } } From 3ced9cc20035083465b0a58ee9797439c181763f Mon Sep 17 00:00:00 2001 From: Benny Dreamly Date: Sun, 12 Oct 2025 20:53:50 -0600 Subject: [PATCH 7/7] remove the extra paren --- src/main/java/io/github/archipelagomw/LocationManager.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/main/java/io/github/archipelagomw/LocationManager.java b/src/main/java/io/github/archipelagomw/LocationManager.java index 3c961e4..f74c459 100644 --- a/src/main/java/io/github/archipelagomw/LocationManager.java +++ b/src/main/java/io/github/archipelagomw/LocationManager.java @@ -109,7 +109,6 @@ public Optional getLocationNameFromID(String locationName){ ) .map(game -> game.locationNameToId .get(locationName) - ) - ); + ); } }