From 3ef9011b9afe7cc9d26e9f84e7bfd3f6da37e0d8 Mon Sep 17 00:00:00 2001 From: Indyuce Date: Sat, 12 Feb 2022 11:05:19 +0100 Subject: [PATCH] Commented out class triggers --- pom.xml | 2 +- .../api/player/profess/PlayerClass.java | 12 +++---- .../player/playerclass/ClassTrigger.java | 34 ++++++++----------- 3 files changed, 21 insertions(+), 27 deletions(-) diff --git a/pom.xml b/pom.xml index 9a2e4a3e..c3db89c1 100644 --- a/pom.xml +++ b/pom.xml @@ -140,7 +140,7 @@ io.lumine MythicLib-dist - 1.3-R27-SNAPSHOT + 1.3-R28-SNAPSHOT provided diff --git a/src/main/java/net/Indyuce/mmocore/api/player/profess/PlayerClass.java b/src/main/java/net/Indyuce/mmocore/api/player/profess/PlayerClass.java index 633f8f9d..dc4b1090 100644 --- a/src/main/java/net/Indyuce/mmocore/api/player/profess/PlayerClass.java +++ b/src/main/java/net/Indyuce/mmocore/api/player/profess/PlayerClass.java @@ -21,8 +21,6 @@ import net.Indyuce.mmocore.experience.droptable.ExperienceTable; import net.Indyuce.mmocore.experience.provider.ExperienceDispenser; import net.Indyuce.mmocore.experience.provider.MainExperienceDispenser; import net.Indyuce.mmocore.experience.source.type.ExperienceSource; -import net.Indyuce.mmocore.player.playerclass.ClassTrigger; -import net.Indyuce.mmocore.player.playerclass.ClassTriggerType; import net.Indyuce.mmocore.skill.ClassSkill; import net.Indyuce.mmocore.skill.RegisteredSkill; import net.md_5.bungee.api.ChatColor; @@ -53,7 +51,7 @@ public class PlayerClass extends PostLoadObject implements ExperienceObject { private final Map stats = new HashMap<>(); private final Map skills = new LinkedHashMap<>(); private final List subclasses = new ArrayList<>(); - private final Map classTriggers = new HashMap<>(); + // private final Map classTriggers = new HashMap<>(); private final Map resourceHandlers = new HashMap<>(); @Deprecated @@ -295,10 +293,10 @@ public class PlayerClass extends PostLoadObject implements ExperienceObject { return options.containsKey(option) ? options.get(option) : option.getDefault(); } - @Nullable - public ClassTrigger getClassTrigger(ClassTriggerType type) { - return classTriggers.get(type); - } + // @Nullable + // public ClassTrigger getClassTrigger(ClassTriggerType type) { + // return classTriggers.get(type); + // } @Deprecated public Set getEventTriggers() { diff --git a/src/main/java/net/Indyuce/mmocore/player/playerclass/ClassTrigger.java b/src/main/java/net/Indyuce/mmocore/player/playerclass/ClassTrigger.java index c043c3cd..ea21fbd0 100644 --- a/src/main/java/net/Indyuce/mmocore/player/playerclass/ClassTrigger.java +++ b/src/main/java/net/Indyuce/mmocore/player/playerclass/ClassTrigger.java @@ -1,17 +1,21 @@ package net.Indyuce.mmocore.player.playerclass; +import io.lumine.mythic.lib.MythicLib; import io.lumine.mythic.lib.UtilityMethods; import io.lumine.mythic.lib.api.MMOLineConfig; +import io.lumine.mythic.lib.skill.SimpleSkill; +import io.lumine.mythic.lib.skill.Skill; +import io.lumine.mythic.lib.skill.custom.CustomSkill; import io.lumine.mythic.lib.skill.custom.mechanic.Mechanic; +import io.lumine.mythic.lib.skill.handler.MythicLibSkillHandler; import io.lumine.mythic.lib.skill.result.SkillResult; import io.lumine.mythic.lib.skill.trigger.TriggerMetadata; -import net.Indyuce.mmocore.MMOCore; -import net.Indyuce.mmocore.api.player.PlayerData; -import net.Indyuce.mmocore.api.quest.trigger.Trigger; +import io.lumine.mythic.lib.skill.trigger.TriggerType; +import io.lumine.mythic.lib.util.configobject.ConfigObject; +import io.lumine.mythic.lib.util.configobject.LineConfigObject; import net.Indyuce.mmocore.listener.ClassTriggers; import org.apache.commons.lang.Validate; -import java.util.ArrayList; import java.util.List; /** @@ -28,23 +32,20 @@ import java.util.List; * @author jules * @see {@link ClassTriggers} */ +@Deprecated public class ClassTrigger { private final ClassTriggerType type; - private final List triggers = new ArrayList<>(); - // private final CustomSkill skill = new CustomSkill("classTrigger", false); - // private final Skill castableSkill = new SimpleSkill(new MythicLibSkillHandler(skill)); + private final CustomSkill skill = new CustomSkill("classTrigger", false); + private final Skill castableSkill = new SimpleSkill(TriggerType.CAST, new MythicLibSkillHandler(skill)); public ClassTrigger(String triggerTypeString, List mechanicStringList) { Validate.notNull(mechanicStringList, "Mechanic list cannot be null"); type = ClassTriggerType.valueOf(UtilityMethods.enumName(triggerTypeString)); - for (String key : mechanicStringList) { - MMOLineConfig config = new MMOLineConfig(key); - triggers.add(MMOCore.plugin.loadManager.loadTrigger(config)); - // ConfigObject config = new LineConfigObject(new MMOLineConfig(key)); - // Mechanic mechanic = MythicLib.plugin.getSkills().loadMechanic(config); - // skill.getMechanics().add(mechanic); + ConfigObject config = new LineConfigObject(new MMOLineConfig(key)); + Mechanic mechanic = MythicLib.plugin.getSkills().loadMechanic(config); + skill.getMechanics().add(mechanic); } } @@ -54,11 +55,6 @@ public class ClassTrigger { @Deprecated public SkillResult trigger(TriggerMetadata triggerMeta) { - // return castableSkill.cast(triggerMeta); - return null; - } - - public void trigger(PlayerData player) { - triggers.forEach(trigger -> trigger.apply(player)); + return castableSkill.cast(triggerMeta); } }