The cache should be here, not in the manager.

This commit is contained in:
GJ 2013-05-14 12:46:04 -04:00
parent f10b3cef01
commit 975cbf0bf8
2 changed files with 8 additions and 5 deletions

View File

@ -1,7 +1,10 @@
package com.gmail.nossr50.skills.fishing;
import java.util.HashMap;
import java.util.List;
import org.bukkit.Material;
import org.bukkit.enchantments.Enchantment;
import org.bukkit.entity.LivingEntity;
import org.bukkit.inventory.ItemStack;
@ -49,6 +52,8 @@ public final class Fishing {
abstract protected int getVanillaXPBoostModifier();
}
protected static final HashMap<Material, List<Enchantment>> enchantableCache = new HashMap<Material, List<Enchantment>>();
public static int fishermansDietRankLevel1 = AdvancedConfig.getInstance().getFishermanDietRankChange();
public static int fishermansDietRankLevel2 = fishermansDietRankLevel1 * 2;
public static int fishermansDietMaxLevel = fishermansDietRankLevel1 * 5;

View File

@ -2,7 +2,6 @@ package com.gmail.nossr50.skills.fishing;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import org.bukkit.ChatColor;
@ -49,7 +48,6 @@ import com.gmail.nossr50.util.skills.CombatUtils;
import com.gmail.nossr50.util.skills.SkillUtils;
public class FishingManager extends SkillManager {
private final HashMap<Material, List<Enchantment>> enchantableCache = new HashMap<Material, List<Enchantment>>();
private final long FISHING_COOLDOWN_SECONDS = 1000L;
private int fishingTries = 0;
@ -438,8 +436,8 @@ public class FishingManager extends SkillManager {
private List<Enchantment> getPossibleEnchantments(ItemStack treasureDrop) {
Material dropType = treasureDrop.getType();
if (enchantableCache.containsKey(dropType)) {
return enchantableCache.get(dropType);
if (Fishing.enchantableCache.containsKey(dropType)) {
return Fishing.enchantableCache.get(dropType);
}
List<Enchantment> possibleEnchantments = new ArrayList<Enchantment>();
@ -450,7 +448,7 @@ public class FishingManager extends SkillManager {
}
}
enchantableCache.put(dropType, possibleEnchantments);
Fishing.enchantableCache.put(dropType, possibleEnchantments);
return possibleEnchantments;
}