|
|
@ -50,11 +50,15 @@ public class SellerMinion extends Minion {
|
|
|
|
for (int i = 0; i < chest.getInventory().getSize(); i++) {
|
|
|
|
for (int i = 0; i < chest.getInventory().getSize(); i++) {
|
|
|
|
final ItemStack item = chest.getInventory().getItem(i);
|
|
|
|
final ItemStack item = chest.getInventory().getItem(i);
|
|
|
|
if (item == null || item.getType() == Material.AIR) continue;
|
|
|
|
if (item == null || item.getType() == Material.AIR) continue;
|
|
|
|
double sellPrice = MinionsPlus.getEssentials().getWorth().getPrice(MinionsPlus.getEssentials(), item).doubleValue();
|
|
|
|
try {
|
|
|
|
if (sellPrice <= 0) continue;
|
|
|
|
double sellPrice = MinionsPlus.getEssentials().getWorth().getPrice(MinionsPlus.getEssentials(), item).doubleValue();
|
|
|
|
MinionsPlus.getEcon().depositPlayer(Bukkit.getOfflinePlayer(getOwner()), sellPrice * item.getAmount());
|
|
|
|
if (sellPrice <= 0) continue;
|
|
|
|
chest.getInventory().setItem(i, new ItemStack(Material.AIR));
|
|
|
|
MinionsPlus.getEcon().depositPlayer(Bukkit.getOfflinePlayer(getOwner()), sellPrice * item.getAmount());
|
|
|
|
sold = true;
|
|
|
|
chest.getInventory().setItem(i, new ItemStack(Material.AIR));
|
|
|
|
|
|
|
|
sold = true;
|
|
|
|
|
|
|
|
} catch(final Exception e) {
|
|
|
|
|
|
|
|
Bukkit.getLogger().info("SELLER MINION ERROR: Price not found for " + item.toString());
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|