From 0dfd2fe9ef2094b1ff11fb1e00bc34af795ff30d Mon Sep 17 00:00:00 2001 From: GJ Date: Thu, 17 Jan 2013 18:25:26 -0500 Subject: [PATCH] ACTUALLY fix issue with fishing enchantments. Also updated the changelog. --- Changelog.txt | 10 +++++----- .../gmail/nossr50/skills/gathering/Fishing.java | 15 +++++++++------ 2 files changed, 14 insertions(+), 11 deletions(-) diff --git a/Changelog.txt b/Changelog.txt index ffa59e1ce..0859af3b9 100644 --- a/Changelog.txt +++ b/Changelog.txt @@ -8,10 +8,8 @@ Key: - Removal Version 1.3.13-dev - + Added task to prune old and powerless users from the SQL database. - *** WARNING: THIS WILL RUN AUTOMATICALLY ON YOUR DB. IF YOU ARE WORRIED *** - *** ABOUT DATA LOSS, BACK UP YOUR SQL DATA BEFORE INSTALLING THIS BUILD *** - + Added Craftbukkit 1.4.6 compatibility + + Added task & command to prune old and powerless users from the SQL database. + + Added Craftbukkit 1.4.6 / 1.4.7 compatibility + Added new /mcrank command for showing a players leader board ranking for all skills in one place + Added a configurable durability cap for ArmorImpact to advanced.yml + Added the version number to /mcmmo @@ -44,9 +42,11 @@ Version 1.3.13-dev = Fixed a bug which caused a potentially infinite recursion in a btree structure = Fixed a NPE with custom blocks = Fixed a bug with Blast Mining never dropping debris blocks + = Fixed a bug with conflicting fishing enchantments ! GJ stopped being a lazy slacker and got stuff done + ! Nossr50 actually committed something ! Changed code that uses SpoutPlugin to make it compatible with the latest version - ! Changed Reimplemented skill level and power level caps. + ! Reimplemented skill level and power level caps. ! Moved Arcane Forging and Fishing setting from config.yml to advanced.yml ! Overall SQL query improvements ! Reduced number of SQL queries for mcTop command from 11 to 1, speeding it up immensely diff --git a/src/main/java/com/gmail/nossr50/skills/gathering/Fishing.java b/src/main/java/com/gmail/nossr50/skills/gathering/Fishing.java index 0e6f7dc4e..1bc4923f0 100755 --- a/src/main/java/com/gmail/nossr50/skills/gathering/Fishing.java +++ b/src/main/java/com/gmail/nossr50/skills/gathering/Fishing.java @@ -2,7 +2,6 @@ package com.gmail.nossr50.skills.gathering; import java.util.ArrayList; import java.util.List; -import java.util.Map; import org.bukkit.DyeColor; import org.bukkit.Location; @@ -164,14 +163,18 @@ public class Fishing { */ if (Misc.getRandom().nextInt(randomChance) <= (lootTier * magicHunterMultiplier) && Permissions.fishingMagic(player)) { for (Enchantment newEnchant : Enchantment.values()) { + boolean conflicts = false; + if (newEnchant.canEnchantItem(fishingResults)) { - Map resultEnchantments = fishingResults.getEnchantments(); specificChance++; - for (Enchantment oldEnchant : resultEnchantments.keySet()) { - if (oldEnchant.conflictsWith(newEnchant)) + for (Enchantment oldEnchant : fishingResults.getEnchantments().keySet()) { + conflicts = oldEnchant.conflictsWith(newEnchant); + + if (conflicts) { specificChance--; - continue; + break; + } } /* CHANCE OF GETTING EACH ENCHANTMENT @@ -184,7 +187,7 @@ public class Fishing { * 12.5% - 7th Enchantment * 11.11% - 8th Enchantment */ - if (Misc.getRandom().nextInt(specificChance) < 1) { + if (!conflicts && Misc.getRandom().nextInt(specificChance) < 1) { enchanted = true; int randomEnchantLevel = Misc.getRandom().nextInt(newEnchant.getMaxLevel()) + 1;