diff --git a/Changelog.txt b/Changelog.txt index 3132b6ed9..545bbf0d9 100644 --- a/Changelog.txt +++ b/Changelog.txt @@ -27,7 +27,7 @@ Version 1.4.00-dev + Added methods to check if a player is in party or admin chat to the ChatAPI + Added /mcpurge functionality for Flatfile users + Added basic support for Mo' Creatures (and other entity mods) - specify mob info in entities.yml - + Added Shears, Buckets, Fishing rods and Bows to the list of items that can be Salvaged + + Added Shears, Buckets, Fishing Rods, Flint & Steel, Carrot Sticks, and Bows to the list of items that can be Salvaged = Fixed multiple commands not working properly on offline players = Fixed /mmoedit not giving feedback when modifying another players stats = Fixed the guide usage string showing up every time /skillname was called diff --git a/src/main/java/com/gmail/nossr50/skills/repair/Salvage.java b/src/main/java/com/gmail/nossr50/skills/repair/Salvage.java index 599be8b93..c74069319 100644 --- a/src/main/java/com/gmail/nossr50/skills/repair/Salvage.java +++ b/src/main/java/com/gmail/nossr50/skills/repair/Salvage.java @@ -37,15 +37,13 @@ public class Salvage { return; } - final float currentdura = item.getDurability(); - - if (currentdura == 0) { - final int salvagedAmount = getSalvagedAmount(item); - final int itemID = getSalvagedItemID(item); + final float currentDurability = item.getDurability(); + if (currentDurability == 0) { player.setItemInHand(new ItemStack(Material.AIR)); location.setY(location.getY() + 1); - Misc.dropItem(location, new ItemStack(itemID, salvagedAmount)); + + Misc.dropItems(location, new ItemStack(getSalvagedItem(item)), getSalvagedAmount(item)); player.playSound(player.getLocation(), Sound.ANVIL_USE, Misc.ANVIL_USE_VOLUME, Misc.ANVIL_USE_PITCH); player.sendMessage(LocaleLoader.getString("Repair.Skills.SalvageSuccess")); @@ -73,7 +71,8 @@ public class Salvage { if (spoutPlayer.isSpoutCraftEnabled()) { spoutPlayer.sendNotification("[mcMMO] Anvil Placed", "Right click to salvage!", Material.getMaterial(anvilID)); } - } else { + } + else { player.sendMessage(LocaleLoader.getString("Repair.Listener.Anvil2")); } @@ -82,28 +81,58 @@ public class Salvage { } } - public static int getSalvagedItemID(final ItemStack inHand) { - int salvagedItem = 0; - if (ItemChecks.isDiamondTool(inHand) || ItemChecks.isDiamondArmor(inHand)) salvagedItem = 264; - else if (ItemChecks.isGoldTool(inHand) || ItemChecks.isGoldArmor(inHand)) salvagedItem = 266; - else if (ItemChecks.isIronTool(inHand) || ItemChecks.isIronArmor(inHand) || inHand.getType() == Material.BUCKET) salvagedItem = 265; - else if (ItemChecks.isStoneTool(inHand)) salvagedItem = 4; - else if (ItemChecks.isWoodTool(inHand)) salvagedItem = 5; - else if (ItemChecks.isLeatherArmor(inHand)) salvagedItem = 334; - else if (ItemChecks.isStringTool(inHand)) salvagedItem = 287; - return salvagedItem; + private static Material getSalvagedItem(final ItemStack inHand) { + if (ItemChecks.isDiamondTool(inHand) || ItemChecks.isDiamondArmor(inHand)) { + return Material.DIAMOND; + } + else if (ItemChecks.isGoldTool(inHand) || ItemChecks.isGoldArmor(inHand)) { + return Material.GOLD_INGOT; + } + else if (ItemChecks.isIronTool(inHand) || ItemChecks.isIronArmor(inHand)) { + return Material.IRON_INGOT; + } + else if (ItemChecks.isStoneTool(inHand)) { + return Material.COBBLESTONE; + } + else if (ItemChecks.isWoodTool(inHand)) { + return Material.WOOD; + } + else if (ItemChecks.isLeatherArmor(inHand)) { + return Material.LEATHER; + } + else if (ItemChecks.isStringTool(inHand)) { + return Material.STRING; + } + else { + return null; + } } - public static int getSalvagedAmount(final ItemStack inHand) { - int salvagedAmount = 0; - if (ItemChecks.isPickaxe(inHand) || ItemChecks.isAxe(inHand) || inHand.getType() == Material.BOW || inHand.getType() == Material.BUCKET) salvagedAmount = 3; - else if (ItemChecks.isShovel(inHand)) salvagedAmount = 1; - else if (ItemChecks.isSword(inHand) || ItemChecks.isHoe(inHand) || inHand.getType() == Material.FISHING_ROD || inHand.getType() == Material.SHEARS) salvagedAmount = 2; - else if (ItemChecks.isHelmet(inHand)) salvagedAmount = 5; - else if (ItemChecks.isChestplate(inHand)) salvagedAmount = 8; - else if (ItemChecks.isPants(inHand)) salvagedAmount = 7; - else if (ItemChecks.isBoots(inHand)) salvagedAmount = 4; - return salvagedAmount; + private static int getSalvagedAmount(final ItemStack inHand) { + if (ItemChecks.isPickaxe(inHand) || ItemChecks.isAxe(inHand) || inHand.getType() == Material.BOW || inHand.getType() == Material.BUCKET) { + return 3; + } + else if (ItemChecks.isShovel(inHand) || inHand.getType() == Material.FLINT_AND_STEEL) { + return 1; + } + else if (ItemChecks.isSword(inHand) || ItemChecks.isHoe(inHand) || inHand.getType() == Material.CARROT_STICK || inHand.getType() == Material.FISHING_ROD || inHand.getType() == Material.SHEARS) { + return 2; + } + else if (ItemChecks.isHelmet(inHand)) { + return 5; + } + else if (ItemChecks.isChestplate(inHand)) { + return 8; + } + else if (ItemChecks.isPants(inHand)) { + return 7; + } + else if (ItemChecks.isBoots(inHand)) { + return 4; + } + else { + return 0; + } } /** * Checks if the item is salvageable. diff --git a/src/main/java/com/gmail/nossr50/util/ItemChecks.java b/src/main/java/com/gmail/nossr50/util/ItemChecks.java index e08939f54..6592900df 100644 --- a/src/main/java/com/gmail/nossr50/util/ItemChecks.java +++ b/src/main/java/com/gmail/nossr50/util/ItemChecks.java @@ -392,6 +392,7 @@ public class ItemChecks { public static boolean isStringTool(ItemStack is) { switch (is.getType()) { case BOW: + case CARROT_STICK: case FISHING_ROD: return true; @@ -429,6 +430,8 @@ public class ItemChecks { */ public static boolean isIronTool(ItemStack is) { switch (is.getType()) { + case BUCKET: + case FLINT_AND_STEEL: case IRON_AXE: case IRON_HOE: case IRON_PICKAXE: