From c681a9fe31e7351a8097608250325c901b4d871d Mon Sep 17 00:00:00 2001 From: Eric Date: Mon, 24 Feb 2020 20:32:22 +0100 Subject: [PATCH] Only add shop if not already loaded --- .../de/epiceric/shopchest/utils/ShopUtils.java | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/main/java/de/epiceric/shopchest/utils/ShopUtils.java b/src/main/java/de/epiceric/shopchest/utils/ShopUtils.java index 3ee7b35..c477562 100644 --- a/src/main/java/de/epiceric/shopchest/utils/ShopUtils.java +++ b/src/main/java/de/epiceric/shopchest/utils/ShopUtils.java @@ -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); }