Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public void sell()
- {
- double moneyToGive = 0.0D;
- for (ItemStack item : this.GUI.getContents()) {
- if (item != null)
- {
- if (!Main.PRICES.containsKey(item.getData().getItemTypeId() + ":" + item.getData().getData())) {
- this.player.getInventory().addItem(new ItemStack[] { item });
- this.player.sendMessage(Utils.getPrefix() + Utils.getCantSell());
- }
- else
- {
- Double sellPrice = Double.valueOf(((Price)Main.PRICES.get(item.getTypeId() + ":" + item.getData().getData())).getSellPrice());
- Integer quantity = ((Price)Main.PRICES.get(item.getTypeId() + ":" + item.getData().getData())).getQuantity();
- Double perEach = Double.valueOf(sellPrice.doubleValue() / quantity.intValue());
- moneyToGive += perEach.doubleValue() * item.getAmount();
- }
- }
- }
- Main.getEconomy().depositPlayer(this.player.getName(), moneyToGive);
- if (moneyToGive > 0.0D) {
- this.player.sendMessage(Utils.getSold() + moneyToGive + Utils.getAdded());
- }
- this.GUI.clear();
- }
- public Inventory getGUI()
- {
- return this.GUI;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement