Hi! I’m currently making a custom RPG quest plugin for my server, and I’m planning to use text files to store “Flags” on each player (short strings like “CompletedQuestX” or “TalkedToNPCBob”), with each player having their own file with as many as hundreds of flags in each one. However, I’m trying to decide on how specifically to implement the function for
boolean hasFlag(Player p, String flag). Option 1 would be to load the flags from that player’s file to RAM every time, search for that flag and close it afterwards. Option 2 would be to load the files for each player whenever they log on onto the server to RAM and update their file whenever the server shuts down.
The way I see it each option has its own upsides, but I can’t decide.
- Less taxing on RAM
- Much safer if the server accidentally shuts down
- Less CPU and storage intensive (less IOPS!)
- Allows me to more easily edit flags in runtime for debugging.
What do y’all think?