mirror of
https://github.com/PretzelJohn/VillagerTradeLimiter.git
synced 2024-12-05 00:23:29 +01:00
Version 1.5.5:
* Fixed MaxDemand bug when you buy something around 1500+ times back-to-back
This commit is contained in:
parent
2d97903db6
commit
d328a575aa
@ -146,7 +146,8 @@ public class PlayerListener implements Listener {
|
|||||||
private int getDemand(final RecipeWrapper recipe) {
|
private int getDemand(final RecipeWrapper recipe) {
|
||||||
int demand = recipe.getDemand();
|
int demand = recipe.getDemand();
|
||||||
int maxDemand = settings.fetchInt(recipe, "MaxDemand", -1);
|
int maxDemand = settings.fetchInt(recipe, "MaxDemand", -1);
|
||||||
if(maxDemand >= 0 && demand > maxDemand) {
|
if(maxDemand < 0) maxDemand = 1000000;
|
||||||
|
if(demand > maxDemand) {
|
||||||
recipe.setDemand(maxDemand);
|
recipe.setDemand(maxDemand);
|
||||||
return maxDemand;
|
return maxDemand;
|
||||||
}
|
}
|
||||||
@ -165,7 +166,6 @@ public class PlayerListener implements Listener {
|
|||||||
int demand = getDemand(recipe);
|
int demand = getDemand(recipe);
|
||||||
float priceMultiplier = recipe.getPriceMultiplier();
|
float priceMultiplier = recipe.getPriceMultiplier();
|
||||||
int discount = -(int)(totalReputation * priceMultiplier) - (int)(hotvDiscount * basePrice) + Math.max(0, (int)(demand * priceMultiplier * basePrice));
|
int discount = -(int)(totalReputation * priceMultiplier) - (int)(hotvDiscount * basePrice) + Math.max(0, (int)(demand * priceMultiplier * basePrice));
|
||||||
//discount = -(265 * 0.05) - (0.3 * 1) + max(0, 94965314 * 0.05 * 1) = -13
|
|
||||||
|
|
||||||
double maxDiscount = settings.fetchDouble(recipe, "MaxDiscount", 0.3); //0.1
|
double maxDiscount = settings.fetchDouble(recipe, "MaxDiscount", 0.3); //0.1
|
||||||
if(maxDiscount >= 0.0 && maxDiscount <= 1.0) {
|
if(maxDiscount >= 0.0 && maxDiscount <= 1.0) {
|
||||||
|
Loading…
Reference in New Issue
Block a user