CraftMinecraft / BungeeYAML

Port of Bukkit's configuration api to BungeeCord
4 stars 7 forks source link

New empty line at beginning of config file #1

Open mickare opened 11 years ago

mickare commented 11 years ago

Every time I start my proxy with the BungeeBan Plugin that uses this "Library" an empy new line is inserted at the beginning of the config file.

# BungeeBan Main Config

storagetype: mysql
....

The new empty line is inserted after the first comment "# BungeeBan Main Config".

Config.java:75 - When the loop went through it adds an additional new line char. But if there is already a new line char, then ... aah you understand what i mean...

for(String line : CONFIG_HEADER.split("\n")) {
       newConfig.write("# "+line+"\n");
}

Because you already add a new line if there is already one in YAMLConfiguration:42-45

        StringBuilder builder = new StringBuilder(buildHeader());
        if (builder.length() > 0) {
            builder.append('\n'); // newline after header, if present.
        }
roblabla commented 11 years ago

That's not the problem, I think. Config.java has nothing to do with it, only the Bukkit API is responsible for this. I need to rewrite the whole plugin to have another "backbone" API that's not like Bukkit's, because of licensing issues.