Solved How to use the data file correctly?

Discussion in 'Plugin Development' started by stijnb1234, Oct 20, 2017.

Thread Status:
Not open for further replies.
  1. Hello,

    I have a question about my data file.
    As the basic, I want to make my data file like this:
    Code:
    Data:
      Coaster:
        Name:
          location:
          signenabled: false
          signlist: {}
      List:
      - Name
    And if I make a sign with something on it (I already have that code), he need to add the information of the sign in the data like this:

    Code:
    Data:
      Coaster:
        Name:
          location:
          signenabled: true
          signlist:
            sign1:
              location:
      List:
      - Name
    And how do I make it so that players can add more signs, like this?:

    Code:
    Data:
      Coaster:
        Name:
          location:
          signenabled: true
          signlist:
            sign1:
              location:
            sign2:
              location:
      List:
      - Name
    And how do I need to save the location and on a other place in my code get it and teleport to that location?
     
    Last edited: Oct 20, 2017
  2. Offline

    MightyOne

    who is he? the plugin?

    So if I get this right you are talking about how to add more subnodes in a config. You want to store multiple signs. And then you want to know how to write and read a Location to and from a config.yml.
     
  3. Yes. He is the plugin :p:p

    And yes. You're right. I already have the code to save and read an location to the config, so I don't need a answer to that anymore.
     
  4. Offline

    Horsey

    Ah well in English, we refer to inanimate objects as 'it'.

    You can use Config#getList() which returns a list and then use list.add(Location) and then Config#set(List);
     
Thread Status:
Not open for further replies.

Share This Page