mirror of
https://github.com/PikaMug/Quests.git
synced 2025-01-30 04:01:59 +01:00
Better session data casting for rewards and reqs, fixes #660
This commit is contained in:
parent
f6f7bfc5eb
commit
361dbfc3ce
@ -828,21 +828,28 @@ public class QuestFactory implements ConversationAbandonedListener {
|
|||||||
questPointsReq = (Integer) cc.getSessionData(CK.REQ_QUEST_POINTS);
|
questPointsReq = (Integer) cc.getSessionData(CK.REQ_QUEST_POINTS);
|
||||||
}
|
}
|
||||||
if (cc.getSessionData(CK.REQ_ITEMS) != null) {
|
if (cc.getSessionData(CK.REQ_ITEMS) != null) {
|
||||||
itemReqs = (LinkedList<ItemStack>) cc.getSessionData(CK.REQ_ITEMS);
|
itemReqs = new LinkedList<ItemStack>();
|
||||||
removeItemReqs = (LinkedList<Boolean>) cc.getSessionData(CK.REQ_ITEMS_REMOVE);
|
removeItemReqs = new LinkedList<Boolean>();
|
||||||
|
itemReqs.addAll((List<ItemStack>) cc.getSessionData(CK.REQ_ITEMS));
|
||||||
|
removeItemReqs.addAll((List<Boolean>) cc.getSessionData(CK.REQ_ITEMS_REMOVE));
|
||||||
}
|
}
|
||||||
if (cc.getSessionData(CK.REQ_PERMISSION) != null) {
|
if (cc.getSessionData(CK.REQ_PERMISSION) != null) {
|
||||||
permReqs = (LinkedList<String>) cc.getSessionData(CK.REQ_PERMISSION);
|
permReqs = new LinkedList<String>();
|
||||||
|
permReqs.addAll((List<String>) cc.getSessionData(CK.REQ_PERMISSION));
|
||||||
}
|
}
|
||||||
if (cc.getSessionData(CK.REQ_QUEST) != null) {
|
if (cc.getSessionData(CK.REQ_QUEST) != null) {
|
||||||
questReqs = (LinkedList<String>) cc.getSessionData(CK.REQ_QUEST);
|
questReqs = new LinkedList<String>();
|
||||||
|
questReqs.addAll((List<String>) cc.getSessionData(CK.REQ_QUEST));
|
||||||
}
|
}
|
||||||
if (cc.getSessionData(CK.REQ_QUEST_BLOCK) != null) {
|
if (cc.getSessionData(CK.REQ_QUEST_BLOCK) != null) {
|
||||||
questBlocks = (LinkedList<String>) cc.getSessionData(CK.REQ_QUEST_BLOCK);
|
questBlocks = new LinkedList<String>();
|
||||||
|
questBlocks.addAll((List<String>) cc.getSessionData(CK.REQ_QUEST_BLOCK));
|
||||||
}
|
}
|
||||||
if (cc.getSessionData(CK.REQ_MCMMO_SKILLS) != null) {
|
if (cc.getSessionData(CK.REQ_MCMMO_SKILLS) != null) {
|
||||||
mcMMOSkillReqs = (LinkedList<String>) cc.getSessionData(CK.REQ_MCMMO_SKILLS);
|
mcMMOSkillReqs = new LinkedList<String>();
|
||||||
mcMMOAmountReqs = (LinkedList<Integer>) cc.getSessionData(CK.REQ_MCMMO_SKILL_AMOUNTS);
|
mcMMOAmountReqs = new LinkedList<Integer>();
|
||||||
|
mcMMOSkillReqs.addAll((List<String>) cc.getSessionData(CK.REQ_MCMMO_SKILLS));
|
||||||
|
mcMMOAmountReqs.addAll((List<Integer>) cc.getSessionData(CK.REQ_MCMMO_SKILL_AMOUNTS));
|
||||||
}
|
}
|
||||||
if (cc.getSessionData(CK.REQ_HEROES_PRIMARY_CLASS) != null) {
|
if (cc.getSessionData(CK.REQ_HEROES_PRIMARY_CLASS) != null) {
|
||||||
heroesPrimaryReq = (String) cc.getSessionData(CK.REQ_HEROES_PRIMARY_CLASS);
|
heroesPrimaryReq = (String) cc.getSessionData(CK.REQ_HEROES_PRIMARY_CLASS);
|
||||||
@ -875,7 +882,7 @@ public class QuestFactory implements ConversationAbandonedListener {
|
|||||||
}
|
}
|
||||||
if (cc.getSessionData(CK.REW_ITEMS) != null) {
|
if (cc.getSessionData(CK.REW_ITEMS) != null) {
|
||||||
itemRews = new LinkedList<String>();
|
itemRews = new LinkedList<String>();
|
||||||
for (ItemStack is : (LinkedList<ItemStack>) cc.getSessionData(CK.REW_ITEMS)) {
|
for (ItemStack is : (List<ItemStack>) cc.getSessionData(CK.REW_ITEMS)) {
|
||||||
itemRews.add(ItemUtil.serializeItemStack(is));
|
itemRews.add(ItemUtil.serializeItemStack(is));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -883,26 +890,28 @@ public class QuestFactory implements ConversationAbandonedListener {
|
|||||||
expRew = (Integer) cc.getSessionData(CK.REW_EXP);
|
expRew = (Integer) cc.getSessionData(CK.REW_EXP);
|
||||||
}
|
}
|
||||||
if (cc.getSessionData(CK.REW_COMMAND) != null) {
|
if (cc.getSessionData(CK.REW_COMMAND) != null) {
|
||||||
if(cc.getSessionData(CK.REW_COMMAND) instanceof LinkedList<?>) {
|
commandRews = new LinkedList<String>();
|
||||||
commandRews = (LinkedList<String>) cc.getSessionData(CK.REW_COMMAND);
|
commandRews.addAll((List<String>)cc.getSessionData(CK.REW_COMMAND));
|
||||||
} else {
|
|
||||||
commandRews=new LinkedList<>();
|
|
||||||
commandRews.addAll((List<String>)cc.getSessionData(CK.REW_COMMAND));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if (cc.getSessionData(CK.REW_PERMISSION) != null) {
|
if (cc.getSessionData(CK.REW_PERMISSION) != null) {
|
||||||
permRews = (LinkedList<String>) cc.getSessionData(CK.REW_PERMISSION);
|
permRews = new LinkedList<String>();
|
||||||
|
permRews.addAll((List<String>) cc.getSessionData(CK.REW_PERMISSION));
|
||||||
}
|
}
|
||||||
if (cc.getSessionData(CK.REW_MCMMO_SKILLS) != null) {
|
if (cc.getSessionData(CK.REW_MCMMO_SKILLS) != null) {
|
||||||
mcMMOSkillRews = (LinkedList<String>) cc.getSessionData(CK.REW_MCMMO_SKILLS);
|
mcMMOSkillRews = new LinkedList<String>();
|
||||||
mcMMOSkillAmounts = (LinkedList<Integer>) cc.getSessionData(CK.REW_MCMMO_AMOUNTS);
|
mcMMOSkillAmounts = new LinkedList<Integer>();
|
||||||
|
mcMMOSkillRews.addAll((List<String>) cc.getSessionData(CK.REW_MCMMO_SKILLS));
|
||||||
|
mcMMOSkillAmounts.addAll((List<Integer>) cc.getSessionData(CK.REW_MCMMO_AMOUNTS));
|
||||||
}
|
}
|
||||||
if (cc.getSessionData(CK.REW_HEROES_CLASSES) != null) {
|
if (cc.getSessionData(CK.REW_HEROES_CLASSES) != null) {
|
||||||
heroesClassRews = (LinkedList<String>) cc.getSessionData(CK.REW_HEROES_CLASSES);
|
heroesClassRews = new LinkedList<String>();
|
||||||
heroesExpRews = (LinkedList<Double>) cc.getSessionData(CK.REW_HEROES_AMOUNTS);
|
heroesExpRews = new LinkedList<Double>();
|
||||||
|
heroesClassRews.addAll((List<String>) cc.getSessionData(CK.REW_HEROES_CLASSES));
|
||||||
|
heroesExpRews.addAll((List<Double>) cc.getSessionData(CK.REW_HEROES_AMOUNTS));
|
||||||
}
|
}
|
||||||
if (cc.getSessionData(CK.REW_PHAT_LOOTS) != null) {
|
if (cc.getSessionData(CK.REW_PHAT_LOOTS) != null) {
|
||||||
phatLootRews = (LinkedList<String>) cc.getSessionData(CK.REW_PHAT_LOOTS);
|
phatLootRews = new LinkedList<String>();
|
||||||
|
phatLootRews.addAll((List<String>) cc.getSessionData(CK.REW_PHAT_LOOTS));
|
||||||
}
|
}
|
||||||
if (cc.getSessionData(CK.REW_CUSTOM) != null) {
|
if (cc.getSessionData(CK.REW_CUSTOM) != null) {
|
||||||
customRews = (LinkedList<String>) cc.getSessionData(CK.REW_CUSTOM);
|
customRews = (LinkedList<String>) cc.getSessionData(CK.REW_CUSTOM);
|
||||||
|
Loading…
Reference in New Issue
Block a user