fixing "//reload npc" and quests problem
Posted: Mon May 25, 2009 9:55 pm
L2J Revision 3014:
L2JDP Revision 6075:
Hello,
I'm tying to fix the problem we have when a GM uses "//reload npc" command.
(When command is used, NPC don't handle any quest anymore. Clicking "[quest]" link simply closes the window)
I found that the command actually triggers an null pointer exception in net.sf.l2j.gameserver.instancemanager.QuestManager.java at line 90 (line 8 in the piece of code below).
Reloading npc involves reloading quests (I don't know why actually but this is in the datapack side)
It's quite strange to get a null pointer exception on that line. ( for (Quest quest : _quests.values()) )
the _quests attribute is initialized when declared ( private Map<String, Quest> _quests = new FastMap<String, Quest>();) so it cannot be null ... I think.
If we completely remove that "for" loop, the command "//reload npc" reloads npc and quests without error.
The problem is that it seems that quests are loaded twice : a given NPC who usually give "quest A, quest B" will now give "Quest A, Quest B, Quest A, Quest B". (they are only twice, typing more "//reload npc" don't add more lines to NPC HTLM quest message)
The strangest stuff is that if GM uses "//reload quests" before "//reload npc" then everything seems to be allright. Quests are working and are not found twice.
So I am looking for some help in fixing that.
L2JDP Revision 6075:
Hello,
I'm tying to fix the problem we have when a GM uses "//reload npc" command.
(When command is used, NPC don't handle any quest anymore. Clicking "[quest]" link simply closes the window)
I found that the command actually triggers an null pointer exception in net.sf.l2j.gameserver.instancemanager.QuestManager.java at line 90 (line 8 in the piece of code below).
Reloading npc involves reloading quests (I don't know why actually but this is in the datapack side)
Code: Select all
public final void reloadAllQuests(){ _log.info("Reloading Server Scripts"); try { // unload all scripts for (Quest quest : _quests.values()) { if (quest != null) quest.unload(); } // now load all scripts File scripts = new File(Config.DATAPACK_ROOT + "/data/scripts.cfg"); L2ScriptEngineManager.getInstance().executeScriptList(scripts); QuestManager.getInstance().report(); } catch (IOException ioe) { _log.severe("Failed loading scripts.cfg, no script going to be loaded"); }}
the _quests attribute is initialized when declared ( private Map<String, Quest> _quests = new FastMap<String, Quest>();) so it cannot be null ... I think.
If we completely remove that "for" loop, the command "//reload npc" reloads npc and quests without error.
The problem is that it seems that quests are loaded twice : a given NPC who usually give "quest A, quest B" will now give "Quest A, Quest B, Quest A, Quest B". (they are only twice, typing more "//reload npc" don't add more lines to NPC HTLM quest message)
The strangest stuff is that if GM uses "//reload quests" before "//reload npc" then everything seems to be allright. Quests are working and are not found twice.
So I am looking for some help in fixing that.