From fdc578891e0960811b8998b29d33ee4b58befc94 Mon Sep 17 00:00:00 2001 From: Ghost_chu <2908803755@qq.com> Date: Thu, 2 Aug 2018 13:49:42 +0800 Subject: [PATCH] Add ShopManager i18n support Former-commit-id: 8105124ea74f2dae32e9e569c6b4265e67cd69e3 --- .../org/maxgamer/quickshop/Shop/ShopManager.java | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/main/java/org/maxgamer/quickshop/Shop/ShopManager.java b/src/main/java/org/maxgamer/quickshop/Shop/ShopManager.java index 76fc2546e..56166389c 100644 --- a/src/main/java/org/maxgamer/quickshop/Shop/ShopManager.java +++ b/src/main/java/org/maxgamer/quickshop/Shop/ShopManager.java @@ -368,7 +368,7 @@ public class ShopManager { /* The shop has hereforth been successfully created */ createShop(shop); Location loc = shop.getLocation(); - plugin.log(p.getName() + " created a " + shop.getDataName() + " shop at (" + loc.getWorld().getName() + " - " + loc.getX() + "," + loc.getY() + "," + loc.getZ() + ")"); + plugin.log(p.getName() + " created a " + MsgUtil.getItemi18n(shop.getDataName()) + " shop at (" + loc.getWorld().getName() + " - " + loc.getX() + "," + loc.getY() + "," + loc.getZ() + ")"); if (!plugin.getConfig().getBoolean("shop.lock")) { // Warn them if they haven't been warned since // reboot @@ -435,6 +435,7 @@ public class ShopManager { return; } } + /* Purchase Handling */ else if (info.getAction() == ShopAction.BUY) { if(QuickShop.debug) {plugin.getLogger().info("Economy debug:Starting buy");} @@ -521,9 +522,9 @@ public class ShopManager { } // Notify the shop owner if (plugin.getConfig().getBoolean("show-tax")) { - String msg = MsgUtil.getMessage("player-bought-from-your-store-tax", p.getName(), "" + amount, shop.getDataName(), Util.format((tax * total))); + String msg = MsgUtil.getMessage("player-bought-from-your-store-tax", p.getName(), "" + amount, MsgUtil.getItemi18n(shop.getDataName()), Util.format((tax * total))); if (stock == amount) - msg += "\n" + MsgUtil.getMessage("shop-out-of-stock", "" + shop.getLocation().getBlockX(), "" + shop.getLocation().getBlockY(), "" + shop.getLocation().getBlockZ(), shop.getDataName()); + msg += "\n" + MsgUtil.getMessage("shop-out-of-stock", "" + shop.getLocation().getBlockX(), "" + shop.getLocation().getBlockY(), "" + shop.getLocation().getBlockZ(), MsgUtil.getItemi18n(shop.getDataName())); MsgUtil.send(shop.getOwner(), msg); } else { String msg = MsgUtil.getMessage("player-bought-from-your-store", p.getName(), "" + amount, shop.getDataName()); @@ -540,13 +541,13 @@ public class ShopManager { } else if (shop.isBuying()) { int space = shop.getRemainingSpace(); if (space < amount) { - p.sendMessage(MsgUtil.getMessage("shop-has-no-space", "" + space, shop.getDataName())); + p.sendMessage(MsgUtil.getMessage("shop-has-no-space", "" + space, MsgUtil.getItemi18n(shop.getDataName()))); return; } int count = Util.countItems(p.getInventory(), shop.getItem()); // Not enough items if (amount > count) { - p.sendMessage(MsgUtil.getMessage("you-dont-have-that-many-items", "" + count, shop.getDataName())); + p.sendMessage(MsgUtil.getMessage("you-dont-have-that-many-items", "" + count, MsgUtil.getItemi18n(shop.getDataName()))); return; } if (amount == 0) { @@ -598,7 +599,7 @@ public class ShopManager { boolean depositresult = plugin.getEcon().deposit(p.getUniqueId(), total * (1 - tax)); if(QuickShop.debug) {plugin.getLogger().info("Economy debug:deposit2 in shopmanager result:"+depositresult);} // Notify the owner of the purchase. - String msg = MsgUtil.getMessage("player-sold-to-your-store", p.getName(), "" + amount, shop.getDataName()); + String msg = MsgUtil.getMessage("player-sold-to-your-store", p.getName(), "" + amount, MsgUtil.getItemi18n(shop.getDataName())); if (space == amount) msg += "\n" + MsgUtil.getMessage("shop-out-of-space", "" + shop.getLocation().getBlockX(), "" + shop.getLocation().getBlockY(), "" + shop.getLocation().getBlockZ()); MsgUtil.send(shop.getOwner(), msg);