Fix price related bug and shop notice display bug

Former-commit-id: 8714e1b5ddd12203b5f4586a747450c143bc695e
This commit is contained in:
sandtechnology committed 2020-04-18 18:59:03 +08:00
1 parent 621814a432
commit 26ebb7ab65
5 files changed
+7 -7

No files matched your search

@@ -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;
}
@@ -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));
@@ -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
@@ -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;
}
@@ -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) {