How to save array list dara after the server is reloaded?

Discussion in 'Plugin Development' started by WishMachine, May 29, 2015.

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

    WishMachine

    I have been searching for quite a while for an answer for this but I can never find a definitive answer or tutorial for this, and it's is a large road block in what kind of programs I can make, so descriptive answers would be really appreciated.

    In similar postings I see this page thrown around quite a bit but I have tried many times and don't quite understand how that is helpful or how to really use it.

    Thanks in advance
     
  2. Offline

    oceantheskatr

    Are you asking how to use the ArrayList? Or save it to a config? Elaborate please :)
     
  3. Offline

    mine-care

    @WishMachine of you want to save the contents of an array to a config there are many ways that you can fin in bukkit config api (see docs)
    There is also serialization in Java that saves and retrieves the whole object unless it is serializable (plenty of tutorials out there)
    Lastly you can also save them to an SQL database or an SQL Lite file :- ) those are a little more tricky but they work...
     
  4. Moved to Plugin Development.
     
  5. Offline

    WishMachine

    @oceantheskatr
    I am asking how to save array lists so that when the server is restarted, the data inside the array lists wont be deleted. Or something similar, like saving the data to a file and then retrieving it each time you run the code.

    @mine-care
    I finally found a tutorial on it! Thank you for the help, the wiki page just really confused me up for some reason but I figured out what to google and found a good vid.
     
  6. Offline

    oceantheskatr

    @WishMachine Did you end up figuring it out then? You'd need to save the arraylist to a file onDisable (config.yml would be easiest if you're not using it for anything else) and then load back in to the arraylist onEnable.
     
  7. Offline

    WishMachine

    I am still working on the code but I am pretty sure I know how to do it from here, if I get stuck again ill probably ask you for help though haha
     
  8. Offline

    oceantheskatr

    @WishMachine alright no problem, I'll try my best to help as needed :)
     
    WishMachine likes this.
Thread Status:
Not open for further replies.

Share This Page