[LIB/API] Sync - Saving and Loading data. SQL, serializing, updates, statistics...

Discussion in 'Resources' started by Adamki11s, Feb 1, 2012.

Thread Status:
Not open for further replies.

  1. Sync, providing you with numerous ways to save and load data easily through SQL, standard configuration files and serializable files made easy.

    Sync also provides support for easy updates and plugin statistic tracking. Check it out!
  2. Offline


    Also MySQL?
  3. Yes, MySQL and SQLite
  4. Offline


    Nice! :D
    Adamki11s likes this.
  5. Added easy support for auto updating!
    TopGear93 likes this.
  6. Offline


    This is absolutely amazing. You were right that the wait would be worth it!


    Btw with creating multiple configs would i just do this?
    File f = new File("plugins" + File.seperator + "Sync" + File.seperator + "OccupyMain.txt");
    File f = new File("plugins" + File.seperator + "Sync" + File.seperator + "OccupyIClaims.txt");
    Adamki11s likes this.
  7. Offline


    TopGear93 likes this.
  8. Yes and then you can simply pass that file into SyncConfiguration :)
  9. Offline


    Hello! Sync is really useful API for me!
    I've got only one problem:
    How do I check if there is "playername" in "nick"? I was trying something like this
            ResultSet set = sql.sqlQuery("SELECT nick FROM ss_players WHERE nick='"+playername+"'");
    But I don't know how to deal with it. This thing is my first programming challenge in Java so I need your help. BTW. I'm using MySQL.
  10. I have added an existanceQuery but I didn't push the changes yet.

    Want you want to do is just call .next() on your result set. If it has any entries this will return true so your player exists, if it returns false then it does not exist. Eg

    ResultSet set = sql.sqlQuery("SELECT nick FROM ss_players WHERE nick='"+playername+"'");
    //nick exists
    } else {
    //nick doesn't exist
  11. Offline


    My god <3!
    Thank you :D
  12. Offline


    How to delete keys from file storage?
  13. Assuming you are using SyncConfiguration you can call the getReadableData() after calling read() which will give you a linked hashmap of all the keys in the file. You can then remove the node and call insertWritableData(Map<String, Object>).


    2. SyncConfiguration config = new SyncConfiguration(someFile);
    3. config.read();
    4. LinkedHashMap<String, Object> keyList = config.getReadableData();
    5. keyList.remove("somekey");
    6. config.setWriteableData(keyList);
    7. config.write();
  14. Offline


    When doing the config part of this library, will it remove comments if you save/edit something in the file?
    Because apparently the bukkit API removes all comments when you save a config file..
  15. Just to let whoever is interested know, Sync will still work on current and future Bukkit builds provided no major changes are made to the Bukkit Scheduler.
  16. Spelling mistake :)
  17. Offline


    What happened to this? Why was it removed?
  18. It hasn't been removed, the link just wasn't working. It's all updated now and can be found on bukkitdev.
    bobacadodl likes this.
Thread Status:
Not open for further replies.

Share This Page