Need help looping through string lists in config.

Discussion in 'Plugin Development' started by Brendyn Todd, Jun 13, 2014.

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

    Brendyn Todd

    Basically, I'm looping through a list of ranks, pulling each name and checking it for the needed kills in order to find if it is the matching rank. Although it doesn't seem to be working. Any ideas?

    Code:java
    1.  
    2. public static String checkRank(int killsrequired)
    3. {
    4. for(String s : Config.get("config.yml").getStringList("Ranks"))
    5. {
    6. if(Config.get("config.yml").getInt("Ranks." + s + ".NeededKills") == killsrequired)
    7. {
    8. return s;
    9. }
    10. }
    11. return null;
    12. }
    13.  
     
  2. Offline

    bigteddy98

    What does this do "Config.get("config.yml")"? I've never seen someone using it before. Your problem might be there. I would advise to use plugin.getConfig() instead of what you're doing now. And be sure it exists, including the information you want it to have.
     
  3. Offline

    Garris0n

    There is no 'Config' class in Bukkit, I'm assuming it's his own.
     
  4. Offline

    Brendyn Todd

    bigteddy98 Garris0n That is my own, it's basically just an utility for me to manage configs.
     
Thread Status:
Not open for further replies.

Share This Page