Solved how can i put in map from yml?

Discussion in 'Spigot Plugin Development' started by armyagira, Aug 2, 2019.

Thread Status:
Not open for further replies.
  1. i just want to put in yml to map

    Code (YAML):
    LV:
      '1'
    : 70
      '2'
    : 105
      '3'
    : 140
      '4'
    : 175
      '5'
    : 210
      '6'
    : 245
      '7'
    : 280
      '8'
    : 315
      '9'
    : 350
      '10'
    : 385
      '0'
    : 35
    Code (Java):
            for (String s : getConfig().getConfigurationSection("LV").getKeys(false)) {
                   String value = getConfig().getString("LV");
                   lvdata.put(s,value);
                }
    i try this..
    but its not work
    i dont know how.. help!..
     
  2. You just need to change your value string right??
    Code (Text):
    String value = getConfig().getString("LV." + s);
     
    • Like Like x 1
    • Agree Agree x 1
  3. Do you save the YamlConfiguration to a file later?
     
    • Like Like x 1
  4. oh sorry its already solved

    Code (Java):
    for(int i = 0; i < lvconfig.getConfigurationSection("LV").getKeys(false).size(); i++) {
                Bukkit.broadcastMessage(prefix + lvconfig.getConfigurationSection("LV").getKeys(false).size());
                lvdata.put("LV."+i, lvconfig.get("LV."+i)+"");
                Bukkit.broadcastMessage(prefix + "value : " + lvdata.get("LV."+i));
            }
     
Thread Status:
Not open for further replies.