Write to .yml inside the jar

Discussion in 'Plugin Development' started by Shaner_X, Nov 22, 2016.

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


    I am trying to store player information in .yml files located in the plugin.yml's directory. Is there any way to write and/or read to those files?
  2. Offline

    timtower Administrator Administrator Moderator

    @Shaner_X Why would you store it in the jar itself?
    Bukkit can create a folder to store stuff in for you.
  3. Offline


    You can't modify files inside jar files while the plugin is active. In other words, you can't.

    You can write to a yml file outside of the jar file. A recommended location would be your plugin's folder:
    ( /plugin/<name>/ )
  4. Offline



    Furthermore, the file descriptor of that folder can be accessed with Plugin#getDataFolder().
  5. Offline


    Because I don't want administrators to see the data: for example, let's pretend I had a plugin which adds /god. If I had an array list store the names of the players who are in god mode, that list would be wiped when the server gets shutdown/reloaded. Furthermore, I dont see any reason why admins should see that list in a config file, hence I was wondering it I could store the data in the jar. Obviously, using a database does not make sense;
Thread Status:
Not open for further replies.

Share This Page