In SettingsAPI, please change
Collection<Object> getAllSpecs(Class c);
to
<SPEC> Collection<SPEC> getAllSpecs(Class<SPEC> c);
Use case:
final Collection<Object> specs = settings.getAllSpecs(DropGroupRow.class);
for (final Object spec : specs) {
final DropGroupRow dropGroupRow = (DropGroupRow) spec;
is simplified to
final Collection<DropGroupRow> specs = settings.getAllSpecs(DropGroupRow.class);
for (final DropGroupRow dropGroupRow : specs) {
Please add a base interface for SpecAPIs that contains e.g. the tag handling methods #hasTag(String), #addTag(String), etc.
Use case: Currently code to process tags has to be duplicated for each SpecAPI interface. Note that starting from Java 8, Method References could be used to circumvent this issue (create method parameter Predicate<String> hasTags and pass WeaponSpecAPI::hasTags into it, etc.), but even there just having a common ancestor would be the tidiest solution.
Please remove magical implicit "no_drop" / "no_dealer" functionality from ShipTypeHints.STATION (and actually add these tags to the derelict mothership, like on the Merlon) - currently I have to check for this hint to filter the Explorarium mothership from unobtainable ship specs, because it magically does not need these tags and thence does not have them.
Please add constant for "package_bp" to Items, e.g.
public static final String TAG_BLUEPRINT_PACKAGE = "package_bp";
Please add constant for the "tags" field to... unsure, presumably Tags, e.g.
/** If something can have tags, they will be found in a field of this name. */
public static final String FIELD_IDENTIFIER = "tags";
Please add outer braces to drop_groups.csv column "commodity" so it can be readily parsed using org.util.JSONObject.
E.g. change
wpn_:{tags:[omega, !no_drop], weaponSize:SMALL}
to
{wpn_:{tags:[omega, !no_drop], weaponSize:SMALL}}
Use case:
final JSONObject json = new JSONObject("{" + dropGroupRow.getCommodity() + "}");
final JSONObject item = json.getJSONObject(DropGroupRow.ITEM_PREFIX);
final JSONArray tags = item.getJSONArray(DROP_GROUP_COMMODITY_TAGS);
for (int i = 0; i < tags.length(); ++i) {
final String tag = tags.getString(i);
if (BLUEPRINT_PACKAGE_TAG.equals(tag)) {
dropGroupRow.setFreq(dropGroupRow.getFreq() / 2.f);
break;
}
}
is simplified to
final JSONObject json = new JSONObject(dropGroupRow.getCommodity());
final JSONObject item = json.getJSONObject(DropGroupRow.ITEM_PREFIX);
final JSONArray tags = item.getJSONArray(DROP_GROUP_COMMODITY_TAGS);
for (int i = 0; i < tags.length(); ++i) {
final String tag = tags.getString(i);
if (BLUEPRINT_PACKAGE_TAG.equals(tag)) {
dropGroupRow.setFreq(dropGroupRow.getFreq() / 2.f);
break;
}
}
It is currently too easy to fall into the trap of trying to parse the commodity manually (source: I did and just now realised how stupid I was being), when it is
almost perfectly good JSON. E.g. finding "item_" without also finding "item_modspec" while correctly handling all whitespaces is
a challenge manually, but a trivial task using JSONObject.