private ItemStack createItem(int i, JSONArray jsonresult) { if (jsonresult != null) { try { String name = getJsonString(jsonresult, i, "name"); String cate = getJsonString(jsonresult, i, "category"); String url = getJsonString(jsonresult, i, "url"); String price = getJsonString(jsonresult, i, "price"); int id = getJsonInt(jsonresult, i, "id"); String icon; try { icon = getJsonString(jsonresult, i, "iconid"); } catch (Exception e) { icon = "54"; } String currency = getJsonString(jsonresult, i, "currency"); String description = jsonresult.getJSONObject(i).getString("description"); // Create GUI package ShopPackage guiPackage = new ShopPackage(id, name, currency, price, cate, description, url, icon); guiPackage.create(); return guiPackage.getItem(); } catch (Exception e) { Log.log(e); } } return null; }
private void clearCache() { if (guiHub != null) { guiHub.clear(); } ShopCategory.removeAll(); ShopPackage.removeAll(); }