Save hashmap to a file

Discussion in 'Plugin Development' started by LegoPal92, Feb 2, 2013.

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

    LegoPal92

    Well, the good news is that I am adventuring into lists, the bad news is i need help. So as the title implies, I am trying to save an hashmap to a file. I have no idea where to start, so i came here. What would you recommend?

    Not a yml file, please, I want to make it just a .lkpk file, which is a file only my plugin can use. without a hex editor.

    Code:
        private static HashMap<Location, List<String>> ProtectedLocations = null;
     
    More code is there as well, but this is what i want to save to a file.
    Thanks in advance,
    LegoPal92.
     
  2. LegoPal92
    Bukkits Location class is not serializable. If you want to serialize it you will need to create a custom Location class which can be serialized and then convert that to a Bukkit Location class. As for saving it to a file just do a google search, there are plenty of tutorials.
     
  3. Offline

    LegoPal92

    Adamki11s
    I have the serialize class, but I do not know how to make that into a location.
    Any help would be appreciated, thanks.
     
  4. Offline

    LegoPal92

    Adamki11s
    thanks Adam, that should help me a lot!
     
  5. Offline

    microgeek

    Make a SerializableHashMap Class extending HashMap
    Add methods for toString
    Make a constructor that takes a String
    Profit?
     
Thread Status:
Not open for further replies.

Share This Page