Use YML?

Discussion in 'Plugin Development' started by repsor, Feb 1, 2013.

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

    repsor

    Hello everyone!

    I'm having some doubts about the usage of a YML file to store in playerdata. In the most of my plugins, I use a YML file to store in the ranks of players (like: <playername>: <rank> ). With small plugins this works, but in some of my bigger plugins I store more of a player than just a rank
    like:
    Code:
    <playername>: <rank>
                                                <nametag>
                                                <random>
      
    Normally this works fine, but since a few days my plugin (for one or another reason) deletes parts within the .YML file (it seems pretty random to me :) ). So that brings me to my questions:

    1. Does anyone know why the plugin delets parts of the .YML file? Is it some kind of general bug?
    2. How safe is it to use a YML file to store in playerdata for a server with 50+ players? Should I use YML or something else?
     
  2. Ok for player data or any type of data use a
    Code:
    .dat
    File to store data of anything
     
  3. Offline

    repsor

    Uhm.... I guess that when you use a .dat file you have to use the normal I/O stream of java? I've only worked with txt-files before using YML, never with .dat :)
     
  4. Yes you do BukkitAPI does not have it in there but you can make it run when a player joins or leaves just look at essentials they have a similar system to this and it wouldn't hurt to look at the SRC
     
  5. Offline

    repsor

    Sorry but I don't get what you're trying to say with your last sentence :)
     
  6. The plugin essentials has a system when a player joins it makes a file of the player
     
  7. Offline

    repsor

    oh OK thanks for your help :)

    One last question: do you know what may be wrong with my plugin that sometimes removes parts from the YML? (I still want to use YML for something else, but I won't use YML for the playerfiles)
     
  8. Offline

    gomeow

  9. Offline

    repsor

    Haha thanks but I already know how to use it a long time. The question is: does anyone know why sometimes the file delets parts? Did you ever have that problem?
     
  10. Offline

    Ne0nx3r0

    My guess is that certain values are null or are not being saved, so when it overwrites the file they are then "missing."
     
  11. Offline

    repsor

    hm..... I guess that's possible. Thanks for the help!
    ps. what do you think? Is YML "safe" enough for a medium/big server "database"?

    So I guess you get something like:

    Code:
    FileInputStream PlayerFIS = new FileInputStream("<Playername>.dat");
    ObjectInputStream PlayerOIS = new ObjectInputStream(PlayerFIS);
    Object object = PlayerOIS.readObject();
    Is this OK? If not, could you please show how to use a .dat file?

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: May 31, 2016
  12. Offline

    Ne0nx3r0

    It all depends on what you are using it for. For example, Essentials uses individual YML files to store player data, and this is a pretty decent way to manage the Essentials data.

    For an economy plugin however, a database is all but required.
     
  13. Offline

    AbsolutePotato

    .bin, and ObjectOutputStream/ObjectInputStream maybe?
     
Thread Status:
Not open for further replies.

Share This Page