Remove Keys and Children from config.yml

Discussion in 'Plugin Development' started by zeeveener, Apr 13, 2012.

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

    zeeveener

    I am having problems removing a key and its children from my config.yml

    Hypothetically, lets say the config looks like this:
    Code:
    Warps:
        Warp1:
            x:
            y:
            z:
            pitch:
            yaw:
            world:
            owner:
        Warp2:
            x:
            y:
            z:
            pitch:
            yaw:
            world:
            owner:
    How, if I input a command, would I go about removing Warp1? I have tried making it a List<String> but that messes things up.

    I have tried:
    Code:java
    1. plugin.getConfig().getConfigurationSection("Warps").set(args[0], null)


    That removes it from the server while its running. but it doesn't remove it from the config.yml.
    Is there a step that I am missing?
    Is there an easier way to handle the data?

    Any help is appreciated.
    Thanks
     
  2. You might forgot to save the file because it got removed in the cached config but not in the corresponding file.
     
    zeeveener likes this.
  3. Offline

    zeeveener

    ... I should have thought of that. Guess it took on stroke of stupidity on my part to finally understand how keys work and how to use them.

    Thank you
     
Thread Status:
Not open for further replies.

Share This Page