Optimize performance when nor cross the chunk detection

Former-commit-id: 518d3413d742242b06834f7f6075194960563296 [formerly cc77f3372ef1b61940deda6fa255cc1ee775c422]
Former-commit-id: aa67e5e4ba9ec3eef8094f75d469351d19ad7ee7
This commit is contained in:
Ghost_chu committed 2019-08-26 16:13:01 +08:00
1 parent c47a41da05
commit a84e760f72
1 file changed
+6 -4
@@ -664,11 +664,13 @@ public class ShopManager {
}
Block attachedBlock = Util.getAttached(loc.getBlock());
if (attachedBlock != null) {
HashMap<Location, Shop> inChunkB = getShops(attachedBlock.getLocation().getChunk());
if(inChunkB == null){
return null;
if(!attachedBlock.getChunk().equals(loc.getChunk())){
HashMap<Location, Shop> inChunkB = getShops(attachedBlock.getLocation().getChunk());
if(inChunkB == null){
return null;
}
return inChunkB.get(attachedBlock.getLocation());
}
return inChunkB.get(attachedBlock.getLocation());
}
return null;
}