package xyz.upperlevel.uppercore.config.parser;

import org.bukkit.plugin.Plugin;
import org.yaml.snakeyaml.nodes.Node;
import org.yaml.snakeyaml.nodes.NodeId;
import org.yaml.snakeyaml.nodes.ScalarNode;
import xyz.upperlevel.uppercore.placeholder.PlaceholderUtil;
import xyz.upperlevel.uppercore.placeholder.PlaceholderValue;

public class PlaceholderValueParser extends ConfigParser {
    private final ConfigParser valueParser;

    public PlaceholderValueParser(ConfigParser valueParser) {
        super(PlaceholderValue.class);
        this.valueParser = valueParser;
    }

    @Override
    public PlaceholderValue parse(Node root) {
        checkNodeId(root, NodeId.scalar);
        ScalarNode node = (ScalarNode) root;// TODO: support more complex types like PlaceholderValue<List<String>> or similar
        //TODO Test Translate colors and such
        if (!PlaceholderUtil.hasPlaceholders(node.getValue())) {
            return PlaceholderValue.fake(valueParser.parse(node));
        } else {
            // Replace the node's value with the resolved placeholders value
            return (player, local) ->
                    valueParser.parse(replaceValue(node, PlaceholderUtil.resolve(player, node.getValue(), local)));
        }
    }
}

@@ -46,41 +46,8 @@
 r;%0A%0A
-import org.bukkit.plugin.Plugin;%0A
 impo
@@ -76,24 +76,24 @@
 nodes.Node;%0A
+
 import org.y
@@ -286,16 +286,63 @@
 erValue;
+%0Aimport xyz.upperlevel.uppercore.util.TextUtil;
 %0A%0Apublic
@@ -437,16 +437,59 @@
 eParser;
+%0A    private final boolean translateColors;
 %0A%0A    pu
@@ -540,24 +540,196 @@
 ueParser) %7B%0A
+        this(valueParser, valueParser.getHandleClass().equals(String.class));%0A    %7D%0A%0A    public PlaceholderValueParser(ConfigParser valueParser, boolean translateColors) %7B%0A
         supe
@@ -791,24 +791,72 @@
 alueParser;%0A
+        this.translateColors = translateColors;%0A
     %7D%0A%0A    @
@@ -1092,29 +1092,21 @@
     
-//TODO Test T
+if (t
 ranslate
  col
@@ -1105,24 +1105,108 @@
 late
- c
+C
 olors
- and such
+) %7B%0A            node = replaceValue(node, TextUtil.translatePlain(node.getValue()));%0A        %7D
 %0A   
@@ -1428,16 +1428,49 @@
 s value%0A
+            ScalarNode n = node;%0A
         
@@ -1551,19 +1551,16 @@
 eValue(n
-ode
 , Placeh
@@ -1586,19 +1586,16 @@
 layer, n
-ode
 .getValu

Add color translation to PlaceholderValue parsing