Events can have more than one mob, fixes #38

This commit is contained in:
HappyPikachu 2017-07-16 00:48:55 -04:00
parent f95bff322e
commit ae154427af

View File

@ -1568,20 +1568,18 @@ public class EventFactory implements ConversationAbandonedListener {
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("eventEditorMustSetMobAmountsFirst")); context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("eventEditorMustSetMobAmountsFirst"));
return new QuestMobPrompt(mobIndex, questMob); return new QuestMobPrompt(mobIndex, questMob);
} }
if (context.getSessionData(CK.E_MOB_TYPES) == null) { if (context.getSessionData(CK.E_MOB_TYPES) == null || ((LinkedList<String>) context.getSessionData(CK.E_MOB_TYPES)).isEmpty()) {
LinkedList<String> list = new LinkedList<String>();
list.add(questMob.serialize());
context.setSessionData(CK.E_MOB_TYPES, list);
} else {
if (((LinkedList<String>) context.getSessionData(CK.E_MOB_TYPES)).isEmpty()) {
LinkedList<String> list = new LinkedList<String>(); LinkedList<String> list = new LinkedList<String>();
list.add(questMob.serialize()); list.add(questMob.serialize());
context.setSessionData(CK.E_MOB_TYPES, list); context.setSessionData(CK.E_MOB_TYPES, list);
} else { } else {
LinkedList<String> list = (LinkedList<String>) context.getSessionData(CK.E_MOB_TYPES); LinkedList<String> list = (LinkedList<String>) context.getSessionData(CK.E_MOB_TYPES);
if (mobIndex < list.size()) {
list.set(mobIndex, questMob.serialize()); list.set(mobIndex, questMob.serialize());
context.setSessionData(CK.E_MOB_TYPES, list); } else {
list.add(questMob.serialize());
} }
context.setSessionData(CK.E_MOB_TYPES, list);
} }
return new MobPrompt(); return new MobPrompt();
} else if (input.equalsIgnoreCase("16")) { } else if (input.equalsIgnoreCase("16")) {