Tree node will get latest level lore available

This commit is contained in:
Jules 2023-10-08 01:48:36 +02:00
parent 6bcfc0aad8
commit bc9f5ac6f8

View File

@ -256,16 +256,19 @@ public class SkillTreeNode implements ExperienceObject {
} }
public List<String> getLore(PlayerData playerData) { public List<String> getLore(PlayerData playerData) {
Placeholders holders = getPlaceholders(playerData); final int nodeLevel = playerData.getNodeLevel(this);
List<String> parsedLore = new ArrayList<>(); final List<String> parsedLore = new ArrayList<>();
if (!lores.containsKey(playerData.getNodeLevel(this)))
return parsedLore; for (int i = nodeLevel; i >= 0; i--) {
final List<String> found = lores.get(i);
if (found == null) continue;
final Placeholders holders = getPlaceholders(playerData);
found.forEach(string -> parsedLore.add(MythicLib.plugin.parseColors(holders.apply(playerData.getPlayer(), string))));
break;
}
List<String> lore = lores.get(playerData.getNodeLevel(this));
lore.forEach(string -> parsedLore.add(
MythicLib.plugin.parseColors(holders.apply(playerData.getPlayer(), string))));
return parsedLore; return parsedLore;
} }
@Override @Override