diff --git a/src/main/java/com/gamingmesh/jobs/actions/EnchantActionInfo.java b/src/main/java/com/gamingmesh/jobs/actions/EnchantActionInfo.java index 2aad8f72..0a940ceb 100644 --- a/src/main/java/com/gamingmesh/jobs/actions/EnchantActionInfo.java +++ b/src/main/java/com/gamingmesh/jobs/actions/EnchantActionInfo.java @@ -40,4 +40,8 @@ public class EnchantActionInfo extends BaseActionInfo { public String getNameWithSub() { return name + ":" + level; } + + public int getLevel() { + return level; + } } diff --git a/src/main/java/com/gamingmesh/jobs/container/Job.java b/src/main/java/com/gamingmesh/jobs/container/Job.java index 2510203e..cbb6e483 100644 --- a/src/main/java/com/gamingmesh/jobs/container/Job.java +++ b/src/main/java/com/gamingmesh/jobs/container/Job.java @@ -29,6 +29,8 @@ import java.util.Map; import java.util.Random; import java.util.function.BiPredicate; +import com.gamingmesh.jobs.CMILib.CMIEnchantment; +import com.gamingmesh.jobs.actions.EnchantActionInfo; import org.bukkit.block.Block; import org.bukkit.command.CommandSender; import org.bukkit.entity.Entity; @@ -307,6 +309,19 @@ public class Job { return jobInfo.getName().equalsIgnoreCase(subName) || (jobInfo.getName() + ":" + jobInfo.getMeta()).equalsIgnoreCase(subName); } + if (actionInfo instanceof EnchantActionInfo) { + EnchantActionInfo enchantActionInfo = (EnchantActionInfo)actionInfo; + + String enchantName = CMIEnchantment.get(actionInfo.getName()).toString(); + + return ( + // Enchantment without level e.g. silk_touch + jobInfo.getName().equalsIgnoreCase(enchantName) || + // Enchantment with level e.g. fire_aspect:1 + jobInfo.getName().equalsIgnoreCase(enchantName + ":" + enchantActionInfo.getLevel()) + ); + } + return jobInfo.getName().equalsIgnoreCase(action.getNameWithSub()) || (jobInfo.getName() + ":" + jobInfo.getMeta()).equalsIgnoreCase(action.getNameWithSub()) || jobInfo.getName().equalsIgnoreCase(action.getName());