diff --git a/src/main/java/com/gamingmesh/jobs/CMILib/CMIEnchantment.java b/src/main/java/com/gamingmesh/jobs/CMILib/CMIEnchantment.java index bfdb28f4..333c4549 100644 --- a/src/main/java/com/gamingmesh/jobs/CMILib/CMIEnchantment.java +++ b/src/main/java/com/gamingmesh/jobs/CMILib/CMIEnchantment.java @@ -56,9 +56,10 @@ public enum CMIEnchantment { private List customNames = new ArrayList(); private Enchantment enchantment; - CMIEnchantment(String... subName) { + @SuppressWarnings("deprecation") + CMIEnchantment(String... subName) { if (subName != null) - this.subName = Arrays.asList(subName); + this.subName.addAll(Arrays.asList(subName)); String temp = this.toString().toLowerCase().replace("_", ""); @@ -81,13 +82,56 @@ public enum CMIEnchantment { } // Worst case scenario - if (enchantment == null) + if (enchantment == null) { for (Enchantment one : Enchantment.values()) { if (one.toString().toLowerCase().replace("_", "").contains(temp)) { enchantment = one; break; } } + } + + // now checks for subnames + if (enchantment == null) { + for (Enchantment one : Enchantment.values()) { + for (String subs : this.subName) { + try { + if (one.getName().toLowerCase().replace("_", "").contains(subs.toLowerCase().replace("_", ""))) { + enchantment = one; + break; + } + } catch (Exception | Error e) { + } + + try { + if (one.getKey().toString().split(":")[1].toLowerCase().replace("_", "").equalsIgnoreCase(temp)) { + enchantment = one; + break; + } + } catch (Exception | Error e) { + } + } + + if (enchantment != null) { + break; + } + } + } + + if (enchantment == null) { + for (Enchantment one : Enchantment.values()) { + for (String subs : this.subName) { + if (one.toString().toLowerCase().replace("_", "").contains(subs.toLowerCase().replace("_", ""))) { + enchantment = one; + break; + } + } + + if (enchantment != null) { + break; + } + } + } } public List getSubNames() { diff --git a/src/main/java/com/gamingmesh/jobs/container/JobsPlayer.java b/src/main/java/com/gamingmesh/jobs/container/JobsPlayer.java index 340c0bb8..e20091b1 100644 --- a/src/main/java/com/gamingmesh/jobs/container/JobsPlayer.java +++ b/src/main/java/com/gamingmesh/jobs/container/JobsPlayer.java @@ -319,10 +319,7 @@ public class JobsPlayer { * Reloads limit for this player. */ public void reload(CurrencyType type) { - int TotalLevel = 0; - for (JobProgression prog : progression) { - TotalLevel += prog.getLevel(); - } + int TotalLevel = getTotalLevels(); Parser eq = Jobs.getGCManager().getLimit(type).getMaxEquation(); eq.setVariable("totallevel", TotalLevel); limits.put(type, (int) eq.getValue());