mirror of
https://github.com/PikaMug/Quests.git
synced 2024-11-21 18:15:32 +01:00
Load amount of legacy items
This commit is contained in:
parent
f565a6d263
commit
a587a0c1c0
@ -225,12 +225,17 @@ public class BukkitActionYamlStorage implements ActionStorageImpl {
|
||||
for (final Object item : itemList) {
|
||||
final String stack = (String) item;
|
||||
if (stack != null) {
|
||||
final String itemName = stack.substring(5, stack.indexOf(':'));
|
||||
final String[] result = stack.split(":");
|
||||
if (result.length < 1) {
|
||||
throw new ActionFormatException("'items' has invalid length", actionKey);
|
||||
}
|
||||
final String itemName = result[0].replace("name-", "");
|
||||
final Material itemMat = Material.matchMaterial(itemName);
|
||||
final int itemAmt = Integer.parseInt(result[1].replace("amount-", ""));
|
||||
if (itemMat != null) {
|
||||
temp.add(new ItemStack(itemMat, 1));
|
||||
temp.add(new ItemStack(itemMat, itemAmt));
|
||||
} else {
|
||||
throw new ActionFormatException("'items' has invalid name" + itemName, actionKey);
|
||||
throw new ActionFormatException("'items' has invalid name " + itemName, actionKey);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -348,12 +348,17 @@ public class BukkitQuestYamlStorage implements QuestStorageImpl {
|
||||
for (final Object item : itemList) {
|
||||
final String stack = (String) item;
|
||||
if (stack != null) {
|
||||
final String itemName = stack.substring(5, stack.indexOf(':'));
|
||||
final String[] result = stack.split(":");
|
||||
if (result.length < 1) {
|
||||
throw new QuestFormatException("Reward 'items' has invalid length", questKey);
|
||||
}
|
||||
final String itemName = result[0].replace("name-", "");
|
||||
final Material itemMat = Material.matchMaterial(itemName);
|
||||
final int itemAmt = Integer.parseInt(result[1].replace("amount-", ""));
|
||||
if (itemMat != null) {
|
||||
temp.add(new ItemStack(itemMat, 1));
|
||||
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 " + itemName, questKey);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -534,12 +539,17 @@ public class BukkitQuestYamlStorage implements QuestStorageImpl {
|
||||
for (final Object item : itemList) {
|
||||
final String stack = (String) item;
|
||||
if (stack != null) {
|
||||
final String itemName = stack.substring(5, stack.indexOf(':'));
|
||||
final String[] result = stack.split(":");
|
||||
if (result.length < 1) {
|
||||
throw new QuestFormatException("Requirement 'items' has invalid length", questKey);
|
||||
}
|
||||
final String itemName = result[0].replace("name-", "");
|
||||
final Material itemMat = Material.matchMaterial(itemName);
|
||||
final int itemAmt = Integer.parseInt(result[1].replace("amount-", ""));
|
||||
if (itemMat != null) {
|
||||
temp.add(new ItemStack(itemMat, 1));
|
||||
temp.add(new ItemStack(itemMat, itemAmt));
|
||||
} else {
|
||||
throw new QuestFormatException("Requirement 'items' has invalid name" + itemName, questKey);
|
||||
throw new QuestFormatException("Requirement 'items' has invalid name " + itemName, questKey);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user