public static JSONStringer getPlayerProducts(JSONStringer json, Player player) { if (json == null) json = new JSONStringer(); json.array(); if (player.getIdAlly() != 0) { Ally ally = player.getAlly(); List<Area> areas = DataAccess.getAllAreas(); synchronized (areas) { for (Area area : areas) if (area.getIdDominatingAlly() == ally.getId() && area.getProduct() != 0) json.value(area.getProduct()); } } json.endArray(); return json; }