From fd5ebd0921c28baf465323d80fd2d91213c4bdbd Mon Sep 17 00:00:00 2001 From: Eric Date: Sun, 15 Dec 2019 15:35:42 +0100 Subject: [PATCH] Only withdraw creation price if higher than zero Fixes #285 --- .../shopchest/listeners/ShopInteractListener.java | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/main/java/de/epiceric/shopchest/listeners/ShopInteractListener.java b/src/main/java/de/epiceric/shopchest/listeners/ShopInteractListener.java index 32275c0..f6b1d9d 100644 --- a/src/main/java/de/epiceric/shopchest/listeners/ShopInteractListener.java +++ b/src/main/java/de/epiceric/shopchest/listeners/ShopInteractListener.java @@ -484,11 +484,13 @@ public class ShopInteractListener implements Listener { return; } - EconomyResponse r = plugin.getEconomy().withdrawPlayer(executor, location.getWorld().getName(), creationPrice); - if (!r.transactionSuccess()) { - plugin.debug("Economy transaction failed: " + r.errorMessage); - executor.sendMessage(LanguageUtils.getMessage(Message.ERROR_OCCURRED, new Replacement(Placeholder.ERROR, r.errorMessage))); - return; + if (creationPrice > 0) { + EconomyResponse r = plugin.getEconomy().withdrawPlayer(executor, location.getWorld().getName(), creationPrice); + if (!r.transactionSuccess()) { + plugin.debug("Economy transaction failed: " + r.errorMessage); + executor.sendMessage(LanguageUtils.getMessage(Message.ERROR_OCCURRED, new Replacement(Placeholder.ERROR, r.errorMessage))); + return; + } } shop.create(true);