mirror of
https://github.com/amalthea-mc/ShopChest.git
synced 2024-11-10 04:31:06 +00:00
Added null check for shop item when updating visibility
This commit is contained in:
parent
6a96e235a6
commit
f76ec6fe2d
@ -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 (shop.getItem() != null) {
|
||||||
if (reset) shop.getItem().resetForPlayer(p);
|
if (reset) shop.getItem().resetForPlayer(p);
|
||||||
else shop.getItem().setVisible(p, true);
|
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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user