Update SellerMinion.java

master
Logan Barrett 2019-09-01 23:22:39 +07:00
parent 356a75634b
commit cb3332a9cb
1 changed files with 9 additions and 5 deletions

@ -50,11 +50,15 @@ public class SellerMinion extends Minion {
for (int i = 0; i < chest.getInventory().getSize(); i++) {
final ItemStack item = chest.getInventory().getItem(i);
if (item == null || item.getType() == Material.AIR) continue;
double sellPrice = MinionsPlus.getEssentials().getWorth().getPrice(MinionsPlus.getEssentials(), item).doubleValue();
if (sellPrice <= 0) continue;
MinionsPlus.getEcon().depositPlayer(Bukkit.getOfflinePlayer(getOwner()), sellPrice * item.getAmount());
chest.getInventory().setItem(i, new ItemStack(Material.AIR));
sold = true;
try {
double sellPrice = MinionsPlus.getEssentials().getWorth().getPrice(MinionsPlus.getEssentials(), item).doubleValue();
if (sellPrice <= 0) continue;
MinionsPlus.getEcon().depositPlayer(Bukkit.getOfflinePlayer(getOwner()), sellPrice * item.getAmount());
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());
}
}
}
}