Make meta comparison ignore ingredients that don't match the meta instead of rejecting the transaction

This commit is contained in:
fullwall 2024-09-09 02:22:34 +08:00
parent b26f185de2
commit 5d1a1ad642
2 changed files with 5 additions and 6 deletions

View File

@ -970,11 +970,8 @@ public class ShopTrait extends Trait {
if (action instanceof ItemAction) {
ItemAction ia = (ItemAction) action;
for (ItemStack stack : ia.items) {
ItemStack ingredient = stack.clone();
if (!ia.compareSimilarity) {
ingredient.setItemMeta(Bukkit.getItemFactory().getItemMeta(ingredient.getType()));
}
recipe.addIngredient(ingredient);
stack = stack.clone();
recipe.addIngredient(stack);
if (recipe.getIngredients().size() == 2)
break;
}

View File

@ -174,7 +174,9 @@ public class ItemAction extends NPCShopAction {
return false;
Map<String, Object> nextAcc = (Map<String, Object>) acc;
Map<String, Object> nextCmp = (Map<String, Object>) cmp;
if (!nextAcc.containsKey(parts[i]) || !nextCmp.containsKey(parts[i]))
if (!nextAcc.containsKey(parts[i]))
break;
if (!nextCmp.containsKey(parts[i]))
return false;
acc = nextAcc.get(parts[i]);
cmp = nextCmp.get(parts[i]);