From d8ed01a7e4cea4b22dc0467cf0005405cfd4feae Mon Sep 17 00:00:00 2001 From: jho5245 Date: Sat, 16 Nov 2019 22:39:48 +0900 Subject: [PATCH] Differentiated cancel message I've tested this. as you said this wasn't a bug. and now fixed it! Former-commit-id: 6271af2d789568871fafaee6dfbac70fb5ab0805 [formerly 9201e18e60d85a04e4ad29e2aa59c008f01d1cf3] Former-commit-id: 89729f12106658be1306d1a24a0dc85a43550388 --- .../maxgamer/quickshop/Shop/ShopManager.java | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/src/main/java/org/maxgamer/quickshop/Shop/ShopManager.java b/src/main/java/org/maxgamer/quickshop/Shop/ShopManager.java index c7d35cf98..7103d8345 100644 --- a/src/main/java/org/maxgamer/quickshop/Shop/ShopManager.java +++ b/src/main/java/org/maxgamer/quickshop/Shop/ShopManager.java @@ -838,19 +838,21 @@ public class ShopManager { if (info == null) { return; // multithreaded means this can happen } - if (info.getLocation().getWorld() != p.getLocation().getWorld()) { - p.sendMessage(MsgUtil.getMessage("shop-creation-cancelled", p)); - return; - } - if (info.getLocation().distanceSquared(p.getLocation()) > 25) { - p.sendMessage(MsgUtil.getMessage("shop-creation-cancelled", p)); - return; - } + + boolean cancelAction = info.getLocation().distanceSquared(p.getLocation()) > 25 || info.getLocation().getWorld() != p.getLocation().getWorld(); switch (info.getAction()) { case CREATE: + if (cancelAction) { + p.sendMessage(MsgUtil.getMessage("shop-creation-cancelled", p)); + return; + } actionCreate(p, actions, info, message, bypassProtectionChecks); break; case BUY: + if (cancelAction) { + p.sendMessage(MsgUtil.getMessage("shop-purchase-cancelled", p)); + return; + } actionTrade(p, actions, info, message); break; case CANCELLED: