From 092bdbe4d7636a915ec6f9ebe8faea032c3d446a Mon Sep 17 00:00:00 2001 From: Ghost_chu <2908803755@qq.com> Date: Sat, 25 May 2019 22:21:38 +0800 Subject: [PATCH] fixed lock issues Former-commit-id: dd609abbc99f82468aef18bc67e96078f3d73ff2 [formerly 81b130cc9f64a4898d118bad1a900fb5b979e188] Former-commit-id: 54c2cbaf4fe9f2843ac7b367ffcdeefe80d898c1 --- .../org/maxgamer/quickshop/Listeners/LockListener.java | 8 ++++++-- src/main/java/org/maxgamer/quickshop/Util/Util.java | 4 ++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/main/java/org/maxgamer/quickshop/Listeners/LockListener.java b/src/main/java/org/maxgamer/quickshop/Listeners/LockListener.java index e554a5610..eccf6cd99 100644 --- a/src/main/java/org/maxgamer/quickshop/Listeners/LockListener.java +++ b/src/main/java/org/maxgamer/quickshop/Listeners/LockListener.java @@ -36,11 +36,15 @@ public class LockListener implements Listener { // Make sure they're not using the non-shop half of a double chest. if (shop == null) { b = Util.getSecondHalf(b); - if (b == null) + if (b == null) { + Util.debugLog(this.getClass(), "onClick","Another side block is null"); return; + } shop = plugin.getShopManager().getShop(b.getLocation()); - if (shop == null) + if (shop == null) { + Util.debugLog(this.getClass(), "onClick","Another side block is non shop"); return; + } } if (!shop.getModerator().isModerator(p.getUniqueId())) { if (p.hasPermission("quickshop.other.open")) { diff --git a/src/main/java/org/maxgamer/quickshop/Util/Util.java b/src/main/java/org/maxgamer/quickshop/Util/Util.java index 305032616..5d5cf946f 100644 --- a/src/main/java/org/maxgamer/quickshop/Util/Util.java +++ b/src/main/java/org/maxgamer/quickshop/Util/Util.java @@ -233,12 +233,12 @@ public class Util { Util.debugLog(Util.class, "getSecondHalf","Right should at "+ rightC.getLocation().toString()); if(equalsBlockStateLocation(oneSideOfChest.getLocation(), rightC.getLocation())) { Util.debugLog(Util.class, "getSecondHalf", "Right founded"); - return rightC.getBlock(); + return leftC.getBlock(); } if(equalsBlockStateLocation(oneSideOfChest.getLocation(), leftC.getLocation())) { Util.debugLog(Util.class, "getSecondHalf", "Left founded"); - return leftC.getBlock(); + return rightC.getBlock(); } return null;