Using .yml files

Discussion in 'Plugin Development' started by kabbage, Mar 27, 2012.

  1. Offline

    kabbage

    My BukkitDev Profile
    My Plugins (1)
    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Minecraft account:
    MCUSERNAME
    If I had a .yml file that looked like this:
    Code (Text):
    1. users:
    2.   kabbage:
    3.     num: 17
    How would I load the file and get the number 17, and then how would I change that number to something else? (like 18)
     
  2. Offline

    Tzeentchful

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Minecraft account:
    MCUSERNAME
    if you have any more questions to do with configs go to the wiki.

    Code (Text):
    1. int num = getConfig().getInt("users.kabbage.num");
    2.  
    3. getConfig().set("users.kabbage.num", 666);
     
  3. Offline

    kabbage

    My BukkitDev Profile
    My Plugins (1)
    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Minecraft account:
    MCUSERNAME
    I don't mean the config.yml file, I need to edit a different file that also has the extension of .yml.
     
  4. Offline

    Lolmewn Retired Staff

    My BukkitDev Profile
    My Plugins (11)
    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Minecraft account:
    MCUSERNAME
    YamlConfiguration config = YamlConfiguration.loadConfiguration(someFile);
     

Share This Page