From 8f99eedb1bc67fbc7131a3a99321f93fec35634e Mon Sep 17 00:00:00 2001 From: Indyuce Date: Thu, 26 Aug 2021 11:19:44 +0200 Subject: [PATCH] moved skill and stat placeholders to mythiclib --- pom.xml | 2 +- .../mmocore/comp/mythicmobs/MythicHook.java | 31 ----------- .../comp/mythicmobs/skill/MapVariable.java | 53 ------------------- 3 files changed, 1 insertion(+), 85 deletions(-) delete mode 100644 src/main/java/net/Indyuce/mmocore/comp/mythicmobs/skill/MapVariable.java diff --git a/pom.xml b/pom.xml index 6ce28081..1bb18315 100644 --- a/pom.xml +++ b/pom.xml @@ -125,7 +125,7 @@ io.lumine MythicLib - 1.1.2 + 1.1.3 provided diff --git a/src/main/java/net/Indyuce/mmocore/comp/mythicmobs/MythicHook.java b/src/main/java/net/Indyuce/mmocore/comp/mythicmobs/MythicHook.java index 7e9f1837..0dac710a 100644 --- a/src/main/java/net/Indyuce/mmocore/comp/mythicmobs/MythicHook.java +++ b/src/main/java/net/Indyuce/mmocore/comp/mythicmobs/MythicHook.java @@ -1,12 +1,9 @@ package net.Indyuce.mmocore.comp.mythicmobs; -import io.lumine.mythic.lib.api.stat.StatMap; import io.lumine.xikage.mythicmobs.MythicMobs; import io.lumine.xikage.mythicmobs.api.bukkit.events.MythicDropLoadEvent; import io.lumine.xikage.mythicmobs.api.bukkit.events.MythicReloadedEvent; -import io.lumine.xikage.mythicmobs.skills.SkillMetadata; import io.lumine.xikage.mythicmobs.skills.placeholders.Placeholder; -import io.lumine.xikage.mythicmobs.skills.variables.Variable; import net.Indyuce.mmocore.api.player.PlayerData; import net.Indyuce.mmocore.comp.mythicmobs.load.CurrencyItemDrop; import net.Indyuce.mmocore.comp.mythicmobs.load.GoldPouchDrop; @@ -41,34 +38,6 @@ public class MythicHook implements Listener { } private void registerPlaceholders() { - - MythicMobs.inst().getPlaceholderManager().register("modifier", Placeholder.meta((metadata, arg) -> { - if (!(metadata instanceof SkillMetadata)) - throw new RuntimeException("Cannot use this placeholder outside of skill"); - - Variable var = ((SkillMetadata) metadata).getVariables().get("MMOCoreSkill"); - net.Indyuce.mmocore.skill.metadata.SkillMetadata cast = (net.Indyuce.mmocore.skill.metadata.SkillMetadata) var.get(); - return String.valueOf(cast.getModifier(arg)); - })); - - MythicMobs.inst().getPlaceholderManager().register("modifier.int", Placeholder.meta((metadata, arg) -> { - if (!(metadata instanceof SkillMetadata)) - throw new RuntimeException("Cannot use this placeholder outside of skill"); - - Variable var = ((SkillMetadata) metadata).getVariables().get("MMOCoreSkill"); - net.Indyuce.mmocore.skill.metadata.SkillMetadata cast = (net.Indyuce.mmocore.skill.metadata.SkillMetadata) var.get(); - return String.valueOf((int) cast.getModifier(arg)); - })); - - MythicMobs.inst().getPlaceholderManager().register("stat", Placeholder.meta((metadata, arg) -> { - if (!(metadata instanceof SkillMetadata)) - throw new RuntimeException("Cannot use this placeholder outside of skill"); - - Variable var = ((SkillMetadata) metadata).getVariables().get("MMOStatMap"); - StatMap.CachedStatMap statMap = (StatMap.CachedStatMap) var.get(); - return String.valueOf(statMap.getStat(arg.toUpperCase())); - })); - MythicMobs.inst().getPlaceholderManager().register("mana", Placeholder.meta((metadata, arg) -> String.valueOf((int) PlayerData.get(metadata.getCaster().getEntity().getUniqueId()).getMana()))); MythicMobs.inst().getPlaceholderManager().register("stamina", Placeholder.meta((metadata, arg) -> String.valueOf((int) PlayerData.get(metadata.getCaster().getEntity().getUniqueId()).getStamina()))); } diff --git a/src/main/java/net/Indyuce/mmocore/comp/mythicmobs/skill/MapVariable.java b/src/main/java/net/Indyuce/mmocore/comp/mythicmobs/skill/MapVariable.java deleted file mode 100644 index 311da657..00000000 --- a/src/main/java/net/Indyuce/mmocore/comp/mythicmobs/skill/MapVariable.java +++ /dev/null @@ -1,53 +0,0 @@ -package net.Indyuce.mmocore.comp.mythicmobs.skill; - -import io.lumine.xikage.mythicmobs.skills.variables.Variable; -import org.jetbrains.annotations.NotNull; - -import java.util.HashMap; -import java.util.Map; -import java.util.Objects; - -/** - * Used by MMOCore to cache skill modifiers inside a variable. - * The modifiers are cached in a variable with the skill scope. - * - * @deprecated Now using an {@link io.lumine.xikage.mythicmobs.skills.variables.types.AbstractVariable} - */ -@Deprecated -public class MapVariable extends Variable { - - @NotNull - private final Map map = new HashMap<>(); - - public Map getValue() { - return map; - } - - @Override - public String toString() { - return "VAR_Map(" + map + ')'; - } - - @Override - public boolean shouldSave() { - return false; - } - - @Override - public Object get() { - return map; - } - - @Override - public boolean equals(Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; - MapVariable that = (MapVariable) o; - return map.equals(that.map); - } - - @Override - public int hashCode() { - return Objects.hash(map); - } -}