mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-26 07:06:45 +01:00
Allow repair of items without a recipe.
This commit is contained in:
parent
dfe83ff497
commit
d1d6b80676
@ -1,5 +1,7 @@
|
|||||||
package com.gmail.nossr50.skills.repair;
|
package com.gmail.nossr50.skills.repair;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
import org.bukkit.inventory.Recipe;
|
import org.bukkit.inventory.Recipe;
|
||||||
@ -91,7 +93,10 @@ public class Repair {
|
|||||||
public static int getRepairAndSalvageQuantities(ItemStack item, Material repairMaterial, byte repairMetadata) {
|
public static int getRepairAndSalvageQuantities(ItemStack item, Material repairMaterial, byte repairMetadata) {
|
||||||
int quantity = 0;
|
int quantity = 0;
|
||||||
MaterialData repairData = repairMaterial != null ? new MaterialData(repairMaterial, repairMetadata) : null;
|
MaterialData repairData = repairMaterial != null ? new MaterialData(repairMaterial, repairMetadata) : null;
|
||||||
Recipe recipe = mcMMO.p.getServer().getRecipesFor(item).get(0);
|
List<Recipe> recipes = mcMMO.p.getServer().getRecipesFor(item);
|
||||||
|
|
||||||
|
if (!recipes.isEmpty()) {
|
||||||
|
Recipe recipe = recipes.get(0);
|
||||||
|
|
||||||
if (recipe instanceof ShapelessRecipe) {
|
if (recipe instanceof ShapelessRecipe) {
|
||||||
for (ItemStack ingredient : ((ShapelessRecipe) recipe).getIngredientList()) {
|
for (ItemStack ingredient : ((ShapelessRecipe) recipe).getIngredientList()) {
|
||||||
@ -107,6 +112,7 @@ public class Repair {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return quantity;
|
return quantity;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user