Add ShopManager i18n support

Former-commit-id: 8105124ea74f2dae32e9e569c6b4265e67cd69e3
This commit is contained in:
Ghost_chu committed 2018-08-02 13:49:42 +08:00
1 parent 73344fe332
commit fdc578891e
1 file changed
+7 -6
@@ -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);