Skip to content

Commit

Permalink
server.recipe_items: prevent bork from null choices
Browse files Browse the repository at this point in the history
  • Loading branch information
mcmonkey4eva committed Jun 18, 2020
1 parent 4e2bb3e commit f77100e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
Expand Up @@ -35,7 +35,7 @@ public class ItemMoveScriptEvent extends BukkitScriptEvent implements Listener {
// <context.item> returns the ItemTag that was moved.
//
// @Determine
// ItemTag to set a different item to be moved. NOTE: The original item will not be moved!
// ItemTag to set a different item to be moved.
//
// -->

Expand Down
Expand Up @@ -237,11 +237,13 @@ public void serverTag(ReplaceableTagEvent event) {
}
ListTag result = new ListTag();
Consumer<RecipeChoice> addChoice = (choice) -> {
if (choice instanceof RecipeChoice.ExactChoice) {
result.addObject(new ItemTag(choice.getItemStack()));
}
else {
result.add("material:" + choice.getItemStack().getType().name());
if (choice != null) {
if (choice instanceof RecipeChoice.ExactChoice) {
result.addObject(new ItemTag(choice.getItemStack()));
}
else {
result.add("material:" + choice.getItemStack().getType().name());
}
}
};
if (recipe instanceof ShapedRecipe) {
Expand Down

0 comments on commit f77100e

Please sign in to comment.