mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-22 05:06:45 +01:00
Remove debug message, use recipe method for salvage.
This commit is contained in:
parent
5d7d779a49
commit
566a381e95
@ -2,7 +2,11 @@ package com.gmail.nossr50.skills.repair;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.Recipe;
|
||||
import org.bukkit.inventory.ShapedRecipe;
|
||||
import org.bukkit.inventory.ShapelessRecipe;
|
||||
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.config.AdvancedConfig;
|
||||
import com.gmail.nossr50.config.Config;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
@ -79,6 +83,8 @@ public class Repair {
|
||||
}
|
||||
|
||||
protected static int getSalvagedAmount(ItemStack inHand) {
|
||||
// Temporary workaround until they get their stuff fixed.
|
||||
if (mcMMO.p.getServer().getName().equals("MCPC+")) {
|
||||
if (ItemUtils.isPickaxe(inHand) || ItemUtils.isAxe(inHand) || inHand.getType() == Material.BOW || inHand.getType() == Material.BUCKET) {
|
||||
return 3;
|
||||
}
|
||||
@ -104,4 +110,26 @@ public class Repair {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
Recipe recipe = mcMMO.p.getServer().getRecipesFor(inHand).get(0);
|
||||
int salvageAmount = 0;
|
||||
Material salvageMaterial = getSalvagedItem(inHand);
|
||||
|
||||
if (recipe instanceof ShapelessRecipe) {
|
||||
for (ItemStack ingredient : ((ShapelessRecipe) recipe).getIngredientList()) {
|
||||
if (ingredient != null && ingredient.getType() == salvageMaterial) {
|
||||
salvageAmount += ingredient.getAmount();
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (recipe instanceof ShapedRecipe) {
|
||||
for (ItemStack ingredient : ((ShapedRecipe) recipe).getIngredientMap().values()) {
|
||||
if (ingredient != null && ingredient.getType() == salvageMaterial) {
|
||||
salvageAmount += ingredient.getAmount();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return salvageAmount;
|
||||
}
|
||||
}
|
||||
|
@ -164,8 +164,6 @@ public class RepairConfig extends ConfigLoader {
|
||||
}
|
||||
}
|
||||
|
||||
System.out.println("Minimum quantity of " + key + ": " + minimumQuantity);
|
||||
|
||||
if (minimumQuantity <= 0) {
|
||||
reason.add("Minimum quantity of " + key + " must be greater than 0!");
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user