From 103662c5325ca1c55897afe7bb2732a44ef7f44d Mon Sep 17 00:00:00 2001 From: Eric Date: Wed, 23 Nov 2016 16:11:07 +0100 Subject: [PATCH] Add support for per-world-economy plugins The money will be withdrawn or deposited on the world of the shop --- .../shopchest/listeners/ShopInteractListener.java | 14 +++++++++----- 1 file changed, 9 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 93dc062..8db2da3 100644 --- a/src/main/java/de/epiceric/shopchest/listeners/ShopInteractListener.java +++ b/src/main/java/de/epiceric/shopchest/listeners/ShopInteractListener.java @@ -445,7 +445,7 @@ public class ShopInteractListener implements Listener { plugin.debug("Create event cancelled (#" + id + ")"); return; } - EconomyResponse r = plugin.getEconomy().withdrawPlayer(executor, creationPrice); + EconomyResponse r = plugin.getEconomy().withdrawPlayer(executor, location.getWorld().getName(), creationPrice); if (!r.transactionSuccess()) { plugin.debug("Economy transaction failed: " + r.errorMessage); executor.sendMessage(LanguageUtils.getMessage(LocalizedMessage.Message.ERROR_OCCURRED, new LocalizedMessage.ReplacedRegex(Regex.ERROR, r.errorMessage))); @@ -645,10 +645,12 @@ public class ShopInteractListener implements Listener { ItemStack newProduct = new ItemStack(product); newProduct.setAmount(newAmount); - EconomyResponse r = econ.withdrawPlayer(executor, newPrice); + String worldName = shop.getLocation().getWorld().getName(); + + EconomyResponse r = econ.withdrawPlayer(executor, worldName, newPrice); if (r.transactionSuccess()) { - EconomyResponse r2 = (shop.getShopType() != ShopType.ADMIN) ? econ.depositPlayer(shop.getVendor(), newPrice) : null; + EconomyResponse r2 = (shop.getShopType() != ShopType.ADMIN) ? econ.depositPlayer(shop.getVendor(), worldName, newPrice) : null; if (r2 != null) { if (r2.transactionSuccess()) { @@ -776,10 +778,12 @@ public class ShopInteractListener implements Listener { ItemStack newProduct = new ItemStack(product); newProduct.setAmount(newAmount); - EconomyResponse r = econ.depositPlayer(executor, newPrice); + String worldName = shop.getLocation().getWorld().getName(); + + EconomyResponse r = econ.depositPlayer(executor, worldName, newPrice); if (r.transactionSuccess()) { - EconomyResponse r2 = (shop.getShopType() != ShopType.ADMIN) ? econ.withdrawPlayer(shop.getVendor(), newPrice) : null; + EconomyResponse r2 = (shop.getShopType() != ShopType.ADMIN) ? econ.withdrawPlayer(shop.getVendor(), worldName, newPrice) : null; if (r2 != null) { if (r2.transactionSuccess()) {