Help with config files

Discussion in 'Plugin Development' started by cheekycharlie101, Jul 5, 2015.

Thread Status:
Not open for further replies.
  1. I'm making a simple plugin where you do /donate <rank> and it shows you the information about the rank you inputted. Here is a section of my code: http://pastebin.com/r7ZUE3aU
    if you run /donate donator it pulls the string from the config and sends it as a message to the player. My question is, how can i have this string in the config file hold more lines?
    So instead of it printing:
    this is the donator rank
    it prints:
    this is the donator rank
    - line 2
    - line 3

    The config file is litearlly just
    Code:
    donator: This is the donator rank
    How would I go about formatting in yml to have multiple lines?
     
  2. Offline

    SuperSniper

    You'd need to make the donator have more strings.

    p.sendMessage(getConfig().getString("donator");
    p.sendMessage(getConfig().getString("donator 2nd line");
     
  3. How would that look in a config file?

    Code:
    donator: line1
        - line 2
        - line 3
    
    Would this work or no?
     
  4. Offline

    SuperSniper

    it would be this in the config

    donator:
    donatorLine2:
     
  5. If I can't hold multiple lines in one variable how about using a different approach such as using a .txt file to store the info for each rank. Like the way essentials handles the /rules command, Any idea of how I could go about doing this?
     
Thread Status:
Not open for further replies.

Share This Page