Auto-fill item requirement list

This commit is contained in:
PikaMug 2022-06-13 06:10:47 -04:00
parent 5c66d01d7c
commit 86df2aa0b0
1 changed files with 14 additions and 18 deletions

View File

@ -715,28 +715,24 @@ public class RequirementsPrompt extends QuestsEditorNumericPrompt {
context.setSessionData(CK.REQ_ITEMS_REMOVE, null);
return new RequirementsItemListPrompt(context);
case 4:
final int one;
final int two;
final int missing;
final List<ItemStack> items = (List<ItemStack>) context.getSessionData(CK.REQ_ITEMS);
final List<Boolean> remove = (List<Boolean>) context.getSessionData(CK.REQ_ITEMS_REMOVE);
LinkedList<Boolean> remove = (LinkedList<Boolean>) context.getSessionData(CK.REQ_ITEMS_REMOVE);
if (items != null) {
one = items.size();
} else {
one = 0;
}
if (remove != null) {
two = remove.size();
} else {
two = 0;
}
if (one == two) {
return new RequirementsPrompt(context);
} else {
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("listsNotSameSize"));
return new RequirementsItemListPrompt(context);
if (remove != null) {
missing = items.size() - remove.size();
} else {
missing = items.size();
remove = new LinkedList<>();
}
for (int i = 0; i < missing; i++) {
remove.add(false);
}
}
context.setSessionData(CK.REQ_ITEMS_REMOVE, remove);
return new RequirementsPrompt(context);
default:
return null;
return new RequirementsPrompt(context);
}
}
}