Try to improve getting price
This commit is contained in:
parent
35030475aa
commit
fc061055d4
|
|
@ -60,6 +60,10 @@ public class Utilities {
|
||||||
if (map.containsKey(item.getType()))
|
if (map.containsKey(item.getType()))
|
||||||
return (map.get(item.getType()));
|
return (map.get(item.getType()));
|
||||||
|
|
||||||
|
if (map.containsKey(blockedMaterial))
|
||||||
|
blockedMaterial = null;
|
||||||
|
|
||||||
|
Material finalBlockedMaterial = blockedMaterial;
|
||||||
List<Recipe> recipes = Bukkit.getRecipesFor(item);
|
List<Recipe> recipes = Bukkit.getRecipesFor(item);
|
||||||
for (Recipe recipe : recipes) {
|
for (Recipe recipe : recipes) {
|
||||||
Price possiblePrice;
|
Price possiblePrice;
|
||||||
|
|
@ -67,7 +71,7 @@ public class Utilities {
|
||||||
if (recipe instanceof ShapedRecipe shapedRecipe) {
|
if (recipe instanceof ShapedRecipe shapedRecipe) {
|
||||||
List<ItemStack> values = shapedRecipe.getIngredientMap().values().stream().toList();
|
List<ItemStack> values = shapedRecipe.getIngredientMap().values().stream().toList();
|
||||||
if (!values.isEmpty() && blockedMaterial != null && values.stream()
|
if (!values.isEmpty() && blockedMaterial != null && values.stream()
|
||||||
.anyMatch(itemStack -> itemStack != null && itemStack.getType().equals(blockedMaterial)))
|
.anyMatch(itemStack -> itemStack != null && itemStack.getType().equals(finalBlockedMaterial)))
|
||||||
continue;
|
continue;
|
||||||
possiblePrice = getWorth(values, item.getType(), map);
|
possiblePrice = getWorth(values, item.getType(), map);
|
||||||
if (possiblePrice == null)
|
if (possiblePrice == null)
|
||||||
|
|
@ -76,7 +80,7 @@ public class Utilities {
|
||||||
price = possiblePrice;
|
price = possiblePrice;
|
||||||
} else if (recipe instanceof ShapelessRecipe shapelessRecipe) {
|
} else if (recipe instanceof ShapelessRecipe shapelessRecipe) {
|
||||||
if (shapelessRecipe.getIngredientList().stream()
|
if (shapelessRecipe.getIngredientList().stream()
|
||||||
.anyMatch(itemStack -> itemStack.getType().equals(blockedMaterial)))
|
.anyMatch(itemStack -> itemStack.getType().equals(finalBlockedMaterial)))
|
||||||
continue;
|
continue;
|
||||||
possiblePrice = getWorth(shapelessRecipe.getIngredientList(), item.getType(), map);
|
possiblePrice = getWorth(shapelessRecipe.getIngredientList(), item.getType(), map);
|
||||||
if (possiblePrice == null)
|
if (possiblePrice == null)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user