Setting lists for a custom config? Weird Error?

Discussion in 'Spigot Plugin Development' started by Inkzzz, May 2, 2015.

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

    Resource Staff

    Hello there, I'm setting an String list for a custom config, and I'm getting a weird variable?

    Here's the YML file:
    Code (Text):
        '2':
          Name: '&a&lBreak 100 Blocks!'
          Description: '&fBreak 100 blocks!'
          Rewards: '&fx1 Token'
          Commands: *id001
    I'm getting *id001?

    Here's the code where I set the data
    Code (Text):
    if(getData().getConfigurationSection("Achievements") == null) {
               
                ArrayList<String> commands = new ArrayList<>();
               
                commands.add("tokens give %name% 1");
               
                getData().set(ach + bb + "1.Name", "&a&lBreak 1 Block!");
                getData().set(ach + bb + "1.Description", "&fBreak one block!");
                getData().set(ach + bb + "1.Rewards", "&fx1 Token");
                getData().set(ach + bb + "1.Commands", commands);
               
                getData().set(ach + bb + "2.Name", "&a&lBreak 100 Blocks!");
                getData().set(ach + bb + "2.Description", "&fBreak 100 blocks!");
                getData().set(ach + bb + "2.Rewards", "&fx1 Token");
                getData().set(ach + bb + "2.Commands", commands);
               
                saveData();          
            }
     
  2. gigosaurus

    Supporter

    I'm going to guess that 1.Commands saved correctly?
    Try setting commands.toArray() instead of just commands.
     
  3. Inkzzz

    Resource Staff

    Thanks, I fixed this a couple of minutes after I posted it, waiting for deletion.
     
Thread Status:
Not open for further replies.