Deleting a section in a config

Discussion in 'Plugin Development' started by Prothean_IGS, Mar 25, 2014.

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

    Prothean_IGS

    Hello, I am trying to delete an entire section in the config via command, but I can not seem to figure out how to do it. I don't want to just set the section to nothing, I want the section it self gone.

    Example of what the config would look like:
    Code:
    Banks
      ExampleBank
          Owner: ExampleName
          Accounts
              Account1: 250
              Account2: 350 //I want to remove this section
     
  2. Prothean_IGS
    Code:java
    1. getConfig().set("your.path", null);
     
  3. Offline

    rfsantos1996

    Code:java
    1. getConfig().getConfigurationSection("banks.examplebank.owner.accounts").set("account2", null);
    2. // setting null will delete the entry

    http://jd.bukkit.org/rb/apidocs/org...onfigurationSection.html#set(java.lang.String, java.lang.Object)

    @EDIT; yeah, you can do .set(path, null) direcly, I just searched on Configuration section on bukkits' javadocs
     
Thread Status:
Not open for further replies.

Share This Page