private ItemStack getSellIcon(PlayerShopOffer offer) { ItemStack icon = new ItemStack(offer.getItem().getItemStack()); icon.setAmount(1); String priceLine = ChatColor.GRAY + getSession().getTranslator().$(ASMessageKey.SHOP_INV_ICON_SELL) + ChatColor.RED + " " + OffersUtils.getFormatedPrice(offer.getPrice()); String amountLine = ChatColor.GRAY + "x" + offer.getItem().getAmount(); String ownerLine = ChatColor.GRAY + shop.getOwnerName(); InventoryUtils.appendLore(icon, priceLine, amountLine, ownerLine); return icon; }
public void updateIcon(int slot) { PlayerShopOffer offer = shop.getOffers().get(slot); if (offer != null) for (PlayerShopOffer o : offer.getItem().getOffers()) inventory.setItem(o.getSlot(), getIcon(o)); }