From 446e6773368b4bc35396e32e360a766846b97786 Mon Sep 17 00:00:00 2001 From: PretzelJohn <58197328+PretzelJohn@users.noreply.github.com> Date: Thu, 23 Dec 2021 02:17:49 -0500 Subject: [PATCH] Version 1.4.4: * Added feature to increase discounts by setting MaxDiscount to a number greater than 1.0 --- README.md | 7 ++++--- pom.xml | 2 +- .../dev/villagertradelimiter/listeners/PlayerListener.java | 4 +++- src/main/resources/config.yml | 3 ++- src/main/resources/plugin.yml | 2 +- 5 files changed, 11 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index c2ddac7..ad39b02 100644 --- a/README.md +++ b/README.md @@ -85,7 +85,8 @@ The maximum discount (%) you can get from trading/healing zombie villagers. This limits reputation-based price decreases.
Options: @@ -139,11 +140,11 @@ .Item1.Material:
.Item2.Material: - Sets the material of the 1st or 2nd item in the trade + Sets the material of the 1st or 2nd item in the trade
WARNING: This cannot be undone! .Item1.Amount:
.Item2.Amount: - Sets the amount of the 1st or 2nd item in the trade + Sets the amount of the 1st or 2nd item in the trade
WARNING: This cannot be undone! diff --git a/pom.xml b/pom.xml index b6be220..8c61cce 100644 --- a/pom.xml +++ b/pom.xml @@ -3,7 +3,7 @@ 4.0.0 com.pretzel.dev VillagerTradeLimiter - 1.4.3 + 1.4.4 1.8 diff --git a/src/com/pretzel/dev/villagertradelimiter/listeners/PlayerListener.java b/src/com/pretzel/dev/villagertradelimiter/listeners/PlayerListener.java index b2a177a..32d1e42 100644 --- a/src/com/pretzel/dev/villagertradelimiter/listeners/PlayerListener.java +++ b/src/com/pretzel/dev/villagertradelimiter/listeners/PlayerListener.java @@ -126,7 +126,7 @@ public class PlayerListener implements Listener { for(final NBTCompound recipe : recipes) { final int ingredientAmount = recipe.getCompound("buy").getInteger("Count"); final float priceMultiplier = this.getPriceMultiplier(recipe); - final int valueModifier = 5 * majorPositiveValue + minorPositiveValue + tradingValue - minorNegativeValue - 5 * majorNegativeValue; + final int valueModifier = (5 * majorPositiveValue) + minorPositiveValue + tradingValue - minorNegativeValue - (5 * majorNegativeValue); final float finalValue = ingredientAmount - priceMultiplier * valueModifier; boolean disabled = false; @@ -174,6 +174,8 @@ public class PlayerListener implements Listener { } else { recipe.setFloat("priceMultiplier", priceMultiplier); } + } else if(maxDiscount > 1.0) { + recipe.setFloat("priceMultiplier", priceMultiplier * (float) maxDiscount); } else { recipe.setFloat("priceMultiplier", priceMultiplier); } diff --git a/src/main/resources/config.yml b/src/main/resources/config.yml index 293ab6d..3d9f1ce 100644 --- a/src/main/resources/config.yml +++ b/src/main/resources/config.yml @@ -20,7 +20,8 @@ MaxHeroLevel: 1 # The maximum discount (%) you can get from trading/healing zombie villagers. This limits reputation-based price decreases. # * Set to -1.0 to disable this feature and keep vanilla behavior -# * Set to a number between 0.0 and 1.0 to set the maximum discount a player can get. (NOTE: 30% = 0.3) +# * Set to a number between 0.0 and 1.0 to limit the maximum discount a player can get. (NOTE: 30% = 0.3) +# * Set to a number above 1.0 to increase the maximum discount a player can get. (NOTE: 250% = 2.5) MaxDiscount: 0.3 # The maximum demand for all items. This limits demand-based price increases. diff --git a/src/main/resources/plugin.yml b/src/main/resources/plugin.yml index 7ab01ca..4ad0909 100644 --- a/src/main/resources/plugin.yml +++ b/src/main/resources/plugin.yml @@ -1,7 +1,7 @@ name: VillagerTradeLimiter author: PretzelJohn main: com.pretzel.dev.villagertradelimiter.VillagerTradeLimiter -version: 1.4.3 +version: 1.4.4 api-version: 1.14 commands: