Search code examples
javahashmapyamlsnakeyaml

Java YAML Configuration to a custom hashmap


I am currently programming a bukkit plugin that stores a bunch of information about the player in a YAML configuration file. Now I want the plugin to read the YAML file when the server starts up and then add on the that information. I have my loader, but I cant use it because my plugin uses a custom map. Here is the code for the map:

Map<Integer, Map<String, Object>>

And here is the code to get the information from the file:

info = (Map<Integer, Map<String, Object>>) ticket.getConfigurationSection("tickets");

But when I try to run the plugin with that line of code i get this error:

Caused by: java.lang.ClassCastException: org.bukkit.configuration.MemorySection cannot be cast to java.util.Map

Full code is posted here: http://pastebin.com/Xgu8hwM0


Solution

  • Yes I solved this. I HAD to use the Map<String, Object> but it worked because the way I had it(Map<Integer, Map<String, Object>>) that is the second part!