Attention: Plugin creators who use flatfiles!

Discussion in 'Plugin Development' started by Phraggah, Jan 5, 2011.

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



    So like, can we all start using a /cfg folder for our flatfiles now?
    And maybe a /dat for storing information?

    I realize this doesn't help the number, but at least we won't have to look at it every time we go into our bin directory.
    tommytony likes this.
  2. Offline

    Geoff Winans

    I'd also be preferential to a structure such as this:

    Root /
         - Startup scripts
             -  bukkit_mod.jar
             -  sqllite_binary (.exe or linux binary)
             - /plugin_name/plugin.jar
             - /plugin_name/config/*.txt <---yuck, but some like this?
  3. Offline


    At first I thought it was a great idea but then I realized with bukkit's ability to have communication between plugin, it will not be very efficient of having them stored per plugin, I am up to having it like so.

    Root /
         - Startup scripts
             -  bukkit_mod.jar
             -  sqllite_binary (.exe or linux binary)
             - plugin.config.txt
             - plugin.jar
  4. Offline


    I've been working on this for a few days for minecraft. Perhaps it will help:
    You will also need this:

    Brain dead simple key-value store so that anything that doesn't have to be human readable (or anything you are willing to write an external tool to talk to the humans for) can end up in a DB without anyone having to be a DBA or worry about their database's schema being up to date.

    Caveats: I just wrote it in the last few days without any code review (but it is small, so that will take no time) and it uses Java's serialization. I don't think that is a bug at all, since writing CRUD functions isn't terribly productive. Last, the default user facing class stores everything into a hashtable so that reads are always from memory. It loads everything on startup as it stands. This need not be done, but given the amount of data I see most plug-ins store that will be no problem. I plan to also add a "limited cache" version for uses where it CAN get out of hand.

    Let me know if anyone will find it useful and I'll try to make it better if so.
    Sosser and alkeiser like this.
  5. Offline


    One thing i found that works is, just modify the startup script so it cd into the folder where you want to the config files to be stored, stick in a symlink for plugins folder (or just move it there) and the point the script to the mcmod file.
  6. Offline


    Ofc, some OS options (windows :) ), don't let you do this.
  7. Offline


    Don't let you do what? Create directories, if that's what you are saying... I'm sorry you are wrong.
  8. if a plugin uses flatfiles they should all be in one big flatfile called with headders for each plugin
  9. Offline


    No way too cluttered plus read/writes would throw concurrent modification or lock errors constantly. Separate directories for each plugin or a directory called configurations/ or data/ is fine.
  10. Offline


    I meant create symbolic links.

    I added something similar as a suggestion: Properties Manager suggestion

    The idea would be that plugins just use the PropertiesManager and they don't care how the properties are actually stored. It could have mostly the same methods as PropertiesFile.

    Plugins could even override the standard implementation.

    There were be two interfaces.

    PropertiesManager and PropertiesTable

    PropertiesTable would just be a single file or database table.

    Something like

    PropertiesManager pm = getServer().getPropertiesManager();
    PropertiesTable pt  = pm.getTable( "TableName" );
    int value = pt.getInt( "recordName" );
    PropertiesTable pt2  = pm.getTable( "OtherPlugin", "TableName" );
    int  valueFromOtherPlugin = pt2.getInt( "recordName" );
    When in flat file mode, the TableName would become the filename.

    The property files could be placed in a defined sub-directory. If it has a file separator, that puts in a further subdirectory.

    pm.getTable( "records/table.txt" );

    would be placed in


    When in SQL mode, it would be placed in a table called


    --- merged: Jan 6, 2011 1:22 PM ---

    There could also be things like

    String[] strings = someFunction();

    pt.setStringArray( "arrayName" , strings );

    String string = pt.getStringArrayElement( "arrayName" , 7 );

    This will allow storing of general Objects, by requiring that the objects implement/override the .toString() method and an className( String string ) constructor.

    pt.setObjectArray( "arrayName" , objects );

    would go through each element in the objects array and call .toString() and then add that to the database, as a string.

    Object[] objects = pt.getObjectArray( "arrayName" );

    would find all the strings with recordName of arrayName. It would then create new Objects and use the string as the constructor. The object type would have to be stored in the database.
  11. Offline


  12. Offline


    Funny thing, I have a number of symbolic links on my Windows 7 machine.
  13. Offline


    Bah :).
  14. Offline


    I *really* hope we dont have to start messing with ANY form of sql to get bucket working, flatfiles are dead simple to edit and tweak, and the added burdon of messing with a entire sql server - no matter how easy it is - just adds another install and deployment problem.

    Pease, Please, Please, no requirement to use sql in bukkit.
  15. Offline


    Thats exactly the reason i want SQL see it as a IQ test for server hosts. If you cant get sql working, you're not fit as a host.
  16. Offline


    That may not be up to them; and if the goal is to be community driven, then by extension, things need to eb as simple and user friendly as possible so that the community grows more.
  17. Offline


    Do we want 1000 ppl with 80% idiots and empty servers or 200 good ones?
    I prefer the latter. I have seen many people that join my server that it took ages to find a proper one.
    I dont want that, I want ppl to have access to only good servers. If some one cant read a proper tutorial to install and use MySQL Do you really want them running a server?

    Just to be clear, only attacking idiot hosts/owners here. Admins dont need the technical skills but it does help. Uneducated is not a problem as long as they CAN actually be educated.
  18. Offline


    I want a place for the idiots to go, that is not my server. If it is too hard for bukkit to be deployed correctly and working on a server, then the idiots will spawm a smaller number of servers and there will be a greater statistical chance that I have to deal with idiots.

    I do not want this. I want things to be as simple as possible so that the idiots can go play with themselves. Let them be teached not to be idiots.
  19. Offline


    A decent point, But as an admin you always deal with idiots. There are three outcomes. Either they learn and become part of the family, they dont like my server or they get a ban. It's a long process which most times end in option 1 and 3. Doesnt take long before the option 2 ppl return and option 3 ppl get banned from other servers or want to be unbanned.
  20. Offline


    Yes, but that does not mean we should make it harder for them to be productive and so forth.
  21. Offline


    That's not up to you to judge. It's rude of you to even consider something like that and stupid for a developer to approach something like that. Why don't you TEACH them rather than BERATE them.
  22. Offline

    dark navi

    If someone cannot type with proper English grammar, should they be excluded from using a keyboard? Your point is not the least bit valid. There is a large difference between having the inability to install MySQL and just not having the will.
  23. Offline


    Erm, this flatfile vs db thing only affects the hosts and the admins, the players dont give a damn. all they want is to build.
  24. Offline


    I'm for flatfile support as well. While a DB does have advantages especially when there is a lot of data to store/manage, I do not want to install a SQL server on my laptop which is used as a small local server for my family.
  25. Offline


    The best thing is, to have an option to change between flatfile and dB ;)
    I like the flafiles for small and easy files, like server-props, users.txt, groups.txt, rules, homes and warps,
    but for bigger plugins like LWC, Logblock, BB etc. I prefer SQL.

    Not all Server are 100+ users big and have a need to store all files in a DB.
    I like my little ded server with only <20 users, and it's easier to handle some files as flatfile (editing per networkStorage), and I'm not alone.
  26. Offline


    The message clearly isn't getting through. :( SQLite does not involve running a server of any kind. It is a library, pure and simple, that stores its data in a file, just like any other file.

    In terms of easy editing, there are tons of editors out there, though I must admit that I don't know of a console-based one.
    --- merged: Jan 8, 2011 3:58 PM ---
    Come to think of it, I can very quickly put this in perspective. You are probably blissfully unaware that almost all of you are using SQLite right now on your own machines as you are reading this. That's right. It is used by both Firefox and Chrome to store things like history and bookmarks. Ta da.
  27. Offline


    Oh, didn't knew you were going for SQLite. My fault I guess, should have read the thread more carefully. :oops:
  28. Offline


    And THAT is what kills it for 99% pf the people out there who use ssh to manage their servers as that is the most common management option/requirement for such hosts. If you require the use of the sqllite and do not provide a command line option that above all is easy to use and is user friendly - without requiring them to learn to code themselves - it will fail to gain traction with users. Period.
  29. Offline


  30. Offline


    But how are people who dont control thier hosts going to get it on thier system?

    Do you expect people who don't know how to code - thats most mc server admins - to be able to compile something with GCC and link libraries.. on systems that probably dont already have these things installed?

    Not trying to be a jerk, just pointing out how un-user friendly it is.
Thread Status:
Not open for further replies.

Share This Page