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?
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
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
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)
I usually have a players.yml which would work fine. Just have a config like this: Code: gomeow: rank: Owner points: 50 something-else: 1000 How to make the players.yml: https://github.com/gomeow/BukkitSer...serverforbukkitpeople/util/PlayersConfig.java Then to use it: Look at how I do it in the main.java pc.getPlayers().getInt("path");
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?
My guess is that certain values are null or are not being saved, so when it overwrites the file they are then "missing."
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.
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.