No Clue

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

Thread Status:
Not open for further replies.
  1. Been a while since I've been coding Bukkit.

    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.

  2. Offline


    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


    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
  4. How do I do that?
  5. Offline


    Try playing around with these functions: link
  6. I use the save one, so why would the other be different? :eek:
  7. Really unsure now. Can someone who has a plugin that writes to config and doesn't delete comments help?
  8. Offline


    saveResource doesn't remove it.
  9. 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.
  10. Offline


    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 =(
  11. @ArsenArsen So basically I can't fix my plugin so it doesn't remove comments? ;o
  12. Offline


    As I said, but thats a big hassle, or find a library that fixed it. Basically it is possible, but it takes work.
  13. @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