forked from Upstream/mmocore
Bug Fixing for Issue#802 about passive-skill-need-bound not working.
This commit is contained in:
parent
a18a42ea2f
commit
7bf3b9ace7
@ -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
|
||||
|
@ -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();
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user