Require amount for legacy items

This commit is contained in:
PikaMug 2024-01-18 16:46:34 -05:00
parent 76397b6e1a
commit 5ebeb77cd7
1 changed files with 3 additions and 2 deletions

View File

@ -349,7 +349,7 @@ public class BukkitQuestYamlStorage implements QuestStorageImpl {
final String stack = (String) item;
if (stack != null) {
final String[] result = stack.split(":");
if (result.length < 1) {
if (result.length < 2) {
throw new QuestFormatException("Reward 'items' has invalid length", questKey);
}
final String itemName = result[0].replace("name-", "");
@ -358,7 +358,8 @@ public class BukkitQuestYamlStorage implements QuestStorageImpl {
if (itemMat != null) {
temp.add(new ItemStack(itemMat, itemAmt));
} else {
throw new QuestFormatException("Reward 'items' has invalid name " + itemName, questKey);
throw new QuestFormatException("Reward 'items' has invalid name or amount "
+ itemName + ":" + itemAmt, questKey);
}
}
}