From a84e760f72191dc0a6bc8a4852cbfc52c495dc96 Mon Sep 17 00:00:00 2001 From: Ghost_chu <2908803755@qq.com> Date: Mon, 26 Aug 2019 16:13:01 +0800 Subject: [PATCH] Optimize performance when nor cross the chunk detection Former-commit-id: 518d3413d742242b06834f7f6075194960563296 [formerly cc77f3372ef1b61940deda6fa255cc1ee775c422] Former-commit-id: aa67e5e4ba9ec3eef8094f75d469351d19ad7ee7 --- .../java/org/maxgamer/quickshop/Shop/ShopManager.java | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/main/java/org/maxgamer/quickshop/Shop/ShopManager.java b/src/main/java/org/maxgamer/quickshop/Shop/ShopManager.java index 6209f5b78..7e7540a07 100644 --- a/src/main/java/org/maxgamer/quickshop/Shop/ShopManager.java +++ b/src/main/java/org/maxgamer/quickshop/Shop/ShopManager.java @@ -664,11 +664,13 @@ public class ShopManager { } Block attachedBlock = Util.getAttached(loc.getBlock()); if (attachedBlock != null) { - HashMap inChunkB = getShops(attachedBlock.getLocation().getChunk()); - if(inChunkB == null){ - return null; + if(!attachedBlock.getChunk().equals(loc.getChunk())){ + HashMap inChunkB = getShops(attachedBlock.getLocation().getChunk()); + if(inChunkB == null){ + return null; + } + return inChunkB.get(attachedBlock.getLocation()); } - return inChunkB.get(attachedBlock.getLocation()); } return null; }