Both fixed #188 and #187

Former-commit-id: fec3abeed078e5fbbe2ee4b2afd340007409797d [formerly 1b60dd6daf35e9dea97603934d669ec9fe738881]
Former-commit-id: 34d69eba1a463eb89c994aa9a36471751e7e7a47
This commit is contained in:
Ghost_chu committed 2019-09-30 19:51:53 +08:00
1 parent a1536783ae
commit eb8efe8539
1 file changed
+10 -10
@@ -661,20 +661,20 @@ public class ShopManager {
//Get location's chunk all shops
@Nullable HashMap<Location, Shop> inChunk = getShops(loc.getChunk());
//Found some shops in this chunk.
if(inChunk != null){
if (inChunk != null) {
shop = inChunk.get(loc);
if(shop != null){
if (shop != null) {
//Okay, shop was founded.
return shop;
}
//Ooops, not founded that shop in this chunk.
}
@Nullable Block secondHalfShop = Util.getSecondHalf(loc.getBlock());
if(secondHalfShop != null){
@Nullable Block secondHalfShop = Util.getSecondHalf(loc.getBlock());
if (secondHalfShop != null) {
inChunk = getShops(secondHalfShop.getChunk());
if(inChunk != null){
if (inChunk != null) {
shop = inChunk.get(secondHalfShop.getLocation());
if(shop!=null){
if (shop != null) {
//Okay, shop was founded.
return shop;
}
@@ -684,18 +684,18 @@ public class ShopManager {
//If that chunk nothing we founded, we should check it is attached.
@Nullable Block attachedBlock = Util.getAttached(loc.getBlock());
//Check is attached on some block.
if(attachedBlock == null){
if (attachedBlock == null) {
//Nope
Util.debugLog("No attached block.");
return null;
}else{
} else {
//Okay we know it on some blocks.
//We need set new location and chunk.
inChunk = getShops(attachedBlock.getChunk());
//Found some shops in this chunk
if(inChunk != null){
if (inChunk != null) {
shop = inChunk.get(attachedBlock.getLocation());
if(shop!=null){
if (shop != null) {
//Okay, shop was founded.
return shop;
}