Skip to content

Commit

Permalink
smithing & crafting event feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
Lildirt committed Jul 13, 2024
1 parent cc37f9a commit edfd768
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,11 @@ public MCItemStack getInputTemplate() {

@Override
public MCRecipe getRecipe() {
return new BukkitMCSmithingRecipe((SmithingRecipe) si.getRecipe());
if (si.getRecipe() == null) {
return null;
} else {
return new BukkitMCSmithingRecipe((SmithingRecipe) si.getRecipe());
}
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -943,7 +943,6 @@ public Map<String, Mixed> evaluate(BindableEvent event) throws EventException {
for(int i = 0; i < mi.length; i++) {
matrix.set(i, ObjectGenerator.GetGenerator().item(mi[i], t), t);
}
ret.put("inventorytype", new CString(e.getInventory().getType().toString(), t));
ret.put("matrix", matrix);
ret.put("result", ObjectGenerator.GetGenerator().item(e.getInventory().getResult(), t));
return ret;
Expand Down Expand Up @@ -1100,11 +1099,7 @@ public Map<String, Mixed> evaluate(BindableEvent event) throws EventException {
ret.put("first_item", ObjectGenerator.GetGenerator().item(smithing.getInputTemplate(), Target.UNKNOWN));
ret.put("second_item", ObjectGenerator.GetGenerator().item(smithing.getInputEquipment(), Target.UNKNOWN));
ret.put("third_item", ObjectGenerator.GetGenerator().item(smithing.getInputMaterial(), Target.UNKNOWN));
try {
ret.put("recipe", ObjectGenerator.GetGenerator().recipe(smithing.getRecipe(), Target.UNKNOWN));
} catch(NullPointerException ex) {
ret.put("recipe", CNull.NULL);
}
ret.put("recipe", ObjectGenerator.GetGenerator().recipe(smithing.getRecipe(), Target.UNKNOWN));
ret.put("result", ObjectGenerator.GetGenerator().item(smithing.getResult(), Target.UNKNOWN));

return ret;
Expand Down

0 comments on commit edfd768

Please sign in to comment.