1
0
mirror of https://github.com/Zrips/Jobs.git synced 2024-11-26 12:35:28 +01:00

Fixed when some tipped arrows not works, that have underscore "_"

- Fix when the legacy_wheat not works

Fixes #810
This commit is contained in:
montlikadani 2020-06-09 20:07:41 +02:00
parent 08af55c5f6
commit c23475e1e5
4 changed files with 27 additions and 31 deletions

View File

@ -1039,7 +1039,7 @@ public enum CMIMaterial {
// LEGACY_PURPUR_DOUBLE_SLAB(204, null, null, "LEGACY_PURPUR_DOUBLE_SLAB", ""),
// LEGACY_COMMAND_REPEATING(210, null, null, "LEGACY_COMMAND_REPEATING", ""),
// LEGACY_COMMAND_CHAIN(211, null, null, "LEGACY_COMMAND_CHAIN", ""),
LEGACY_WHEAT(59, 0, null, "Wheat Block");
LEGACY_WHEAT(59, 0, null, "Wheat");
private Integer legacyId;
private Integer legacyData;

View File

@ -31,7 +31,8 @@ public class PotionItemActionInfo extends ItemActionInfo {
this.potionType = potionType;
}
public String getNameWithPotion() {
@Override
public String getNameWithSub() {
return getName() + ":" + potionType.toString();
}
}

View File

@ -19,7 +19,6 @@
package com.gamingmesh.jobs.container;
import com.gamingmesh.jobs.Jobs;
import com.gamingmesh.jobs.actions.PotionItemActionInfo;
import com.gamingmesh.jobs.resources.jfep.Parser;
import com.gamingmesh.jobs.stuff.ChatColor;
@ -226,11 +225,6 @@ public class Job {
public JobInfo getJobInfo(ActionInfo action, int level) {
BiPredicate<JobInfo, ActionInfo> condition = (jobInfo, actionInfo) -> {
if (actionInfo instanceof PotionItemActionInfo) {
return jobInfo.getName().equalsIgnoreCase(((PotionItemActionInfo) action).getNameWithPotion()) ||
(jobInfo.getName() + ":" + jobInfo.getMeta()).equalsIgnoreCase(((PotionItemActionInfo) action).getNameWithPotion());
}
return jobInfo.getName().equalsIgnoreCase(action.getNameWithSub()) ||
(jobInfo.getName() + ":" + jobInfo.getMeta()).equalsIgnoreCase(action.getNameWithSub()) ||
jobInfo.getName().equalsIgnoreCase(action.getName());

View File

@ -22,30 +22,31 @@ package com.gamingmesh.jobs.container;
* <a href="https://papermc.io/javadocs/paper/1.13/org/bukkit/potion/PotionType.html">API reference for names</a>
*/
public enum Potion {
AWKWARD("AWKWARD"),
FIRE_RESISTANCE("FIRE_RESISTANCE"),
INSTANT_DAMAGE("INSTANT_DAMAGE"),
INSTANT_HEAL("INSTANT_HEAL"),
INVISIBILITY("INVISIBILITY"),
JUMP("JUMP"),
LUCK("LUCK"),
MUNDANE("MUNDANE"),
NIGHT_VISION("NIGHT_VISION"),
POISON("POISON"),
REGEN("REGEN"),
SLOW_FALLING("SLOW_FALLING"),
SLOWNESS("SLOWNESS"),
SPEED("SPEED"),
STRENGTH("STRENGTH"),
THICK("THICK"),
TURTLE_MASTER("TURTLE_MASTER"),
WATER_BREATHING("WATER_BREATHING"),
WEAKNESS("WEAKNESS");
AWKWARD("awkward"),
FIRE_RESISTANCE("fire_resistance"),
INSTANT_DAMAGE("instant_damage"),
INSTANT_HEAL("instant_heal"),
INVISIBILITY("invisibility"),
JUMP("jump"),
LUCK("luck"),
MUNDANE("mundane"),
NIGHT_VISION("night_vision"),
LONG_NIGHT_VISION("long_night_vision"),
POISON("poison"),
REGEN("regen"),
SLOW_FALLING("slow_falling"),
SLOWNESS("slowness"),
SPEED("speed"),
STRENGTH("strength"),
THICK("thick"),
TURTLE_MASTER("turtle_master"),
WATER_BREATHING("water_breathing"),
WEAKNESS("weakness");
private final String name;
Potion(String name) {
this.name = name;
this.name = name.toUpperCase();
}
public String getName() {
@ -53,12 +54,12 @@ public enum Potion {
}
public static Potion getByName(String name) {
name = name.replace("_", "");
for (Potion one : Potion.values()) {
if (one.name.equalsIgnoreCase(name)) {
return one;
}
}
return null;
}
}