Solved Help with getting values from a config.

Discussion in 'Plugin Development' started by elementalgodz11, Apr 21, 2014.

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

    elementalgodz11

    I am trying to get all strings from a config that return a boolean for .Enabled.

    For example, this is my config:
    Code:java
    1. Kits:
    2. PvP:
    3. Enabled: true
    4. Archer:
    5. Enabled: true
    6. jamco:
    7. CurrentKit: PvP
    8.  


    I am trying to only return the ones that use .Enabled, as my current method is getting those with the .CurrentKit as well.

    Here is what I am trying to do:
    Code:java
    1. StringBuilder kitString = new StringBuilder();
    2. String prefix = "";
    3. Integer count = 0;
    4.  
    5. for (String kits : plugin.getConfig().getConfigurationSection("Kits").getKeys(false)) {
    6.  
    7. count++;
    8. kitString.append(prefix);
    9. prefix = ChatColor.WHITE + ", ";
    10. kitString.append(ChatColor.GRAY + kits);
    11.  
    12. }
    13.  
    14. sender.sendMessage(ChatColor.RED + "Kits: (" + count + "): " + kitString);


    Thanks.
     
  2. Offline

    2MBKindiegames

    Simple, just add
     
    elementalgodz11 likes this.
Thread Status:
Not open for further replies.

Share This Page