Solved Replace path key in yaml file ?

Discussion in 'Plugin Development' started by ThunderWaffeMC, Jul 30, 2014.

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

    ThunderWaffeMC

    Hi. Is it possible to replace a path key in a yaml file? For example:

    I want to change:

    Code:
    Key:
      Some value: 'test'
      Some other value: 1
      Enable some value: true
    
    to:

    Code:
    New Path Key Name:
      Some value: 'test'
      Some other value: 1
      Enable some value: true
    
    How can I do this without having to delete the values and re setting them? If something like below exists, what would it be?

    plugin.getConfig().replacePath("Old path", "New path");

    Cheers!
     
  2. Offline

    messageofdeath

    I would get all the values and store them in variables. Then set all those old paths to null to remove them from the file, then set the new paths with the values. That's what comes to mind.
     
  3. Offline

    ThunderWaffeMC

    Yeah I may have to do this.
     
Thread Status:
Not open for further replies.

Share This Page