Workaround MCPC+ shortcomings for now.

Fixes #1549
This commit is contained in:
GJ 2013-10-30 15:33:37 -04:00
parent 6c70de6a58
commit 4889769522
2 changed files with 4 additions and 8 deletions

View File

@ -57,7 +57,7 @@ public class Repair {
return "";
}
protected static Material getSalvagedItem(ItemStack inHand) {
protected static Material getRepairAndSalvageItem(ItemStack inHand) {
if (ItemUtils.isDiamondTool(inHand) || ItemUtils.isDiamondArmor(inHand)) {
return Material.DIAMOND;
}
@ -84,7 +84,7 @@ public class Repair {
}
}
protected static int getSalvagedAmount(ItemStack inHand) {
public static int getRepairAndSalvageQuantities(ItemStack inHand) {
// Temporary workaround until they get their stuff fixed.
if (mcMMO.isMCPCEnabled()) {
if (ItemUtils.isPickaxe(inHand) || ItemUtils.isAxe(inHand) || ItemUtils.isBow(inHand) || inHand.getType() == Material.BUCKET) {
@ -113,11 +113,7 @@ public class Repair {
}
}
return getRepairAndSalvageQuantities(inHand, getSalvagedItem(inHand), (byte) -1);
}
public static int getRepairAndSalvageQuantities(ItemStack item) {
return getRepairAndSalvageQuantities(item, null, (byte) -1);
return getRepairAndSalvageQuantities(inHand, getRepairAndSalvageItem(inHand), (byte) -1);
}
public static int getRepairAndSalvageQuantities(ItemStack item, Material repairMaterial, byte repairMetadata) {

View File

@ -163,7 +163,7 @@ public class RepairManager extends SkillManager {
player.setItemInHand(new ItemStack(Material.AIR));
location.setY(location.getY() + 1);
Misc.dropItems(location, new ItemStack(Repair.getSalvagedItem(item)), Repair.getSalvagedAmount(item) * item.getAmount());
Misc.dropItems(location, new ItemStack(Repair.getRepairAndSalvageItem(item)), Repair.getRepairAndSalvageQuantities(item) * item.getAmount());
player.playSound(player.getLocation(), Sound.ANVIL_USE, Misc.ANVIL_USE_VOLUME, Misc.ANVIL_USE_PITCH);
player.sendMessage(LocaleLoader.getString("Repair.Skills.SalvageSuccess"));