mirror of
https://github.com/PretzelJohn/VillagerTradeLimiter.git
synced 2024-12-04 16:13:31 +01:00
Version 1.5.5:
* Hopefully fixed MaxDemand bug when you buy something around 1500+ times back-to-back
This commit is contained in:
parent
030974f065
commit
2d97903db6
2
pom.xml
2
pom.xml
@ -3,7 +3,7 @@
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>com.pretzel.dev</groupId>
|
||||
<artifactId>VillagerTradeLimiter</artifactId>
|
||||
<version>1.5.4</version>
|
||||
<version>1.5.5</version>
|
||||
|
||||
<properties>
|
||||
<java.version>1.8</java.version>
|
||||
|
@ -121,7 +121,7 @@ public class PlayerListener implements Listener {
|
||||
setIngredient(override.getConfigurationSection("Result"), recipe.getResult());
|
||||
}
|
||||
|
||||
//Set the maximum number of uses (trades/day)
|
||||
//Set the maximum number of uses (trades/restock)
|
||||
recipe.setMaxUses(getMaxUses(recipe, other));
|
||||
}
|
||||
|
||||
@ -146,7 +146,10 @@ public class PlayerListener implements Listener {
|
||||
private int getDemand(final RecipeWrapper recipe) {
|
||||
int demand = recipe.getDemand();
|
||||
int maxDemand = settings.fetchInt(recipe, "MaxDemand", -1);
|
||||
if(maxDemand >= 0 && demand > maxDemand) return maxDemand;
|
||||
if(maxDemand >= 0 && demand > maxDemand) {
|
||||
recipe.setDemand(maxDemand);
|
||||
return maxDemand;
|
||||
}
|
||||
return demand;
|
||||
}
|
||||
|
||||
@ -162,8 +165,9 @@ public class PlayerListener implements Listener {
|
||||
int demand = getDemand(recipe);
|
||||
float priceMultiplier = recipe.getPriceMultiplier();
|
||||
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);
|
||||
double maxDiscount = settings.fetchDouble(recipe, "MaxDiscount", 0.3); //0.1
|
||||
if(maxDiscount >= 0.0 && maxDiscount <= 1.0) {
|
||||
//Change the discount to the smaller MaxDiscount
|
||||
if(basePrice + discount < basePrice * (1.0 - maxDiscount)) {
|
||||
|
@ -26,6 +26,9 @@ public class RecipeWrapper {
|
||||
this.specialPrice = getSpecialPrice();
|
||||
}
|
||||
|
||||
/** @param demand The demand, which increases prices if you buy too often. Negative values are ignored. */
|
||||
public void setDemand(int demand) { recipe.setInteger("demand", demand); }
|
||||
|
||||
/** @param specialPrice The discount, which is added to the base price. A negative value will decrease the price, and a positive value will increase the price. */
|
||||
public void setSpecialPrice(int specialPrice) { recipe.setInteger("specialPrice", specialPrice); }
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
name: VillagerTradeLimiter
|
||||
author: PretzelJohn
|
||||
main: com.pretzel.dev.villagertradelimiter.VillagerTradeLimiter
|
||||
version: 1.5.4
|
||||
version: 1.5.5
|
||||
api-version: 1.14
|
||||
|
||||
commands:
|
||||
|
Loading…
Reference in New Issue
Block a user