forked from MagicBane/Server
Proper parsing of power grants
This commit is contained in:
@@ -350,15 +350,12 @@ public class ItemTemplate {
|
|||||||
item_user_power_action.put(power, arguments);
|
item_user_power_action.put(power, arguments);
|
||||||
}
|
}
|
||||||
|
|
||||||
JSONObject powerGrants = (JSONObject) jsonObject.get("item_power_grant");
|
JSONArray powerGrants = (JSONArray) jsonObject.get("item_power_grant");
|
||||||
|
|
||||||
if (powerGrants.isEmpty() == false) {
|
if (powerGrants.isEmpty() == false) {
|
||||||
|
|
||||||
JSONObject powerGrantEntries = (JSONObject) powerGrants.get("power_granted_powers");
|
for (Object grantedPower : powerGrants) {
|
||||||
|
JSONObject powerGrant = (JSONObject) grantedPower;
|
||||||
for (Object grantedPower : powerGrantEntries.keySet()) {
|
|
||||||
int powerLevel = ((Long) powerGrantEntries.get(grantedPower)).intValue();
|
|
||||||
item_power_grant.put((String) grantedPower, powerLevel);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user