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); inv.setItem(slot, display);
} else for (int j = 0; j < slots.size(); j++) } else for (int j = 0; j < slots.size(); j++)
inv.setItem(slots.get(j), display(generated, j)); inv.setItem(slots.get(j), display(generated, j));
} }
public boolean hasDifferentDisplay() { public boolean hasDifferentDisplay() {

View File

@ -263,7 +263,8 @@ public class SkillTreeViewer extends EditableInventory {
lore.add(holders.apply(inv.getPlayer(), str)); lore.add(holders.apply(inv.getPlayer(), str));
}); });
meta.setLore(lore); 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. //If it is path we remove the display name and the lore.
else { else {

View File

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

View File

@ -38,14 +38,11 @@ items:
slots: [ 9,18,27 ] slots: [ 9,18,27 ]
lore: lore:
- '' - ''
- '&aDescription:'
- '{tree-lore}' - '{tree-lore}'
- '' - ''
- '--------------------' - '&e◆ Points: &6{max-point-spent}&e/&6{point-spent}'
- '&e◆Max points&e: &6{max-point-spent}' - '&e◆ Current {name} &ePoints: &6{skill-tree-points}'
- '&e◆Points spent&e:&6 {point-spent}' - '&e◆ Current Global Points: &6{global-points}'
- '&e◆Current {name} &epoints: &6{skill-tree-points}'
- '&e◆Current Global points: &6{global-points}'
next-tree-list-page: next-tree-list-page:
function: 'next-tree-list-page' function: 'next-tree-list-page'
@ -77,6 +74,7 @@ items:
function: 'skill-tree-node' 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 ] 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 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. #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. #All the placeholders you see here can also be used in the node lore.
@ -86,24 +84,23 @@ items:
- '&7Current Level: &6{current-level}' - '&7Current Level: &6{current-level}'
- '&7Max Level: &6{max-level}' - '&7Max Level: &6{max-level}'
- '&7Max Children: &6{max-children}' - '&7Max Children: &6{max-children}'
- '&7Points required: &6{point-consumed}' - '&7Points Required: &6{point-consumed}'
- '&7Size: &6{size}' - '&7Size: &6{size}'
- '--------------------' - ''
- '&7⧆ &6Requirements: ' - '&7⧆ &6Requirements: '
- '&fStrong Parents: ' - '&fStrong Parents: '
- '{strong-parents}' - '{strong-parents}'
- '' - ''
- '&fSoft Parents: ' - '&fSoft Parents: '
- '{soft-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. #This is the name that will be displayed for each status.
status-names: status-names:

View File

@ -50,6 +50,7 @@ items:
function: 'skill-tree-node' 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 ] 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 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. #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. #All the placeholders you see here can also be used in the node lore.
@ -61,22 +62,21 @@ items:
- '&7Max Children: &6{max-children}' - '&7Max Children: &6{max-children}'
- '&7Points required: &6{point-consumed}' - '&7Points required: &6{point-consumed}'
- '&7Size: &6{size}' - '&7Size: &6{size}'
- '--------------------' - ''
- '&7⧆ &6Requirements: ' - '&7⧆ &6Requirements: '
- '&fStrong Parents: ' - '&fStrong Parents: '
- '{strong-parents}' - '{strong-parents}'
- '' - ''
- '&fSoft Parents: ' - '&fSoft Parents: '
- '{soft-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. #This is the name that will be displayed for each status.
status-names: status-names: