Added null check for shop item when updating visibility

This commit is contained in:
Eric 2016-08-20 12:41:27 +02:00
parent 6a96e235a6
commit f76ec6fe2d

View File

@ -83,10 +83,12 @@ public class ShopItemListener implements Listener {
for (Shop shop : shopUtils.getShops()) { for (Shop shop : shopUtils.getShops()) {
Location shopLocation = shop.getLocation(); Location shopLocation = shop.getLocation();
if (w.equals(shopLocation.getWorld()) && shopLocation.distanceSquared(playerLocation) <= itemDistanceSquared) { if (w.equals(shopLocation.getWorld()) && shopLocation.distanceSquared(playerLocation) <= itemDistanceSquared) {
if (reset) shop.getItem().resetForPlayer(p); if (shop.getItem() != null) {
else shop.getItem().setVisible(p, true); if (reset) shop.getItem().resetForPlayer(p);
else shop.getItem().setVisible(p, true);
}
} else if (hideIfAway) { } else if (hideIfAway) {
shop.getItem().setVisible(p, false); if (shop.getItem() != null) shop.getItem().setVisible(p, false);
} }
} }
} }