forked from MagicBane/Server
Proper parsing of power grants
This commit is contained in:
@@ -350,13 +350,18 @@ public class ItemTemplate {
|
|||||||
item_user_power_action.put(power, arguments);
|
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) {
|
for (Object grantEntry : powerGrantsArray) {
|
||||||
JSONObject powerGrant = (JSONObject) grantedPower;
|
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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user