Bug Fixing for Issue#802 about passive-skill-need-bound not working.

This commit is contained in:
Ka0rX 2023-05-09 08:32:48 +01:00
parent a18a42ea2f
commit 7bf3b9ace7
2 changed files with 14 additions and 4 deletions

View File

@ -14,6 +14,10 @@ import net.Indyuce.mmocore.experience.Profession;
import net.Indyuce.mmocore.player.stats.StatInfo;
import net.Indyuce.mmocore.skill.ClassSkill;
import java.util.Comparator;
import java.util.List;
import java.util.stream.Collectors;
public class PlayerStats {
private final PlayerData data;
@ -101,9 +105,11 @@ public class PlayerStats {
if (!MMOCore.plugin.configManager.passiveSkillNeedBound) {
skillMap.removeModifiers("MMOCorePassiveSkill");
for (ClassSkill skill : data.getProfess().getSkills())
if (skill.getSkill().getTrigger().isPassive())
skillMap.addModifier(skill.toPassive(data));
data.getProfess().getSkills()
.stream()
.filter((classSkill) -> classSkill.getSkill().getTrigger().isPassive() && data.hasUnlocked(classSkill) && data.hasUnlockedLevel(classSkill))
.forEach(classSkill -> skillMap.addModifier(classSkill.toPassive(data)));
}
// This updates the player's class SCRIPTS

View File

@ -90,11 +90,15 @@ public class ClassSkill implements CooldownObject, Unlockable {
if (skill.equalsIgnoreCase(getUnlockNamespacedKey().split(":")[1]))
playerData.unbindSkill(slot);
});
//Update the stats to remove the passive skill if it is locked
if (!MMOCore.plugin.configManager.passiveSkillNeedBound && getSkill().getTrigger().isPassive())
playerData.getStats().updateStats();
}
@Override
public void whenUnlocked(PlayerData playerData) {
if (!MMOCore.plugin.configManager.passiveSkillNeedBound && getSkill().getTrigger().isPassive())
playerData.getStats().updateStats();
}
/**