From 8533c017e7ec150c3c4f4f99f0045ea4589e457a Mon Sep 17 00:00:00 2001 From: Eric Date: Tue, 27 Jun 2017 21:57:17 +0200 Subject: [PATCH] Fixed NoSuchMethodError on 1.8 --- .../shopchest/listeners/ShopInteractListener.java | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/main/java/de/epiceric/shopchest/listeners/ShopInteractListener.java b/src/main/java/de/epiceric/shopchest/listeners/ShopInteractListener.java index 2bca586..5cf690a 100644 --- a/src/main/java/de/epiceric/shopchest/listeners/ShopInteractListener.java +++ b/src/main/java/de/epiceric/shopchest/listeners/ShopInteractListener.java @@ -96,11 +96,16 @@ public class ShopInteractListener implements Listener { Inventory chestInv = e.getInventory(); - if (!(e.getInventory().getHolder() instanceof Chest || e.getInventory().getHolder() instanceof DoubleChest)) { + if (!(chestInv.getHolder() instanceof Chest || chestInv.getHolder() instanceof DoubleChest)) { return; } - Location loc = chestInv.getLocation(); + Location loc = null; + if (chestInv.getHolder() instanceof Chest) { + loc = ((Chest) chestInv.getHolder()).getLocation(); + } else if (chestInv.getHolder() instanceof DoubleChest) { + loc = ((DoubleChest) chestInv.getHolder()).getLocation(); + } final Shop shop = plugin.getShopUtils().getShop(loc); if (shop == null) return;