No Clue

Discussion in 'Plugin Development' started by Ravada, Jul 1, 2016.

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

    Ravada

    Been a while since I've been coding Bukkit.

    http://dev.bukkit.org/bukkit-plugins/kitadder

    My plugin deletes comments in Essentials config, and it basically messes up the save. Any idea how to let it not altar configurations? I wanna fix this for people, but I'm unsure since I haven't been at it for a while.

    Thanks~
     
  2. @Ravada
    We can't help you unless you show us your code. Do you have a specific class or method that edits the Essentials config?
     
  3. Offline

    Ravada

  4. Offline

    Jakeeeee

    Correct me if I'm wrong but the #save function will remove comments except a header.

    Edit: The only way I know how to keep the comments is through getting the "resource file" in eclipse and copying it to the target file.
     
    Last edited: Jul 1, 2016
  5. Offline

    Ravada

    How do I do that?
     
  6. Offline

    Jakeeeee

    Try playing around with these functions: link
     
  7. Offline

    Ravada

    I use the save one, so why would the other be different? :eek:
     
  8. Offline

    Ravada

    Really unsure now. Can someone who has a plugin that writes to config and doesn't delete comments help?
     
  9. Offline

    ArsenArsen

    saveResource doesn't remove it.
     
  10. Offline

    Ravada

    saveResource, how could I use that to load my config, and save it. So far, I'm copying the Essentials config to my KitAdder folder, then I wanna try load the Essentials config, then make the changes using saveResource, so the comments aren't removed, then copy the file back.
     
  11. Offline

    ArsenArsen

    Well.. You can't. If you edit using bukkits native YamlConfiguration it will remove it no matter what you do. You can make your own parser. SnakeYAML is bundled with bukkit, but it would take a while =(
     
  12. Offline

    Ravada

    @ArsenArsen So basically I can't fix my plugin so it doesn't remove comments? ;o
     
  13. Offline

    ArsenArsen

    As I said, but thats a big hassle, or find a library that fixed it. Basically it is possible, but it takes work.
     
  14. Offline

    Ravada

    @ArsenArsen Well I guess I could edit my plugin to just, put in a config file what the people should paste into Essentials then.
     
Thread Status:
Not open for further replies.

Share This Page