Keep original quest ID after editing, fixes #1070

This commit is contained in:
PikaMug 2020-02-13 04:51:24 -05:00
parent f5ac927641
commit feb6fd1527

View File

@ -1396,6 +1396,10 @@ public class QuestFactory implements ConversationAbandonedListener {
if (questSection == null) { if (questSection == null) {
questSection = data.createSection("quests"); questSection = data.createSection("quests");
} }
System.out.println("id= " + context.getSessionData(CK.Q_ID));
ConfigurationSection newSection;
if (context.getSessionData(CK.Q_ID) == null) {
// Creating
int customNum = 1; int customNum = 1;
while (true) { while (true) {
if (questSection.contains("custom" + customNum)) { if (questSection.contains("custom" + customNum)) {
@ -1404,7 +1408,11 @@ public class QuestFactory implements ConversationAbandonedListener {
break; break;
} }
} }
ConfigurationSection newSection = questSection.createSection("custom" + customNum); newSection = questSection.createSection("custom" + customNum);
} else {
// Editing
newSection = questSection.createSection((String)context.getSessionData(CK.Q_ID));
}
saveQuest(context, newSection); saveQuest(context, newSection);
data.save(new File(plugin.getDataFolder(), "quests.yml")); data.save(new File(plugin.getDataFolder(), "quests.yml"));
context.getForWhom().sendRawMessage(ChatColor.GREEN context.getForWhom().sendRawMessage(ChatColor.GREEN