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

    Phraggah

    [​IMG]


    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:

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

    Atroxide

    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.

    Code:
    Root /
         - Startup scripts
          /bin/
             -  bukkit_mod.jar
             -  sqllite_binary (.exe or linux binary)
         /sqlite/db_files
         /configs/
             - plugin.config.txt
         /plugins/
             - plugin.jar
    
     
  4. Offline

    \\slashies

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

    https://github.com/doublebackslash/sqLiteKeyValueStor
    You will also need this:
    http://www.zentus.com/sqlitejdbc/

    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

    AlphaSite

    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

    Raphfrk

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

    Nijikokun

    Don't let you do what? Create directories, if that's what you are saying... I'm sorry you are wrong.
     
  8. Offline

    rob4001

    if a plugin uses flatfiles they should all be in one big flatfile called plugins.properties with headders for each plugin
     
  9. Offline

    Nijikokun

    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

    Raphfrk

    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

    Code:
    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

    /properties/<pluginName>/records/table.txt

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

    <pluginName>-records-table-txt

    --- 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

    AlphaSite

  12. Offline

    yottabyte

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

    Raphfrk

    Bah :).
     
  14. Offline

    feverdream

    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

    Anoniempje

    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

    feverdream

    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

    Anoniempje

    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

    feverdream

    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

    Anoniempje

    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

    feverdream

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

    Wahrheit

    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

    Anoniempje

    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

    Morrolan

    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

    Jobsti

    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

    Chewi

    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.

    http://www.sqlite.org/cvstrac/wiki?p=ManagementTools
    --- 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

    Morrolan

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

    feverdream

    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

    Chewi

  30. Offline

    feverdream

    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