Skip to content

Commit

Permalink
Improved error message
Browse files Browse the repository at this point in the history
  • Loading branch information
pieterdebot committed Jun 4, 2021
1 parent 702e736 commit a311ce7
Showing 1 changed file with 6 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -114,14 +114,13 @@ public static void loadCrafts(){

for(int i=0 ; i<3; i++){
String[] itemsInLine = lines[i].split(" ");
if(itemsInLine.length != 3)
throw new IllegalArgumentException("Each line should be formatted like {item} {item} {item}");

if(itemsInLine.length != 3) {
throw new IllegalArgumentException("Each line should be formatted like {item} {item} {item}, also make sure your items don't contain custom item data!");
}

for(int j=0 ; j<3 ;j++){
if (itemsInLine[j].startsWith("{") && itemsInLine[j].endsWith("}")){
recipe.add(JsonItemUtils.getItemFromJson(itemsInLine[j]));
}else{
throw new IllegalArgumentException("The craft result must be formatted according to the json item format (Use /iteminfo).");
}
recipe.add(JsonItemUtils.getItemFromJson(itemsInLine[j]));
}
}

Expand Down

0 comments on commit a311ce7

Please sign in to comment.