Hello! I'm currently working at a custom dialogues Plugin, and I want to work with the config.yml to save them. But I always get a NullPointerException at this line: Code:java int max = fc.getList("dialogues." + s.getLine(2) + ".lines").size(); Here is the whole code: Code:java FileConfiguration fc = Bukkit.getPluginManager().getPlugin("KnightsOfCosmica").getConfig(); int i = 0; int max = fc.getList("dialogues." + s.getLine(2) + ".lines").size(); List<String> lines = (List<String>) fc.getList("dialogues." + s.getLine(2) + "lines"); s is a sign, and with s.getLine(2) the third line of the sign is gotten. So, how can I fix this?
Gabum Can you verify that fc isn't null? Also if you are working with strings, you would be better off using getStringList
Thx for all the answers, I had personal problems so I did not answer(exams etc), and I now got some work on the problem. I fixed the first mistake, the path in the config.yml was just in wrong order. But now, if I try to get the list, there is just no object in it. Could you guys tell me the syntax for a String List in the config.yml? Nevermind, guys. I just found it out: PHP: dialogues: Chests: lines: - Dialogue Line 1 - Dialogue Line 2 EDIT by Moderator: merged posts, please use the edit button instead of double posting.