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_PURPUR_DOUBLE_SLAB(204, null, null, "LEGACY_PURPUR_DOUBLE_SLAB", ""),
// LEGACY_COMMAND_REPEATING(210, null, null, "LEGACY_COMMAND_REPEATING", ""), // LEGACY_COMMAND_REPEATING(210, null, null, "LEGACY_COMMAND_REPEATING", ""),
// LEGACY_COMMAND_CHAIN(211, null, null, "LEGACY_COMMAND_CHAIN", ""), // 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 legacyId;
private Integer legacyData; private Integer legacyData;

View File

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

View File

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

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