How to get specific things from config?

Discussion in 'Plugin Development' started by pluginsbyjason, Jun 2, 2014.

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

    pluginsbyjason

    How can I grab all the P1 and P2's from the config file and place them into an arraylist?
    Code:
    Mines:
      minename1:
        p1: 15,15,15
        p2: 16,16,16
        active: true
        time: 15
      minename2:
        p1: 18,18,18
        p2: 19,19,19
        active: true
        time: 15
     
  2. Offline

    thecrystalflame

    Code:java
    1.  
    2. List<Integer> p1 = new ArrayList<Integer>();
    3.  
    4. public void setP1(Plugin plugin) {
    5. p1 = plugin.getConfig().getList(path);
    6. }
    7.  


    dont hold me to that im on my phone at school but its something along those lines.
     
    pluginsbyjason likes this.
  3. Offline

    1Rogue

    You shouldn't keep separate arraylists representing data for different things. Make a ConfigurationSerializable class that represents a mine. Read up on the documentation on how you can go about doing this. Here's an example
     
    pluginsbyjason likes this.
  4. Offline

    pluginsbyjason

    Thanks for the advice and the example!
     
Thread Status:
Not open for further replies.

Share This Page