目前,我正在一家项目商店(minecraft)上工作,该项目包括根据需求改变商店的价格。
对于购买,如果很多人购买,价格会上涨,反之亦然 对于出售,销售越多,售价越低,反之亦然
我有一个存储所有可用商店的列表
public class Shop {
private ItemStack itemStack;
private Location location;
private double prix;
private int vente;
private ShopType shopType;
private ShopCategorie shopCategorie;
private ShopItemMenu shopItemMenu;
private String name;
public Shop(ItemStack itemStack, Location location, double prix, int vente, ShopType shopType, ShopCategorie shopCategorie, String name){
this.itemStack = itemStack;
this.location = location;
this.prix = prix;
this.vente = vente;
this.shopType = shopType;
this.shopCategorie = shopCategorie;
this.name = name;
}
public ShopCategorie getShopCategorie() {
return shopCategorie;
}
public void setShopCategorie(ShopCategorie shopCategorie) {
this.shopCategorie = shopCategorie;
}
public ItemStack getItemStack() {
return itemStack;
}
public Location getLocation() {
return location;
}
public void setLocation(Location location) {
this.location = location;
}
public double getPrix() {
return prix;
}
public ShopType getShopType() {
return shopType;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public int getVente() {
return vente;
}
public ShopItemMenu getShopItemMenu() {
return shopItemMenu;
}
}
sales变量允许增加此面板商店的销售数量,这将使我们能够改变其价格。我想制作一个通过任务每3小时重新计算价格的系统。
我唯一的问题是:您建议我如何根据需求计算价格变化。