Default color for skill tree node names

This commit is contained in:
Jules 2023-10-08 01:22:44 +02:00
parent 35484b5893
commit 90706ae97c
5 changed files with 27 additions and 30 deletions

View File

@ -112,7 +112,6 @@ public abstract class InventoryItem<T extends GeneratedInventory> {
inv.setItem(slot, display);
} else for (int j = 0; j < slots.size(); j++)
inv.setItem(slots.get(j), display(generated, j));
}
public boolean hasDifferentDisplay() {

View File

@ -263,7 +263,8 @@ public class SkillTreeViewer extends EditableInventory {
lore.add(holders.apply(inv.getPlayer(), str));
});
meta.setLore(lore);
meta.setDisplayName(node.getName());
final String name = meta.getDisplayName();
meta.setDisplayName(name == null || name.isEmpty() ? node.getName() : name);
}
//If it is path we remove the display name and the lore.
else {

View File

@ -85,8 +85,8 @@ public class SkillTreeNode implements ExperienceObject {
for (String key : config.getConfigurationSection("lores").getKeys(false))
try {
lores.put(Integer.parseInt(key), config.getStringList("lores." + key));
} catch (NumberFormatException e) {
throw new RuntimeException("You must only specifiy integers in lores.");
} catch (NumberFormatException exception) {
throw new RuntimeException("You shall only specify integers in the 'lores' config section");
}
Validate.isTrue(config.contains("experience-table"), "You must specify an exp table");
@ -232,7 +232,6 @@ public class SkillTreeNode implements ExperienceObject {
return NodeType.getNodeType(hasUpPathOrNode, hasRightPathOrNode, hasDownPathOrNode, hasLeftPathOrNode);
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
@ -261,6 +260,7 @@ public class SkillTreeNode implements ExperienceObject {
List<String> parsedLore = new ArrayList<>();
if (!lores.containsKey(playerData.getNodeLevel(this)))
return parsedLore;
List<String> lore = lores.get(playerData.getNodeLevel(this));
lore.forEach(string -> parsedLore.add(
MythicLib.plugin.parseColors(holders.apply(playerData.getPlayer(), string))));

View File

@ -38,14 +38,11 @@ items:
slots: [ 9,18,27 ]
lore:
- ''
- '&aDescription:'
- '{tree-lore}'
- ''
- '--------------------'
- '&e◆Max points&e: &6{max-point-spent}'
- '&e◆Points spent&e:&6 {point-spent}'
- '&e◆Current {name} &epoints: &6{skill-tree-points}'
- '&e◆Current Global points: &6{global-points}'
- '&e◆ Points: &6{max-point-spent}&e/&6{point-spent}'
- '&e◆ Current {name} &ePoints: &6{skill-tree-points}'
- '&e◆ Current Global Points: &6{global-points}'
next-tree-list-page:
function: 'next-tree-list-page'
@ -77,6 +74,7 @@ items:
function: 'skill-tree-node'
slots: [ 1,2,3,4,5,6,7,8,10,11,12,13,14,15,16,17,19,20,21,22,23,24,25,26,28,29,30,31,32,33,34,35,37,38,39,40,41,42,43,44 ]
name: '&a{name}'
#The lore that will be displayed after the lore of the node.
#The {node-lore} placeholder will be replaced by the lore specified in the skill tree node config.
#All the placeholders you see here can also be used in the node lore.
@ -86,24 +84,23 @@ items:
- '&7Current Level: &6{current-level}'
- '&7Max Level: &6{max-level}'
- '&7Max Children: &6{max-children}'
- '&7Points required: &6{point-consumed}'
- '&7Points Required: &6{point-consumed}'
- '&7Size: &6{size}'
- '--------------------'
- ''
- '&7⧆ &6Requirements: '
- '&fStrong Parents: '
- '{strong-parents}'
- ''
- '&fSoft Parents: '
- '{soft-parents}'
- '--------------------'
- '{node-lore}'
- '--------------------'
- '&e◆Max points for {skill-tree}&e: &6{max-point-spent}'
- '&e◆Points spent for {skill-tree}&e:&6 {point-spent}'
- '&e◆Current {skill-tree} &epoints: &6{skill-tree-points}'
- '&e◆Current &6global&e points: &6{global-points}'
path-lore:
- ''
- '{node-lore}'
- ''
- '&e◆ Max points for {skill-tree}&e: &6{max-point-spent}'
- '&e◆ Points spent for {skill-tree}&e:&6 {point-spent}'
- '&e◆ Current {skill-tree} &ePoints: &6{skill-tree-points}'
- '&e◆ Current &6global&e points: &6{global-points}'
path-lore: []
#This is the name that will be displayed for each status.
status-names:

View File

@ -50,6 +50,7 @@ items:
function: 'skill-tree-node'
slots: [ 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44 ]
name: '&a{name}'
#The lore that will be displayed after the lore of the node.
#The {node-lore} placeholder will be replaced by the lore specified in the skill tree node config.
#All the placeholders you see here can also be used in the node lore.
@ -61,22 +62,21 @@ items:
- '&7Max Children: &6{max-children}'
- '&7Points required: &6{point-consumed}'
- '&7Size: &6{size}'
- '--------------------'
- ''
- '&7⧆ &6Requirements: '
- '&fStrong Parents: '
- '{strong-parents}'
- ''
- '&fSoft Parents: '
- '{soft-parents}'
- '--------------------'
- '{node-lore}'
- '--------------------'
- '&e◆Max points for {skill-tree}&e: &6{max-point-spent}'
- '&e◆Points spent for {skill-tree}&e:&6 {point-spent}'
- '&e◆Current {skill-tree} &epoints: &6{skill-tree-points}'
- '&e◆Current &6global&e points: &6{global-points}'
path-lore:
- ''
- '{node-lore}'
- ''
- '&e◆ Max points for {skill-tree}&e: &6{max-point-spent}'
- '&e◆ Points spent for {skill-tree}&e:&6 {point-spent}'
- '&e◆ Current {skill-tree} &epoints: &6{skill-tree-points}'
- '&e◆ Current &6global&e points: &6{global-points}'
path-lore: []
#This is the name that will be displayed for each status.
status-names: