Fixed NoSuchMethodError on 1.8

This commit is contained in:
Eric 2017-06-27 21:57:17 +02:00
parent bbd0046ed1
commit 8533c017e7

View File

@ -96,11 +96,16 @@ public class ShopInteractListener implements Listener {
Inventory chestInv = e.getInventory(); 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; 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); final Shop shop = plugin.getShopUtils().getShop(loc);
if (shop == null) return; if (shop == null) return;