From 26ebb7ab65e00a888086c0a56f2c43f5cfda484f Mon Sep 17 00:00:00 2001 From: sandtechnology Date: Sat, 18 Apr 2020 18:59:03 +0800 Subject: [PATCH] Fix price related bug and shop notice display bug Former-commit-id: 8714e1b5ddd12203b5f4586a747450c143bc695e --- .../quickshop/command/subcommand/SubCommand_Create.java | 2 +- .../command/subcommand/SubCommand_SuperCreate.java | 2 +- .../org/maxgamer/quickshop/event/ShopPurchaseEvent.java | 2 +- .../maxgamer/quickshop/event/ShopSuccessPurchaseEvent.java | 2 +- src/main/java/org/maxgamer/quickshop/shop/ShopManager.java | 6 +++--- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/main/java/org/maxgamer/quickshop/command/subcommand/SubCommand_Create.java b/src/main/java/org/maxgamer/quickshop/command/subcommand/SubCommand_Create.java index 11c4d8b29..f4e022789 100644 --- a/src/main/java/org/maxgamer/quickshop/command/subcommand/SubCommand_Create.java +++ b/src/main/java/org/maxgamer/quickshop/command/subcommand/SubCommand_Create.java @@ -121,7 +121,7 @@ public class SubCommand_Create implements CommandProcesser { } MsgUtil.sendMessage(p, - MsgUtil.getMessage("how-much-to-trade-for", sender, Util.getItemStackName(item))); + MsgUtil.getMessage("how-much-to-trade-for", sender, Util.getItemStackName(item), Integer.toString(item.getAmount()))); return; } diff --git a/src/main/java/org/maxgamer/quickshop/command/subcommand/SubCommand_SuperCreate.java b/src/main/java/org/maxgamer/quickshop/command/subcommand/SubCommand_SuperCreate.java index 670cd0553..78621fad1 100644 --- a/src/main/java/org/maxgamer/quickshop/command/subcommand/SubCommand_SuperCreate.java +++ b/src/main/java/org/maxgamer/quickshop/command/subcommand/SubCommand_SuperCreate.java @@ -112,7 +112,7 @@ public class SubCommand_SuperCreate implements CommandProcesser { plugin.getShopManager().getActions().put(p.getUniqueId(), info); MsgUtil.sendMessage(p, - MsgUtil.getMessage("how-much-to-trade-for", sender, Util.getItemStackName(item))); + MsgUtil.getMessage("how-much-to-trade-for", sender, Util.getItemStackName(item)), Integer.toString(item.getAmount())); return; } MsgUtil.sendMessage(sender, MsgUtil.getMessage("not-looking-at-shop", sender)); diff --git a/src/main/java/org/maxgamer/quickshop/event/ShopPurchaseEvent.java b/src/main/java/org/maxgamer/quickshop/event/ShopPurchaseEvent.java index 9f1d1086d..497a8ff27 100644 --- a/src/main/java/org/maxgamer/quickshop/event/ShopPurchaseEvent.java +++ b/src/main/java/org/maxgamer/quickshop/event/ShopPurchaseEvent.java @@ -51,7 +51,7 @@ public class ShopPurchaseEvent extends QSEvent implements Cancellable { public ShopPurchaseEvent(@NotNull Shop shop, @NotNull Player player, int amount) { this.shop = shop; this.player = player; - this.amount = amount; + this.amount = amount * shop.getItem().getAmount(); } @Override diff --git a/src/main/java/org/maxgamer/quickshop/event/ShopSuccessPurchaseEvent.java b/src/main/java/org/maxgamer/quickshop/event/ShopSuccessPurchaseEvent.java index 0c8c287a8..9deb59084 100644 --- a/src/main/java/org/maxgamer/quickshop/event/ShopSuccessPurchaseEvent.java +++ b/src/main/java/org/maxgamer/quickshop/event/ShopSuccessPurchaseEvent.java @@ -60,7 +60,7 @@ public class ShopSuccessPurchaseEvent extends QSEvent implements Cancellable { @NotNull Shop shop, @NotNull Player player, int amount, double total, double tax) { this.shop = shop; this.player = player; - this.amount = amount; + this.amount = amount * shop.getItem().getAmount(); this.tax = tax; this.total = total; } diff --git a/src/main/java/org/maxgamer/quickshop/shop/ShopManager.java b/src/main/java/org/maxgamer/quickshop/shop/ShopManager.java index 59af4a71f..47f8448d7 100644 --- a/src/main/java/org/maxgamer/quickshop/shop/ShopManager.java +++ b/src/main/java/org/maxgamer/quickshop/shop/ShopManager.java @@ -817,7 +817,7 @@ public class ShopManager { info.getItem().setAmount(1); } - ContainerShop shop = new ContainerShop(plugin, info.getLocation(), CalculateUtil.multiply(price, info.getItem().getAmount()), info.getItem(), new ShopModerator(p.getUniqueId()), false, ShopType.SELLING); + ContainerShop shop = new ContainerShop(plugin, info.getLocation(), price, info.getItem(), new ShopModerator(p.getUniqueId()), false, ShopType.SELLING); shop.onLoad(); ShopCreateEvent e = new ShopCreateEvent(shop, p); if (Util.fireCancellableEvent(e)) { @@ -908,9 +908,9 @@ public class ShopManager { String msg; // Notify the shop owner if (plugin.getConfig().getBoolean("show-tax")) { - msg = MsgUtil.getMessage("player-bought-from-your-store-tax", p, p.getName(), Integer.toString(amount), "##########" + Util.serialize(shop.getItem()) + "##########", Util.format((CalculateUtil.multiply(tax, total)))); + msg = MsgUtil.getMessage("player-bought-from-your-store-tax", p, p.getName(), Integer.toString(amount * shop.getItem().getAmount()), "##########" + Util.serialize(shop.getItem()) + "##########", Util.format((CalculateUtil.multiply(tax, total)))); } else { - msg = MsgUtil.getMessage("player-bought-from-your-store", p, p.getName(), Integer.toString(amount), "##########" + Util.serialize(shop.getItem()) + "##########"); + msg = MsgUtil.getMessage("player-bought-from-your-store", p, p.getName(), Integer.toString(amount * shop.getItem().getAmount()), "##########" + Util.serialize(shop.getItem()) + "##########"); } // Transfers the item from A to B if (stock == amount) {