Skip to content
Open
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
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,9 @@

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.function.Function;
import java.util.regex.Matcher;
Expand Down Expand Up @@ -338,6 +340,50 @@ private ConsoleCommandInterpreter() {
System.out.println("POI Names - Types\n" + String.join("\n", poiNames));
return "POI lists dumped to stdout.";
});
registerCommand(new String[]{"reveal"}, s -> {
WorldSave save = WorldSave.getCurrentSave();
if (save == null || save.getWorld() == null) {
return "No world loaded.";
}
if (s.length < 1) {
return "Please specify at least one PointOfInterest type (e.g. \"reveal cave\", \"reveal dungeon\", \"reveal town\", \"reveal capital\").";
}
HashSet<String> types = new HashSet<>();
for (String type : s) {
String normalized = type.toLowerCase();
if (normalized.endsWith("ies")) {
normalized = normalized.substring(0, normalized.length() - 3) + "y";
} else if (normalized.endsWith("s") && normalized.length() > 1) {
normalized = normalized.substring(0, normalized.length() - 1);
}
Comment on lines +354 to +358
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think including logic for normalizing plurals and synonyms is a bit excessive for a developer console.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don’t see this as adding “smart” logic to the console — just making it less brittle.
The previous review itself referred to the town POI as a “city,” which highlights the core issue: even contributors don’t reliably remember the exact internal identifiers. Requiring exact string matches makes the console fragile and forces people to look up data definitions.
The normalization here is intentionally minimal (simple plurals and a few explicit aliases like city → town). It’s not general NLP — just a thin layer to prevent avoidable friction.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The previous review itself referred to the town POI as a “city,” which highlights the core issue: even contributors don’t reliably remember the exact internal identifiers. Requiring exact string matches makes the console fragile and forces people to look up data definitions.

The previous review wasn't from a contributor. As far as I can tell, that was their first comment on any Forge PR or issue.

I generally agree that having to look these kinds of parameters up is annoying, but haven't you resolved that by including the list of examples in your error message?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see. My mistake.

That’s fair. I'll remove the normalization when I get the chance.

if ("city".equals(normalized)) {
normalized = "town";
}
if (!normalized.isEmpty()) {
types.add(normalized);
}
}
if (types.isEmpty()) {
return "Please specify at least one PointOfInterest type (e.g. \"reveal cave\", \"reveal dungeon\", \"reveal town\", \"reveal capital\").";
}
int revealed = 0;
for (PointOfInterest poi : save.getWorld().getAllPointOfInterest()) {
PointOfInterestData data = poi.getData();
if (data == null || data.type == null) {
continue;
}
if (!types.contains(data.type.toLowerCase())) {
continue;
}
if (!save.getPointOfInterestChanges(poi.getID()).isVisited()) {
save.getPointOfInterestChanges(poi.getID()).visit();
revealed++;
}
}
ArrayList<String> sortedTypes = new ArrayList<>(types);
Collections.sort(sortedTypes);
return "Revealed " + revealed + " " + String.join("/", sortedTypes) + " names on the map.";
});
registerCommand(new String[]{"setColorID"}, s -> {
if (s.length < 1)
return "Please specify color ID: Valid choices: B, G, R, U, W, C. Example:\n\"setColorID G\"";
Expand Down