private CategoryTreeItem(CategoryTreeItem<T> parent, Item<T> item, Marshallable<T> marshallable) { this.parent = parent; this.marshallable = marshallable; this.item = item; this.itemProperty.set(item.getItem()); this.leaf.set(!(item instanceof Category)); }
/** Searches for the entity based on the search criteria and returns result in JSON format */ protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { super.doGet(req, resp); logger.log(Level.INFO, "Obtaining Item listing"); String searchBy = req.getParameter("item-searchby"); String searchFor = req.getParameter("q"); PrintWriter out = resp.getWriter(); if (searchFor == null || searchFor.equals("")) { Iterable<Entity> entities = Item.getAllItems(); out.println(Util.writeJSON(entities)); } else if (searchBy == null || searchBy.equals("name")) { Iterable<Entity> entities = Item.getItem(searchFor); out.println(Util.writeJSON(entities)); } else if (searchBy != null && searchBy.equals("product")) { Iterable<Entity> entities = Item.getItemsForProduct("Item", searchFor); out.println(Util.writeJSON(entities)); } }
@Override public void run(String playerID) { Player player = PlayerConverter.getPlayer(playerID); for (Item theItem : questItems) { QuestItem questItem = theItem.getItem(); int amount = theItem.getAmount(); if (notify) { player.sendMessage( Config.getMessage("items_given") .replaceAll( "%name%", (questItem.getName() != null) ? questItem.getName() : questItem.getMaterial().toString()) .replaceAll("%amount%", String.valueOf(amount)) .replaceAll("&", "§")); } while (amount > 0) { int stackSize; if (amount > 64) { stackSize = 64; } else { stackSize = amount; } ItemStack item = questItem.generateItem(stackSize); HashMap<Integer, ItemStack> left = player.getInventory().addItem(item); for (Integer leftNumber : left.keySet()) { ItemStack itemStack = left.get(leftNumber); if (Utils.isQuestItem(itemStack)) { BetonQuest.getInstance().getDBHandler(playerID).addItem(itemStack, stackSize); } else { player.getWorld().dropItem(player.getLocation(), itemStack); } } amount = amount - stackSize; } } }
private OptionElement createOption(Item item) { return createOption(item.getItem(), item.getDir(), item.getValue(), item.getClassName()); }
public void addItem(Item item, String optionStyle) { insertItem(item.getItem(), item.getDir(), item.getValue(), optionStyle); }
public void addItem(Item item) { insertItem(item.getItem(), item.getDir(), item.getValue(), item.getClassName()); }