Solved Config Stringlist Outputting

Discussion in 'Plugin Development' started by MrFrozen, Jan 8, 2016.

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

    MrFrozen

    Dear Community,

    I just started making a plugin again and I bounced my head against a little string lost issue, the issue happens with this YML File:
    Code:
    sets:
      creative:
        - &eSeperated Inventory
        - &e1
        - &c2
        - &c3
    To output the rules from ruleset creative with this code:
    Code:
    if(yml.isSet("sets."+arg[0].toLowerCase()))
                        {
                            Message.header(p, ChatColor.WHITE, "Ruleset - " + WordUtils.capitalize(arg[0]));
                            for(String line : yml.getConfigurationSection("sets").getStringList(arg[0].toLowerCase()))
                            {
                                System.out.println("[Method1] " + line);
                                Message.msg(p, "" + ChatColor.GREEN + ChatColor.BOLD + "- " + colorize(line));
                            }
                            for(int i=0;i<yml.getStringList("sets."+arg[0].toLowerCase()).size();i++) {
                                String s = yml.getStringList("sets."+arg[0].toLowerCase()).get(i);
                                System.out.println("[Method2] " + s);
                            }
                        }else
                        {
                            Message.note(p, Note.ERROR, "This ruleset is undefined and cannot be loaded");
                        }
    Apprently It doesnt work and ingame it will display http://prntscr.com/9nil68 and in the console it gives back those lines:
    Code:
    [13:57:51 INFO]: [Method1] Inventory
    [13:57:51 INFO]: [Method2] Inventory
    
    What am I doing wrong here?
     
  2. Offline

    Zombie_Striker

    @MrFrozen
    So you have two words in the saves string, but it only prints out the second world. Could this be your problem? Try adding this to all the other strings to see if that makes a difference:
    Code:
    - &c1 One
    - &c2 Two
    - &c3 Three
     
    ProSl3nderMan likes this.
  3. Offline

    MrFrozen

    Thanks!
     
Thread Status:
Not open for further replies.

Share This Page