Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No comments for all options #22

Closed
arthurr0 opened this issue Dec 23, 2021 · 3 comments
Closed

No comments for all options #22

arthurr0 opened this issue Dec 23, 2021 · 3 comments
Labels
bug Something isn't working

Comments

@arthurr0
Copy link

arthurr0 commented Dec 23, 2021

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

@arthurr0 arthurr0 changed the title Don't write comments for all options. No comments for all options Dec 23, 2021
@dasavick
Copy link
Member

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
Copy link
Member

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 dasavick added the bug Something isn't working label Dec 25, 2021
@dasavick
Copy link
Member

dasavick commented Feb 4, 2022

Fixed in 4.0.0-beta4.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants