How to remove a section from a yml?

Discussion in 'Plugin Development' started by FiberSprite, Aug 21, 2014.

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

    FiberSprite

    So im coding a Kits plugin and i am making a void to delete kits that are made. I cant figure out how to remove a section that is made in a yaml. i already have it so it finds the kit/section you put in but i cant figure out how i would delete it.

    Please help me c:


    Code:java
    1. public void deleteKit(Player p, String kitName)
    2. {
    3. if(plugin.ckits.getConfigurationSection("kits." + kitName) == null)
    4. {
    5. p.sendMessage(kitName + "does not exist!");
    6. return;
    7. }
    8. ConfigurationSection s = plugin.ckits.getConfigurationSection(kitName);
    9.  
    10. }
    11.  
     
  2. Offline

    Dragonphase

    FiberSprite

    Just set it to null:

    Code:java
    1. plugin.ckits.set(kitName, null);


    I would also make ckits private, and create a public getter method. For example, plugin.getCKits();
     
Thread Status:
Not open for further replies.

Share This Page