mirror of
https://github.com/amalthea-mc/ShopChest.git
synced 2024-11-08 11:41:10 +00: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) {
|
||||
Location loc = shop.getLocation();
|
||||
|
||||
// Don't add shop if shop is already loaded
|
||||
if (shopLocation.containsKey(loc)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
int x = loc.getBlockX() / 16;
|
||||
int z = loc.getBlockZ() / 16;
|
||||
|
||||
// Only add shop if chunk is still loaded
|
||||
if (loc.getWorld().isChunkLoaded(x, z) && shop.create(true)) {
|
||||
// Don't add shop if chunk is no longer loaded
|
||||
if (!loc.getWorld().isChunkLoaded(x, z)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (shop.create(true)) {
|
||||
addShop(shop, false);
|
||||
loadedShops.add(shop);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user