need help: (config.yml) adding line breaks or nodes?

Discussion in 'Plugin Development' started by Vaupell, Jul 24, 2011.

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

    Vaupell

    Been working on creating a config.yml file
    which works out just fine.

    i use (snippits)
    Code:
    import org.bukkit.util.config.Configuration;
    
    Configuration config;
    
    //New config
    config = new Configuration(new File(getDataFolder() , "config.yml"));
    
    try{
    config.load();
    } catch(Exception ex) {
    //ignore error for now, plan console msg + serverlog usefull message
    }
    
    // Read config settings
    final String msg1 = config.getString("msg1", "Message 1");
    final String msg2 = config.getString("msg2", "Message 2");
    final String msg3 = config.getString("msg3", "Message 3 ");
    
    config.save(); 
    It creates the file, and everything is fine ;)

    when i look in the file everything is just put in a single line, not really that helpfull for a config
    file, so wondering how to add line breaks ?
     
  2. Offline

    Hretsam

    Where do you put something in the config file?
     
  3. Offline

    Vaupell

    I dont understand your question, but let me try to elaborate

    My config looks like this now
    Code:
    msg3: ' Message 3 ' msg1: ' Message 1' msg2: ' Message 2'
    
    I have no idea why it puts them in that order, its generated by bukkit.
    anyway i would prefer it to look like
    Code:
    msg1: ' Message 1'
    msg2: ' Message 2'
    msg3: ' Message 3 '
    
    and later when i figure out how to use nodes, but still to rookie for that.
    Code:
    messages:
         msg1: ' Message 1'
         msg2: ' Message 2'
         msg3: ' Message 3 '
    
     
  4. Offline

    Hretsam

Thread Status:
Not open for further replies.

Share This Page