OkaeriPoland / okaeri-configs

Simple Java/POJO config library written with love and Lombok
MIT License
77 stars 11 forks source link

No comments for all options #22

Closed arthurr0 closed 2 years ago

arthurr0 commented 2 years ago

Describe the bug No comments for all configuration options. To Reproduce No errors in logs.

Library version 3.4.2

Config classes and setup routine

Configuration class
@Data
@EqualsAndHashCode(callSuper = false)
@Names(strategy = NameStrategy.HYPHEN_CASE, modifier = NameModifier.TO_LOWER_CASE)
public class LocaleMessages extends OkaeriConfig {

    @Exclude
    private MiniMessage miniMessage = MiniMessage.miniMessage();

    @Comment({
            "PL: Gdy użytkownik nie posiada uprawnień do komendy.",
            "EN: "
    })
    private Component dontHavePermission = this.miniMessage.parse("<red>You are not permitted to perform this command! <dark_gray>(<yellow>{permission}<dark_gray>)");

    @Comment({
            "PL: Gdy użytkownik nie istnieje w bazie danych.",
            "EN: "
    })
    private Component userDoesNotExist = this.miniMessage.parse("<red>User does not exist in the database.");

    @Comment({
            "PL: Gdy plugin wykryje konto premium w niedozwolonej akcji dla tego typu konta.",
            "EN: "
    })
    private Component premiumAccountDetected = this.miniMessage.parse("<red>Premium account detected!");

    @Comment({
            "PL: Gdy plugin wykryje konto cracked w niedozwolonej akcji dla tego typu konta.",
            "EN: "
    })
    private Component crackedAccountDetected = this.miniMessage.parse("<red>Cracked account detected!");

...
CofnigManager configuration
        return ConfigManager.create(clazz, it -> it
                .withConfigurer(new YamlBungeeConfigurer("#", SectionSeparator.NEW_LINE), registry -> {
                    registry.register(new StringToComponentTransformer());
                })
                .withBindFile(file)
                .saveDefaults()
                .load(true)
        );

image

dasavick commented 2 years ago

I feel like this is the issue with the > at the end of the unregister-command wrongly triggering multiline start in our simplified YAML interpreter for library-agnostic comment support.

https://github.com/OkaeriPoland/okaeri-configs/blob/master/core/src/main/java/eu/okaeri/configs/postprocessor/format/YamlSectionWalker.java#L10

dasavick commented 2 years ago

After a closer look, I believe that adding a distance check from the yaml key's colon to the end of the line would solve the issue. I will fix this in a free time for the 4.0.0 release (currently in beta).

dasavick commented 2 years ago

Fixed in 4.0.0-beta4.