Added points to buy and sell events
This commit is contained in:
parent
9236befd7f
commit
6893d7bac7
|
|
@ -47,9 +47,11 @@ public class BuyGUI extends GUIMerchant {
|
|||
Template.of("price", String.valueOf(price))));
|
||||
return;
|
||||
}
|
||||
EconUser econUser = EconUser.users.get(player.getUniqueId());
|
||||
int oldPoints = econUser.getPointsMap().get(villagerType.getName());
|
||||
|
||||
econ.withdrawPlayer(player, cost);
|
||||
EconUser.users.get(player.getUniqueId())
|
||||
.addPoints(villagerType.getName(), price.getPoints());
|
||||
econUser.addPoints(villagerType.getName(), price.getPoints());
|
||||
player.sendMessage(MiniMessage.get().parse(Config.PURCHASED_ITEM,
|
||||
Template.of("amount", String.valueOf(amount)),
|
||||
Template.of("item", material.toString()),
|
||||
|
|
@ -57,7 +59,7 @@ public class BuyGUI extends GUIMerchant {
|
|||
|
||||
Bukkit.getServer().getPluginManager()
|
||||
.callEvent(new SpawnShopEvent(player, amount, cost, material,
|
||||
0, 0, true));
|
||||
oldPoints, econUser.getPointsMap().get(villagerType.getName()), true));
|
||||
}
|
||||
|
||||
private ItemStack getPriceItem(double price) {
|
||||
|
|
|
|||
|
|
@ -40,10 +40,11 @@ public class SellGUI extends GUIMerchant {
|
|||
private void sell(VillagerType villagerType, Player player, Material material, int amount, Price price) {
|
||||
Economy econ = VillagerUI.getEcon();
|
||||
double cost = price.getPrice(amount);
|
||||
EconUser econUser = EconUser.users.get(player.getUniqueId());
|
||||
int oldPoints = econUser.getPointsMap().get(villagerType.getName());
|
||||
|
||||
econ.depositPlayer(player, cost);
|
||||
EconUser.users.get(player.getUniqueId())
|
||||
.addPoints(villagerType.getName(), -price.getPoints());
|
||||
econUser.addPoints(villagerType.getName(), -price.getPoints());
|
||||
player.sendMessage(MiniMessage.get().parse(Config.PURCHASED_ITEM,
|
||||
Template.of("amount", String.valueOf(amount)),
|
||||
Template.of("item", material.toString()),
|
||||
|
|
@ -51,7 +52,7 @@ public class SellGUI extends GUIMerchant {
|
|||
|
||||
Bukkit.getServer().getPluginManager()
|
||||
.callEvent(new SpawnShopEvent(player, amount, cost, material,
|
||||
0, 0, false));
|
||||
oldPoints, econUser.getPointsMap().get(villagerType.getName()), false));
|
||||
}
|
||||
|
||||
private ItemStack getPriceItem(double price) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user