Discussion in 'Plugin Development' started by MasterDoctor, Oct 23, 2014.
The title pretty much sums it up...
What have you tried? Where's your code?
Not much, My eclipse has screwed up and no longer suggests the next bit. like if you type "config." normally a box pops up with what you can type. But that doesn't work
The box doesn't pop up! mythbusterma
mythbusterma I fixed that problem, let me see if I can guess the code
EDIT by Moderator: merged posts, please use the edit button instead of double posting.
Hash maps already save..
ChipDev but not to a file.
Who wants a cluttry file?
You could serialize and encode the HashMap.
Take a look at this for making Locations Serializable.
And then look at ObjectOutputStream to see how you can Serialize.
I believe that Serialization makes a messy String so to be safe encode it with Base64..
That's what i would do at least.
MasterDoctor Bukkit API provides implementation for this. Bukkit Configuration API. Check out the sections on HashMaps: #1 and especially #2.
Please remember that a lot of us are hesitant and/or reluctant to help out if it looks like you have done little work to solve your own problem. Try adding code or things you've already tried in your next post.
MasterDoctor do you have always the same classes for key and value? Because if you have, you can create a .cfg file, write your content int it like key | value and seperate the single entrys with linebreaks. This is how you save it, how to read and split it you should know Also you could create 2 files like value.cfg and key.cfg and seperate them like this, but thats your decision. If the classes in your hashmap are changing, you are able to do this, but you've to save the different types in different files or mark them with an annotation in the file. this could become much work. The only situation in which this wont work is if you got a HashMap<?, ?> with unknown types. Then you could cast to object but this wont do very much
Did i help you?
Separate names with a comma.