From b068395a5119cb520807a95e4bc91365d4760506 Mon Sep 17 00:00:00 2001 From: Brianna O'Keefe Date: Mon, 18 Mar 2019 14:43:29 -0400 Subject: [PATCH] Fixed auto selling to work in all slots. --- .gitlab-ci.yml | 2 +- .../hopper/levels/modules/ModuleAutoSell.java | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index f3ad8ad..a16e73e 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -4,7 +4,7 @@ stages: variables: name: "EpicHoppers" path: "/builds/Songoda/$name" - version: "3.5.8" + version: "3.5.9" build: stage: build diff --git a/EpicHoppers-Plugin/src/main/java/com/songoda/epichoppers/hopper/levels/modules/ModuleAutoSell.java b/EpicHoppers-Plugin/src/main/java/com/songoda/epichoppers/hopper/levels/modules/ModuleAutoSell.java index f36b4fd..8b15744 100644 --- a/EpicHoppers-Plugin/src/main/java/com/songoda/epichoppers/hopper/levels/modules/ModuleAutoSell.java +++ b/EpicHoppers-Plugin/src/main/java/com/songoda/epichoppers/hopper/levels/modules/ModuleAutoSell.java @@ -41,7 +41,7 @@ public class ModuleAutoSell implements Module { RegisteredServiceProvider rsp = instance.getServer().getServicesManager().getRegistration(net.milkbowl.vault.economy.Economy.class); net.milkbowl.vault.economy.Economy econ = rsp.getProvider(); - List list = (List) EpicHoppersPlugin.getInstance().getConfig().getList("Main.AutoSell Prices"); + List list = instance.getConfig().getStringList("Main.AutoSell Prices"); for (String line : list) { try { @@ -51,10 +51,10 @@ public class ModuleAutoSell implements Module { double price = Double.valueOf(split[1]); for (ItemStack itemStack : hopperBlock.getInventory().getContents()) { - if (itemStack.getType() == material) { - econ.depositPlayer(Bukkit.getOfflinePlayer(hopper.getPlacedBy()), price * itemStack.getAmount()); - hopperBlock.getInventory().removeItem(itemStack); - } + if (itemStack == null || itemStack.getType() != material) continue; + + econ.depositPlayer(Bukkit.getOfflinePlayer(hopper.getPlacedBy()), price * itemStack.getAmount()); + hopperBlock.getInventory().removeItem(itemStack); } } catch (Exception ignored) { }