From ec20d69feb3f59e4f38cb225705f0880c3fce313 Mon Sep 17 00:00:00 2001 From: hoorigan Date: Mon, 30 Oct 2017 20:25:19 -0400 Subject: [PATCH] If the treasure is an enchanted book, enchant it. Added a bit of logic to check and see if the drop is an enchanted book, and if it is, force at least one enchantment to be applied. As a warning, I'm not a programmer, so I could have incorrectly used the continue statement here. This requires more experienced eyes and some testing, I'm sure. --- .../com/gmail/nossr50/skills/fishing/FishingManager.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/main/java/com/gmail/nossr50/skills/fishing/FishingManager.java b/src/main/java/com/gmail/nossr50/skills/fishing/FishingManager.java index 59e8b93cc..05621fa34 100644 --- a/src/main/java/com/gmail/nossr50/skills/fishing/FishingManager.java +++ b/src/main/java/com/gmail/nossr50/skills/fishing/FishingManager.java @@ -572,6 +572,11 @@ public class FishingManager extends SkillManager { double dropRate = TreasureConfig.getInstance().getEnchantmentDropRate(getLootTier(), rarity); if (diceRoll <= dropRate) { + // Make sure enchanted books always get some kind of enchantment. --hoorigan + if (treasureDrop.getType() == Material.ENCHANTED_BOOK) { + diceRoll = dropRate; + continue; + } fishingEnchantments = TreasureConfig.getInstance().fishingEnchantments.get(rarity); break; }