mirror of
https://e.coding.net/circlecloud/QuickShop.git
synced 2024-11-21 01:48:54 +00:00
修复收购商店不触发ShopPurchaseEvent的问题,并且调整触发的时机,避免没钱购买也触发这个事件
This commit is contained in:
parent
1b519fe90f
commit
1a624a8384
@ -334,6 +334,11 @@ public class ShopManager {
|
||||
p.sendMessage(MsgUtil.p("the-owner-cant-afford-to-buy-from-you", format(amount * shop.getPrice()), format(plugin.getEcon().getBalance(shop.getOwner()))));
|
||||
return;
|
||||
}
|
||||
final ShopPurchaseEvent e = new ShopPurchaseEvent(shop, p, amount);
|
||||
Bukkit.getPluginManager().callEvent(e);
|
||||
if (e.isCancelled()) {
|
||||
return; // Cancelled
|
||||
}
|
||||
// Check for plugins faking econ.has(amount)
|
||||
if (!plugin.getEcon().withdraw(shop.getOwner(), total)) {
|
||||
p.sendMessage(MsgUtil.p("the-owner-cant-afford-to-buy-from-you", format(amount * shop.getPrice()), format(plugin.getEcon().getBalance(shop.getOwner()))));
|
||||
@ -464,10 +469,6 @@ public class ShopManager {
|
||||
p.sendMessage(MsgUtil.p("not-enough-space", "" + pSpace));
|
||||
return;
|
||||
}
|
||||
final ShopPurchaseEvent e = new ShopPurchaseEvent(shop, p, amount);
|
||||
Bukkit.getPluginManager().callEvent(e);
|
||||
if (e.isCancelled()) { return; // Cancelled
|
||||
}
|
||||
// Money handling
|
||||
if (!p.getName().equals(shop.getOwner())) {
|
||||
// Check their balance. Works with *most* economy
|
||||
@ -476,6 +477,11 @@ public class ShopManager {
|
||||
p.sendMessage(MsgUtil.p("you-cant-afford-to-buy", format(amount * shop.getPrice()), format(plugin.getEcon().getBalance(p.getName()))));
|
||||
return;
|
||||
}
|
||||
final ShopPurchaseEvent e = new ShopPurchaseEvent(shop, p, amount);
|
||||
Bukkit.getPluginManager().callEvent(e);
|
||||
if (e.isCancelled()) {
|
||||
return; // Cancelled
|
||||
}
|
||||
// Don't tax them if they're purchasing from
|
||||
// themselves.
|
||||
// Do charge an amount of tax though.
|
||||
|
Loading…
Reference in New Issue
Block a user