Skip to content
This repository has been archived by the owner on Dec 5, 2021. It is now read-only.

Commit

Permalink
Fix #360
Browse files Browse the repository at this point in the history
Former-commit-id: 14950ef
  • Loading branch information
sandtechnology committed Mar 7, 2020
1 parent 69b6445 commit ea59893
Showing 1 changed file with 21 additions and 16 deletions.
37 changes: 21 additions & 16 deletions src/main/java/org/maxgamer/quickshop/Shop/ShopManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
import org.bukkit.block.Block;
import org.bukkit.block.BlockFace;
import org.bukkit.block.BlockState;
import org.bukkit.block.Sign;
import org.bukkit.block.data.Waterlogged;
import org.bukkit.block.data.type.WallSign;
import org.bukkit.entity.Player;
Expand Down Expand Up @@ -358,22 +359,26 @@ public void createShop(@NotNull Shop shop, @NotNull Info info) {
// Oooops, no any shops matched.
}
}
// 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) {
// Nope
return null;
} 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) {
shop = inChunk.get(attachedBlock.getLocation());
// Okay, shop was founded.
return shop;
// Oooops, no any shops matched.

//only check if is sign
if(loc.getBlock().getState() instanceof Sign) {
// 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) {
// Nope
return null;
} 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) {
shop = inChunk.get(attachedBlock.getLocation());
// Okay, shop was founded.
return shop;
// Oooops, no any shops matched.
}
}
}
return null;
Expand Down

0 comments on commit ea59893

Please sign in to comment.