// Path: src/main/java/com/simon816/chatui/util/ExtraUtils.java
// public class ExtraUtils {
// 
//     public static ClickAction<?> clickAction(Runnable action, Tab tab) {
//         return clickAction(view -> {
//             action.run();
//             return true;
//         }, tab);
//     }
// 
//     public static ClickAction<?> clickAction(Consumer<PlayerChatView> consumer, Tab tab) {
//         return clickAction(view -> {
//             consumer.accept(view);
//             return true;
//         }, tab);
//     }
// 
//     public static ClickAction<?> clickAction(BooleanSupplier action, Tab tab) {
//         return clickAction((Predicate<PlayerChatView>) view -> action.getAsBoolean(), tab);
//     }
// 
//     public static ClickAction<?> clickAction(Predicate<PlayerChatView> action, Tab tab) {
//         return Utils.execClick(clickHandler(action, tab));
//     }
// 
//     public static Consumer<PlayerChatView> clickHandler(Predicate<PlayerChatView> action, Tab tab) {
//         return view -> {
//             PlayerChatView unwrapped = ChatUI.unwrapView(view);
//             if (!ChatUI.isTabActive(unwrapped, tab)) {
//                 return;
//             }
//             if (action.test(unwrapped)) {
//                 view.update();
//             }
//         };
//     }
// 
// }


import static com.google.common.base.Preconditions.checkArgument;
import com.simon816.chatui.util.ExtraUtils;
import ninja.leaping.configurate.ConfigurationNode;
import org.spongepowered.api.text.Text;
import org.spongepowered.api.text.action.ClickAction;
import org.spongepowered.api.text.action.TextActions;
import org.spongepowered.api.text.format.TextColors;
import org.spongepowered.api.text.format.TextFormat;
import org.spongepowered.api.text.format.TextStyles;


        private final Text text;

        public UnknownValueType(Object value) {
            this.text = Text.of("[Unknown] ", value);
        }

        @Override
        public Text toText(boolean focus) {
            return this.text;
        }
    }

    static class ComplexValue extends ConfigValue {

        private static final Text LINK = Text.of(TextFormat.of(TextColors.BLUE, TextStyles.UNDERLINE), "Click to open");
        private static final Text LINK_BLUR = Text.of(TextFormat.of(TextColors.DARK_GRAY, TextStyles.UNDERLINE), "Click to open");
        private final ConfigurationNode node;

        public ComplexValue(ConfigurationNode node) {
            this.node = node;
        }

        @Override
        public Text toText(boolean focus) {
            return focus ? LINK : LINK_BLUR;
        }

        @Override
        protected ClickAction<?> createClickAction(ConfigEntry entry, ConfigEditTab boundTab) {

// Path: src/main/java/com/simon816/chatui/util/ExtraUtils.java
// public class ExtraUtils {
// 
//     public static ClickAction<?> clickAction(Runnable action, Tab tab) {
//         return clickAction(view -> {
//             action.run();
//             return true;
//         }, tab);
//     }
// 
//     public static ClickAction<?> clickAction(Consumer<PlayerChatView> consumer, Tab tab) {
//         return clickAction(view -> {
//             consumer.accept(view);
//             return true;
//         }, tab);
//     }
// 
//     public static ClickAction<?> clickAction(BooleanSupplier action, Tab tab) {
//         return clickAction((Predicate<PlayerChatView>) view -> action.getAsBoolean(), tab);
//     }
// 
//     public static ClickAction<?> clickAction(Predicate<PlayerChatView> action, Tab tab) {
//         return Utils.execClick(clickHandler(action, tab));
//     }
// 
//     public static Consumer<PlayerChatView> clickHandler(Predicate<PlayerChatView> action, Tab tab) {
//         return view -> {
//             PlayerChatView unwrapped = ChatUI.unwrapView(view);
//             if (!ChatUI.isTabActive(unwrapped, tab)) {
//                 return;
//             }
//             if (action.test(unwrapped)) {
//                 view.update();
//             }
//         };
//     }
// 
// }


// Path: src/main/java/com/simon816/chatui/tabs/config/ConfigEntry.java
import static com.google.common.base.Preconditions.checkArgument;
import com.simon816.chatui.util.ExtraUtils;
import ninja.leaping.configurate.ConfigurationNode;
import org.spongepowered.api.text.Text;
import org.spongepowered.api.text.action.ClickAction;
import org.spongepowered.api.text.action.TextActions;
import org.spongepowered.api.text.format.TextColors;
import org.spongepowered.api.text.format.TextFormat;
import org.spongepowered.api.text.format.TextStyles;


        private final Text text;

        public UnknownValueType(Object value) {
            this.text = Text.of("[Unknown] ", value);
        }

        @Override
        public Text toText(boolean focus) {
            return this.text;
        }
    }

    static class ComplexValue extends ConfigValue {

        private static final Text LINK = Text.of(TextFormat.of(TextColors.BLUE, TextStyles.UNDERLINE), "Click to open");
        private static final Text LINK_BLUR = Text.of(TextFormat.of(TextColors.DARK_GRAY, TextStyles.UNDERLINE), "Click to open");
        private final ConfigurationNode node;

        public ComplexValue(ConfigurationNode node) {
            this.node = node;
        }

        @Override
        public Text toText(boolean focus) {
            return focus ? LINK : LINK_BLUR;
        }

        @Override
        protected ClickAction<?> createClickAction(ConfigEntry entry, ConfigEditTab boundTab) {

            return ExtraUtils.clickAction(() -> {
