From d328a575aa6cefb2c856400c5dcb5bcd81d28f18 Mon Sep 17 00:00:00 2001 From: PretzelJohn <58197328+PretzelJohn@users.noreply.github.com> Date: Sun, 1 May 2022 08:59:38 -0400 Subject: [PATCH] Version 1.5.5: * Fixed MaxDemand bug when you buy something around 1500+ times back-to-back --- .../dev/villagertradelimiter/listeners/PlayerListener.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/com/pretzel/dev/villagertradelimiter/listeners/PlayerListener.java b/src/com/pretzel/dev/villagertradelimiter/listeners/PlayerListener.java index 2ed3429..ba32007 100644 --- a/src/com/pretzel/dev/villagertradelimiter/listeners/PlayerListener.java +++ b/src/com/pretzel/dev/villagertradelimiter/listeners/PlayerListener.java @@ -146,7 +146,8 @@ 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) { + if(maxDemand < 0) maxDemand = 1000000; + if(demand > maxDemand) { recipe.setDemand(maxDemand); return maxDemand; } @@ -165,7 +166,6 @@ 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); //0.1 if(maxDiscount >= 0.0 && maxDiscount <= 1.0) {