Library [Thunderbolt 2] - Lightning Fast Data Storage

Discussion in 'Resources' started by The Gaming Grunts, Jan 13, 2015.

?

Do You FInd This Useful?

  1. Pretty neat! Will definitely use this!

  2. It seems pretty cool. I don't know if I wil use it, though.

  3. Pshh... seriously?

Results are only viewable after voting.
Thread Status:
Not open for further replies.
  1. Offline

    CraftBang

    @The Gaming Grunts
    Thanks already for your reply and updating! I appreciate it:)
    I have another problem, I guess you uploaded the latest version already (using this link 1 minute ago: https://dl.project-x.me/files/Thunderbolt.jar)

    I guess the unload function isn't working correctly.
    First I create the file :
    Code:
    ThunderFile tf;
                    try {
                        tf = load("tes2", Main.dataLocation + File.separator + "Filter");
                        tf.set("Type", "g");
                        tf.set("Amount", "0");
                        tf.set("MaxAmount", "0");
                        tf.set("Level", 5);
                        tf.save();
                        Bukkit.broadcastMessage(tf.getInt("Level") + "");
                        unload("tes2");
                    } catch (IOException | FileLoadException e) {
                        e.printStackTrace();
                    }
    Works fine.
    Then I run the same code again I get the error:
    Code:
    [22:16:42 WARN]: me.projectx.thunderbolt2.exceptions.FileLoadException: [Thunderbolt 2] The file 'tes2.json' is already loaded!
    BUT, I instantly unloaded it after loading right? As you can see before the catches.
    So I made another function to unload it,
    Code:
     unload("tes2");
    I ran this code like 5 times and when I ran the code to load (using to create the file) I still get the same error
    Code:
    [22:16:42 WARN]: me.projectx.thunderbolt2.exceptions.FileLoadException: [Thunderbolt 2] The file 'tes2.json' is already loaded!
    So I decided to check, is the file "tes2" really loaded.
    Another function;
    Code:
        Bukkit.broadcastMessage(get("tes2").getString("Type"));
    Yes it did display the value from the keystring "Type".

    So conclusion; I think your unload method doesn't work correctly.

    Maybe a suggestion:
    boolean ThunderFile#isLoaded()
     
    Last edited: Apr 29, 2015
  2. @CraftBang
    The issue should be fixed now. Try the latest version.
     
  3. Offline

    CraftBang

    @The Gaming Grunts Works perfectly :)! Thanks for solving things so quickly hehe :D
    If you need me to test things or whatever you can always contact me.

    Another suggestion to keep it 'Lightning fast':
    How about deleting a file before even loading it using the location path?
    (If I want to remove a file I first need to load it, then remove it, kinda waste of speed and memory I guess?)

    EDIT: Not sure if really useful to add, because it's easy to do it by one line of code myself.
     
    Last edited: Apr 30, 2015
  4. Offline

    CraftBang

    @The Gaming Grunts a way to check if the file is already loaded would be great, I'm getting errors because of this problem. (So maybe in the load function if it's already loaded in the exception use the "get" function instead of printing the exception)
     
Thread Status:
Not open for further replies.

Share This Page