Better solution for 62ccaa1d4a

This commit is contained in:
PikaMug 2021-02-09 03:22:47 -05:00
parent 62ccaa1d4a
commit b10e55a266

View File

@ -654,10 +654,6 @@ public class RequirementsPrompt extends QuestsEditorNumericPrompt {
} else { } else {
String text = "\n"; String text = "\n";
for (final ItemStack is : (List<ItemStack>) context.getSessionData(CK.REQ_ITEMS)) { for (final ItemStack is : (List<ItemStack>) context.getSessionData(CK.REQ_ITEMS)) {
if (is == null) {
// TODO - Find out why this happens after first setting GUI Display
return ChatColor.GRAY + "(" + Lang.get("noneSet") + ")";
}
text += ChatColor.GRAY + " - " + ItemUtil.getDisplayString(is) + "\n"; text += ChatColor.GRAY + " - " + ItemUtil.getDisplayString(is) + "\n";
} }
return text; return text;
@ -692,11 +688,17 @@ public class RequirementsPrompt extends QuestsEditorNumericPrompt {
if (context.getSessionData("newItem") != null) { if (context.getSessionData("newItem") != null) {
if (context.getSessionData(CK.REQ_ITEMS) != null) { if (context.getSessionData(CK.REQ_ITEMS) != null) {
final List<ItemStack> itemReqs = (List<ItemStack>) context.getSessionData(CK.REQ_ITEMS); final List<ItemStack> itemReqs = (List<ItemStack>) context.getSessionData(CK.REQ_ITEMS);
itemReqs.add((ItemStack) context.getSessionData("tempStack")); final ItemStack i = (ItemStack) context.getSessionData("tempStack");
if (i != null) {
itemReqs.add((ItemStack) context.getSessionData("tempStack"));
}
context.setSessionData(CK.REQ_ITEMS, itemReqs); context.setSessionData(CK.REQ_ITEMS, itemReqs);
} else { } else {
final LinkedList<ItemStack> itemReqs = new LinkedList<ItemStack>(); final LinkedList<ItemStack> itemReqs = new LinkedList<ItemStack>();
itemReqs.add((ItemStack) context.getSessionData("tempStack")); final ItemStack i = (ItemStack) context.getSessionData("tempStack");
if (i != null) {
itemReqs.add((ItemStack) context.getSessionData("tempStack"));
}
context.setSessionData(CK.REQ_ITEMS, itemReqs); context.setSessionData(CK.REQ_ITEMS, itemReqs);
} }
context.setSessionData("newItem", null); context.setSessionData("newItem", null);