Bukkit's config.yml thingie. Worked fine...

Discussion in 'Plugin Development' started by MuisYa, Oct 27, 2011.

Thread Status:
Not open for further replies.
  1. Offline

    MuisYa

    Oke, so my problem is the Bukkit config.yml
    When i put the following code in my plugin's onEnable():
    Code:
            String header = (
            "#-------------------------------------------------------------" + "\n" +
            "#----------------YouControl configuration file.---------------" + "\n" +
            "#-----------Made by MuisYa for the YouCombat server.----------" + "\n" +
            "#--------If you got any questions? Ask me on bukkit.org-------" + "\n" +
            "#-------------------------------------------------------------" + "\n\n\n" +
     
            "#--------------------Configuration settings:------------------" + "\n" +
            "#On what key the \"YouControl\" main panel should popup."       + "\n" +
            "Normal-popup: F6"                                               + "\n\n" +
    
            "#On what key the \"YouControl\" player panel should popup."     + "\n" +
            "Player-popup: F7"                                               + "\n\n" +
    
            "#What message should be broadcasted if someone gets warned?"    + "\n" +
            "#Colour codes can be used, for instance: &9 blue, &f white."    + "\n" +
            "The-warning: '&9 %player% &fhas been warned by &9%admin%&f.'"   + "\n\n\n" +
     
            "#--------------------The chat color settings:-----------------" + "\n" +
            "#The color of \"YouControl\"."                                  + "\n" +
            "Prefix-color: '&9'"                                             + "\n\n" +
    
            "#The color of \"[]\"."                                          + "\n" +
            "Brackets-color: '&f'"                                           + "\n\n" +
    
            "#The color of the text YouControl sends to players."            + "\n" +
            "Text-color: '&f'");
    And:
    Code:
                config = getConfiguration();
                config.setHeader(header);
                config.save();
    
                normalPopupKey = config.getString("Normal-popup", "F6");
                playerPopupKey = config.getString("Player-popup", "F7");
                bracketsColor = config.getString("Brackets-color", "&f").replaceAll("(&([a-f0-9]))", "§$2");
                prefixColor = config.getString("Prefix-color", "&9").replaceAll("(&([a-f0-9]))", "§$2");
                textColor = config.getString("Text-color", "&f").replaceAll("(&([a-f0-9]))", "§$2");
                warnMessage = config.getString("The-warning", "%player% has been warned by %admin%.").replaceAll("(&([a-f0-9]))", "§$2");

    I say, it should create a normal config.
    And yes it does so! But at the end of the config.yml there is this text: "{}"
    For no reason? Does someone know how to fix this...

    Maybe @Walker Crouse knows it? :D

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: May 20, 2016
Thread Status:
Not open for further replies.

Share This Page