Proper parsing of power grants

This commit is contained in:
2024-04-01 16:12:52 -04:00
parent 82373f8cc8
commit db91b606f6
+9 -4
View File
@@ -350,13 +350,18 @@ public class ItemTemplate {
item_user_power_action.put(power, arguments);
}
JSONArray powerGrants = (JSONArray) jsonObject.get("item_power_grant");
JSONArray powerGrantsArray = (JSONArray) jsonObject.get("item_power_grant");
if (powerGrants.isEmpty() == false) {
if (powerGrantsArray.isEmpty() == false) {
for (Object grantedPower : powerGrants) {
JSONObject powerGrant = (JSONObject) grantedPower;
for (Object grantEntry : powerGrantsArray) {
JSONObject powerGrant = (JSONObject) grantEntry;
for (Object key : powerGrant.keySet()) {
String powerString = (String) key;
int powerLevel = ((Long) powerGrant.get(key)).intValue();
item_power_grant.put(powerString, powerLevel);
}
}
}