mirror of
https://github.com/Zrips/Jobs.git
synced 2025-01-23 00:21:20 +01:00
Fixed issue when enchants not works
This commit is contained in:
parent
93bec7e234
commit
423248105b
@ -56,9 +56,10 @@ public enum CMIEnchantment {
|
|||||||
private List<String> customNames = new ArrayList<String>();
|
private List<String> customNames = new ArrayList<String>();
|
||||||
private Enchantment enchantment;
|
private Enchantment enchantment;
|
||||||
|
|
||||||
CMIEnchantment(String... subName) {
|
@SuppressWarnings("deprecation")
|
||||||
|
CMIEnchantment(String... subName) {
|
||||||
if (subName != null)
|
if (subName != null)
|
||||||
this.subName = Arrays.asList(subName);
|
this.subName.addAll(Arrays.asList(subName));
|
||||||
|
|
||||||
String temp = this.toString().toLowerCase().replace("_", "");
|
String temp = this.toString().toLowerCase().replace("_", "");
|
||||||
|
|
||||||
@ -81,13 +82,56 @@ public enum CMIEnchantment {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Worst case scenario
|
// Worst case scenario
|
||||||
if (enchantment == null)
|
if (enchantment == null) {
|
||||||
for (Enchantment one : Enchantment.values()) {
|
for (Enchantment one : Enchantment.values()) {
|
||||||
if (one.toString().toLowerCase().replace("_", "").contains(temp)) {
|
if (one.toString().toLowerCase().replace("_", "").contains(temp)) {
|
||||||
enchantment = one;
|
enchantment = one;
|
||||||
break;
|
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<String> getSubNames() {
|
public List<String> getSubNames() {
|
||||||
|
@ -319,10 +319,7 @@ public class JobsPlayer {
|
|||||||
* Reloads limit for this player.
|
* Reloads limit for this player.
|
||||||
*/
|
*/
|
||||||
public void reload(CurrencyType type) {
|
public void reload(CurrencyType type) {
|
||||||
int TotalLevel = 0;
|
int TotalLevel = getTotalLevels();
|
||||||
for (JobProgression prog : progression) {
|
|
||||||
TotalLevel += prog.getLevel();
|
|
||||||
}
|
|
||||||
Parser eq = Jobs.getGCManager().getLimit(type).getMaxEquation();
|
Parser eq = Jobs.getGCManager().getLimit(type).getMaxEquation();
|
||||||
eq.setVariable("totallevel", TotalLevel);
|
eq.setVariable("totallevel", TotalLevel);
|
||||||
limits.put(type, (int) eq.getValue());
|
limits.put(type, (int) eq.getValue());
|
||||||
|
Loading…
Reference in New Issue
Block a user