From b3b1c6225a8cd3f5cd678cfa2c4efe9faf536242 Mon Sep 17 00:00:00 2001 From: Ghost_chu <2908803755@qq.com> Date: Sun, 18 Aug 2019 22:40:09 +0800 Subject: [PATCH] Null economy system detect Former-commit-id: 6f0f5e85662475cd5dcade7c74c55e688be3be6f [formerly e452e99b3c16026056453a95a9ca4cebceb33500] Former-commit-id: a7773a1a9bb8a9398a9341b6ddd847c86bd3a4df --- .../maxgamer/quickshop/Shop/ShopManager.java | 20 +++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/src/main/java/org/maxgamer/quickshop/Shop/ShopManager.java b/src/main/java/org/maxgamer/quickshop/Shop/ShopManager.java index c43f83260..4d7a23d90 100644 --- a/src/main/java/org/maxgamer/quickshop/Shop/ShopManager.java +++ b/src/main/java/org/maxgamer/quickshop/Shop/ShopManager.java @@ -42,6 +42,10 @@ public class ShopManager { @SuppressWarnings("deprecation") private void actionBuy(@NotNull Player p, @NotNull HashMap actions2, @NotNull Info info, @NotNull String message, @NotNull Shop shop, int amount) { + if(plugin.getEconomy() == null){ + p.sendMessage("Error: Economy system not loaded, type /qs main command to get details."); + return; + } if (!Util.canBeShop(info.getLocation().getBlock())) { p.sendMessage(MsgUtil.getMessage("chest-was-removed")); return; @@ -136,6 +140,10 @@ public class ShopManager { @SuppressWarnings("deprecation") private void actionCreate(@NotNull Player p, @NotNull HashMap actions2, @NotNull Info info, @NotNull String message, boolean bypassProtectionChecks) { + if(plugin.getEconomy() == null){ + p.sendMessage("Error: Economy system not loaded, type /qs main command to get details."); + return; + } Util.debugLog("actionCreate"); try { // Checking the shop can be created @@ -144,7 +152,7 @@ public class ShopManager { if (!bypassProtectionChecks) { plugin.getCompatibilityTool().toggleProtectionListeners(false, p); - if (!plugin.getPermissionChecker().canBuild(p, info.getLocation(), false)) { + if (!plugin.getPermissionChecker().canBuild(p, info.getLocation())) { p.sendMessage(MsgUtil.getMessage("no-permission") + ": BUILD CHECK"); Util.debugLog("Failed to create shop: Protection check failed:"); for (RegisteredListener belisteners : BlockBreakEvent.getHandlerList().getRegisteredListeners()) { @@ -279,6 +287,10 @@ public class ShopManager { } private void actionSell(@NotNull Player p, @NotNull HashMap actions2, @NotNull Info info, @NotNull String message, @NotNull Shop shop, int amount) { + if(plugin.getEconomy() == null){ + p.sendMessage("Error: Economy system not loaded, type /qs main command to get details."); + return; + } if (!Util.canBeShop(info.getLocation().getBlock())) { p.sendMessage(MsgUtil.getMessage("chest-was-removed")); return; @@ -370,6 +382,10 @@ public class ShopManager { } private void actionTrade(@NotNull Player p, @NotNull HashMap actions, @NotNull Info info, @NotNull String message) { + if(plugin.getEconomy() == null){ + p.sendMessage("Error: Economy system not loaded, type /qs main command to get details."); + return; + } int amount; try { amount = Integer.parseInt(message); @@ -478,7 +494,7 @@ public class ShopManager { return false; } } - if (!plugin.getPermissionChecker().canBuild(p, b, false)) { + if (!plugin.getPermissionChecker().canBuild(p, b)) { Util.debugLog("PermissionChecker canceled shop creation"); return false; }