From d4dbb0599700a517c2b75f0647165e4e7a8ae45f Mon Sep 17 00:00:00 2001 From: Indyuce Date: Mon, 1 Aug 2022 14:45:44 +0200 Subject: [PATCH] Fixed SkillAPI skill compat --- .../java/net/Indyuce/mmocore/skill/RegisteredSkill.java | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/main/java/net/Indyuce/mmocore/skill/RegisteredSkill.java b/src/main/java/net/Indyuce/mmocore/skill/RegisteredSkill.java index 0d5ada32..0c027543 100644 --- a/src/main/java/net/Indyuce/mmocore/skill/RegisteredSkill.java +++ b/src/main/java/net/Indyuce/mmocore/skill/RegisteredSkill.java @@ -4,6 +4,7 @@ import io.lumine.mythic.lib.UtilityMethods; import io.lumine.mythic.lib.skill.handler.SkillHandler; import io.lumine.mythic.lib.skill.trigger.TriggerType; import net.Indyuce.mmocore.api.util.MMOCoreUtils; +import net.Indyuce.mmocore.api.util.math.formula.IntegerLinearValue; import net.Indyuce.mmocore.api.util.math.formula.LinearValue; import net.Indyuce.mmocore.player.Unlockable; import org.bukkit.configuration.ConfigurationSection; @@ -34,8 +35,15 @@ public class RegisteredSkill implements Unlockable { // Trigger type triggerType = getHandler().isTriggerable() ? (config.contains("passive-type") ? TriggerType.valueOf(UtilityMethods.enumName(config.getString("passive-type"))) : TriggerType.CAST) : TriggerType.API; + // Load default modifier formulas for (String mod : handler.getModifiers()) defaultModifiers.put(mod, config.contains(mod) ? new LinearValue(config.getConfigurationSection(mod)) : LinearValue.ZERO); + + /* + * This is so that SkillAPI skill level matches the MMOCore skill level + * https://gitlab.com/phoenix-dvpmt/mmocore/-/issues/531 + */ + defaultModifiers.put("level", new IntegerLinearValue(0, 1)); } public RegisteredSkill(SkillHandler handler, String name, ItemStack icon, List lore, @Nullable TriggerType triggerType) {