mirror of
https://github.com/Flowsqy/ShopChest.git
synced 2024-11-14 23:15:10 +01:00
Only add shop if not already loaded
This commit is contained in:
parent
26025ef64a
commit
c681a9fe31
@ -313,11 +313,21 @@ public class ShopUtils {
|
|||||||
|
|
||||||
for (Shop shop : result) {
|
for (Shop shop : result) {
|
||||||
Location loc = shop.getLocation();
|
Location loc = shop.getLocation();
|
||||||
|
|
||||||
|
// Don't add shop if shop is already loaded
|
||||||
|
if (shopLocation.containsKey(loc)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
int x = loc.getBlockX() / 16;
|
int x = loc.getBlockX() / 16;
|
||||||
int z = loc.getBlockZ() / 16;
|
int z = loc.getBlockZ() / 16;
|
||||||
|
|
||||||
// Only add shop if chunk is still loaded
|
// Don't add shop if chunk is no longer loaded
|
||||||
if (loc.getWorld().isChunkLoaded(x, z) && shop.create(true)) {
|
if (!loc.getWorld().isChunkLoaded(x, z)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (shop.create(true)) {
|
||||||
addShop(shop, false);
|
addShop(shop, false);
|
||||||
loadedShops.add(shop);
|
loadedShops.add(shop);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user