diff --git a/MMOCore-API/src/main/java/net/Indyuce/mmocore/api/player/PlayerData.java b/MMOCore-API/src/main/java/net/Indyuce/mmocore/api/player/PlayerData.java index c41703bf..8baaa842 100644 --- a/MMOCore-API/src/main/java/net/Indyuce/mmocore/api/player/PlayerData.java +++ b/MMOCore-API/src/main/java/net/Indyuce/mmocore/api/player/PlayerData.java @@ -25,6 +25,7 @@ import net.Indyuce.mmocore.api.player.profess.skillbinding.SkillSlot; import net.Indyuce.mmocore.api.player.social.FriendRequest; import net.Indyuce.mmocore.api.player.stats.PlayerStats; import net.Indyuce.mmocore.api.quest.PlayerQuests; +import net.Indyuce.mmocore.api.quest.trigger.SkillBuffTrigger; import net.Indyuce.mmocore.api.quest.trigger.StatTrigger; import net.Indyuce.mmocore.api.util.Closable; import net.Indyuce.mmocore.api.util.MMOCoreUtils; @@ -1214,13 +1215,14 @@ public class PlayerData extends OfflinePlayerData implements Closable, Experienc public void bindSkill(int slot, ClassSkill skill) { Validate.notNull(skill, "Skill cannot be null"); //Unbinds the previous skill (Important for passive skills. + String skillId = skill.getSkill().getHandler().getId(); if (boundSkills.containsKey(slot)) boundSkills.get(slot).unbind(); if (slot >= 0) { //We apply the skill buffs associated with the slot to the skill. - profess.getSkillSlot(slot).getSkillBuffTriggers().forEach(skillBuffTrigger -> - skillBuffTrigger.apply(this, skill.getSkill().getHandler().getId())); - + for (SkillBuffTrigger skillBuffTrigger : profess.getSkillSlot(slot).getSkillBuffTriggers()) + if (skillBuffTrigger.getTargetSkills().contains(skillId)) + skillBuffTrigger.apply(this, skill.getSkill().getHandler().getId()); if (skill.getSkill().getTrigger().isPassive()) { PassiveSkill passiveSkill = skill.toPassive(this); diff --git a/MMOCore-API/src/main/java/net/Indyuce/mmocore/api/quest/trigger/SkillBuffTrigger.java b/MMOCore-API/src/main/java/net/Indyuce/mmocore/api/quest/trigger/SkillBuffTrigger.java index 40bd9cbe..0304a64b 100644 --- a/MMOCore-API/src/main/java/net/Indyuce/mmocore/api/quest/trigger/SkillBuffTrigger.java +++ b/MMOCore-API/src/main/java/net/Indyuce/mmocore/api/quest/trigger/SkillBuffTrigger.java @@ -37,6 +37,11 @@ public class SkillBuffTrigger extends Trigger implements Removable { skillBuff = new SkillBuff(buffKey, skillModifier, targetSkills, amount, ModifierType.valueOf(type)); } + + public List getTargetSkills() { + return skillBuff.getSkills(); + } + @Override public void apply(PlayerData player) { if (player.getMMOPlayerData().getSkillBuffMap().hasSkillBuff(buffKey)) { @@ -58,6 +63,7 @@ public class SkillBuffTrigger extends Trigger implements Removable { public void apply(PlayerData playerData, String skill) { skillBuff.register(playerData.getMMOPlayerData(), skill); } + /** * Used by skill slots to remove a skillBuff from a specific skill dynamically chosen. */