Added ability to repair Fishing Rods

This commit is contained in:
Blake Bartenbach 2012-04-21 21:49:51 -05:00
parent 825bc87ca3
commit bf8649c0a7
6 changed files with 815 additions and 795 deletions

View File

@ -13,15 +13,15 @@ public class ItemChecks {
*/ */
public static boolean isSword(ItemStack is) { public static boolean isSword(ItemStack is) {
switch (is.getType()) { switch (is.getType()) {
case DIAMOND_SWORD: case DIAMOND_SWORD:
case GOLD_SWORD: case GOLD_SWORD:
case IRON_SWORD: case IRON_SWORD:
case STONE_SWORD: case STONE_SWORD:
case WOOD_SWORD: case WOOD_SWORD:
return true; return true;
default: default:
return false; return false;
} }
} }
@ -33,15 +33,15 @@ public class ItemChecks {
*/ */
public static boolean isHoe(ItemStack is) { public static boolean isHoe(ItemStack is) {
switch (is.getType()) { switch (is.getType()) {
case DIAMOND_HOE: case DIAMOND_HOE:
case GOLD_HOE: case GOLD_HOE:
case IRON_HOE: case IRON_HOE:
case STONE_HOE: case STONE_HOE:
case WOOD_HOE: case WOOD_HOE:
return true; return true;
default: default:
return false; return false;
} }
} }
@ -53,15 +53,15 @@ public class ItemChecks {
*/ */
public static boolean isShovel(ItemStack is) { public static boolean isShovel(ItemStack is) {
switch (is.getType()) { switch (is.getType()) {
case DIAMOND_SPADE: case DIAMOND_SPADE:
case GOLD_SPADE: case GOLD_SPADE:
case IRON_SPADE: case IRON_SPADE:
case STONE_SPADE: case STONE_SPADE:
case WOOD_SPADE: case WOOD_SPADE:
return true; return true;
default: default:
return false; return false;
} }
} }
@ -73,15 +73,15 @@ public class ItemChecks {
*/ */
public static boolean isAxe(ItemStack is) { public static boolean isAxe(ItemStack is) {
switch (is.getType()) { switch (is.getType()) {
case DIAMOND_AXE: case DIAMOND_AXE:
case GOLD_AXE: case GOLD_AXE:
case IRON_AXE: case IRON_AXE:
case STONE_AXE: case STONE_AXE:
case WOOD_AXE: case WOOD_AXE:
return true; return true;
default: default:
return false; return false;
} }
} }
@ -93,15 +93,15 @@ public class ItemChecks {
*/ */
public static boolean isMiningPick(ItemStack is) { public static boolean isMiningPick(ItemStack is) {
switch (is.getType()) { switch (is.getType()) {
case DIAMOND_PICKAXE: case DIAMOND_PICKAXE:
case GOLD_PICKAXE: case GOLD_PICKAXE:
case IRON_PICKAXE: case IRON_PICKAXE:
case STONE_PICKAXE: case STONE_PICKAXE:
case WOOD_PICKAXE: case WOOD_PICKAXE:
return true; return true;
default: default:
return false; return false;
} }
} }
@ -113,14 +113,14 @@ public class ItemChecks {
*/ */
public static boolean isHelmet(ItemStack is) { public static boolean isHelmet(ItemStack is) {
switch (is.getType()) { switch (is.getType()) {
case DIAMOND_HELMET: case DIAMOND_HELMET:
case GOLD_HELMET: case GOLD_HELMET:
case IRON_HELMET: case IRON_HELMET:
case LEATHER_HELMET: case LEATHER_HELMET:
return true; return true;
default: default:
return false; return false;
} }
} }
@ -132,14 +132,14 @@ public class ItemChecks {
*/ */
public static boolean isChestplate(ItemStack is) { public static boolean isChestplate(ItemStack is) {
switch (is.getType()) { switch (is.getType()) {
case DIAMOND_CHESTPLATE: case DIAMOND_CHESTPLATE:
case GOLD_CHESTPLATE: case GOLD_CHESTPLATE:
case IRON_CHESTPLATE: case IRON_CHESTPLATE:
case LEATHER_CHESTPLATE: case LEATHER_CHESTPLATE:
return true; return true;
default: default:
return false; return false;
} }
} }
@ -151,14 +151,14 @@ public class ItemChecks {
*/ */
public static boolean isPants(ItemStack is) { public static boolean isPants(ItemStack is) {
switch (is.getType()) { switch (is.getType()) {
case DIAMOND_LEGGINGS: case DIAMOND_LEGGINGS:
case GOLD_LEGGINGS: case GOLD_LEGGINGS:
case IRON_LEGGINGS: case IRON_LEGGINGS:
case LEATHER_LEGGINGS: case LEATHER_LEGGINGS:
return true; return true;
default: default:
return false; return false;
} }
} }
@ -170,14 +170,14 @@ public class ItemChecks {
*/ */
public static boolean isBoots(ItemStack is) { public static boolean isBoots(ItemStack is) {
switch (is.getType()) { switch (is.getType()) {
case DIAMOND_BOOTS: case DIAMOND_BOOTS:
case GOLD_BOOTS: case GOLD_BOOTS:
case IRON_BOOTS: case IRON_BOOTS:
case LEATHER_BOOTS: case LEATHER_BOOTS:
return true; return true;
default: default:
return false; return false;
} }
} }
@ -199,14 +199,14 @@ public class ItemChecks {
*/ */
public static boolean isLeatherArmor(ItemStack is) { public static boolean isLeatherArmor(ItemStack is) {
switch (is.getType()) { switch (is.getType()) {
case LEATHER_BOOTS: case LEATHER_BOOTS:
case LEATHER_CHESTPLATE: case LEATHER_CHESTPLATE:
case LEATHER_HELMET: case LEATHER_HELMET:
case LEATHER_LEGGINGS: case LEATHER_LEGGINGS:
return true; return true;
default: default:
return false; return false;
} }
} }
@ -218,14 +218,14 @@ public class ItemChecks {
*/ */
public static boolean isGoldArmor(ItemStack is) { public static boolean isGoldArmor(ItemStack is) {
switch (is.getType()) { switch (is.getType()) {
case GOLD_BOOTS: case GOLD_BOOTS:
case GOLD_CHESTPLATE: case GOLD_CHESTPLATE:
case GOLD_HELMET: case GOLD_HELMET:
case GOLD_LEGGINGS: case GOLD_LEGGINGS:
return true; return true;
default: default:
return false; return false;
} }
} }
@ -237,14 +237,14 @@ public class ItemChecks {
*/ */
public static boolean isIronArmor(ItemStack is) { public static boolean isIronArmor(ItemStack is) {
switch (is.getType()) { switch (is.getType()) {
case IRON_BOOTS: case IRON_BOOTS:
case IRON_CHESTPLATE: case IRON_CHESTPLATE:
case IRON_HELMET: case IRON_HELMET:
case IRON_LEGGINGS: case IRON_LEGGINGS:
return true; return true;
default: default:
return false; return false;
} }
} }
@ -256,14 +256,14 @@ public class ItemChecks {
*/ */
public static boolean isDiamondArmor(ItemStack is) { public static boolean isDiamondArmor(ItemStack is) {
switch (is.getType()) { switch (is.getType()) {
case DIAMOND_BOOTS: case DIAMOND_BOOTS:
case DIAMOND_CHESTPLATE: case DIAMOND_CHESTPLATE:
case DIAMOND_HELMET: case DIAMOND_HELMET:
case DIAMOND_LEGGINGS: case DIAMOND_LEGGINGS:
return true; return true;
default: default:
return false; return false;
} }
} }
@ -274,7 +274,7 @@ public class ItemChecks {
* @return true if the item is a tool, false otherwise * @return true if the item is a tool, false otherwise
*/ */
public static boolean isTool(ItemStack is) { public static boolean isTool(ItemStack is) {
return isStoneTool(is) || isWoodTool(is) || isGoldTool(is) || isIronTool(is) || isDiamondTool(is) || is.getType().equals(Material.BOW); return isStoneTool(is) || isWoodTool(is) || isGoldTool(is) || isIronTool(is) || isDiamondTool(is) || isStringTool(is);
} }
/** /**
@ -285,15 +285,15 @@ public class ItemChecks {
*/ */
public static boolean isStoneTool(ItemStack is) { public static boolean isStoneTool(ItemStack is) {
switch (is.getType()) { switch (is.getType()) {
case STONE_AXE: case STONE_AXE:
case STONE_HOE: case STONE_HOE:
case STONE_PICKAXE: case STONE_PICKAXE:
case STONE_SPADE: case STONE_SPADE:
case STONE_SWORD: case STONE_SWORD:
return true; return true;
default: default:
return false; return false;
} }
} }
@ -305,15 +305,15 @@ public class ItemChecks {
*/ */
public static boolean isWoodTool(ItemStack is) { public static boolean isWoodTool(ItemStack is) {
switch (is.getType()) { switch (is.getType()) {
case WOOD_AXE: case WOOD_AXE:
case WOOD_HOE: case WOOD_HOE:
case WOOD_PICKAXE: case WOOD_PICKAXE:
case WOOD_SPADE: case WOOD_SPADE:
case WOOD_SWORD: case WOOD_SWORD:
return true; return true;
default: default:
return false; return false;
} }
} }
@ -325,18 +325,37 @@ public class ItemChecks {
*/ */
public static boolean isGoldTool(ItemStack is) { public static boolean isGoldTool(ItemStack is) {
switch (is.getType()) { switch (is.getType()) {
case GOLD_AXE: case GOLD_AXE:
case GOLD_HOE: case GOLD_HOE:
case GOLD_PICKAXE: case GOLD_PICKAXE:
case GOLD_SPADE: case GOLD_SPADE:
case GOLD_SWORD: case GOLD_SWORD:
return true; return true;
default: default:
return false; return false;
} }
} }
/**
* Checks to see if an item is a string tool.
*
* @param is Item to check
* @return true if the item is a string tool, false otherwise
*/
public static boolean isStringTool(ItemStack is) {
switch (is.getType()) {
case BOW:
case FISHING_ROD:
return true;
default:
return false;
}
}
/** /**
* Checks to see if an item is an iron tool. * Checks to see if an item is an iron tool.
* *
@ -345,16 +364,16 @@ public class ItemChecks {
*/ */
public static boolean isIronTool(ItemStack is) { public static boolean isIronTool(ItemStack is) {
switch (is.getType()) { switch (is.getType()) {
case IRON_AXE: case IRON_AXE:
case IRON_HOE: case IRON_HOE:
case IRON_PICKAXE: case IRON_PICKAXE:
case IRON_SPADE: case IRON_SPADE:
case IRON_SWORD: case IRON_SWORD:
case SHEARS: case SHEARS:
return true; return true;
default: default:
return false; return false;
} }
} }
@ -366,15 +385,15 @@ public class ItemChecks {
*/ */
public static boolean isDiamondTool(ItemStack is) { public static boolean isDiamondTool(ItemStack is) {
switch (is.getType()) { switch (is.getType()) {
case DIAMOND_AXE: case DIAMOND_AXE:
case DIAMOND_HOE: case DIAMOND_HOE:
case DIAMOND_PICKAXE: case DIAMOND_PICKAXE:
case DIAMOND_SPADE: case DIAMOND_SPADE:
case DIAMOND_SWORD: case DIAMOND_SWORD:
return true; return true;
default: default:
return false; return false;
} }
} }
} }

View File

@ -87,7 +87,7 @@ public class LoadProperties extends ConfigLoader{
public static Boolean anvilmessages; public static Boolean anvilmessages;
public static int rWood, rStone, rIron, rGold, rDiamond, rString, rLeather; public static int rWood, rStone, rIron, rGold, rDiamond, rString, rLeather;
public static int anvilID; public static int anvilID;
public static int repairStoneLevel, repairIronLevel, repairGoldLevel, repairdiamondlevel, repairBowLevel; public static int repairStoneLevel, repairIronLevel, repairGoldLevel, repairdiamondlevel, repairStringLevel;
/* Taming */ /* Taming */
public static int mtameWolf, mtameOcelot; public static int mtameWolf, mtameOcelot;
@ -377,7 +377,7 @@ public class LoadProperties extends ConfigLoader{
repairIronLevel = config.getInt("Skills.Repair.Iron.Level_Required", 0); repairIronLevel = config.getInt("Skills.Repair.Iron.Level_Required", 0);
repairGoldLevel = config.getInt("Skills.Repair.Gold.Level_Required", 0); repairGoldLevel = config.getInt("Skills.Repair.Gold.Level_Required", 0);
repairStoneLevel = config.getInt("Skills.Repair.Stone.Level_Required", 0); repairStoneLevel = config.getInt("Skills.Repair.Stone.Level_Required", 0);
repairBowLevel = config.getInt("Skills.Repair.String.Level_Required", 0); repairStringLevel = config.getInt("Skills.Repair.String.Level_Required", 0);
tamingxpmodifier = config.getDouble("Experience.Formula.Multiplier.Taming", 1.0); tamingxpmodifier = config.getDouble("Experience.Formula.Multiplier.Taming", 1.0);
miningxpmodifier = config.getDouble("Experience.Formula.Multiplier.Mining", 1.0); miningxpmodifier = config.getDouble("Experience.Formula.Multiplier.Mining", 1.0);

View File

@ -50,6 +50,7 @@ public class mcLocale {
return output; return output;
} }
catch (MissingResourceException e) { catch (MissingResourceException e) {
e.printStackTrace();
return '!' + key + '!'; return '!' + key + '!';
} }
} }

View File

@ -169,8 +169,8 @@ public class mcPermissions {
return player.hasPermission("mcmmo.ability.repair.toolrepair"); return player.hasPermission("mcmmo.ability.repair.toolrepair");
} }
public boolean bowRepair(Player player) { public boolean stringRepair(Player player) {
return player.hasPermission("mcmmo.ability.repair.bowrepair"); return player.hasPermission("mcmmo.ability.repair.stringrepair");
} }
/* /*

View File

@ -93,7 +93,7 @@ public class Repair {
repairItem(player, is, new ItemStack(LoadProperties.rGold)); repairItem(player, is, new ItemStack(LoadProperties.rGold));
xpHandler(player, PP, is, durabilityBefore, 8, true); xpHandler(player, PP, is, durabilityBefore, 8, true);
} }
else if (is.getType().equals(Material.BOW) && inventory.contains(LoadProperties.rString) && skillLevel >= LoadProperties.repairBowLevel && mcPermissions.getInstance().bowRepair(player)){ else if (ItemChecks.isStringTool(is) && inventory.contains(LoadProperties.rString) && skillLevel >= LoadProperties.repairStringLevel && mcPermissions.getInstance().stringRepair(player)){
repairItem(player, is, new ItemStack(LoadProperties.rString)); repairItem(player, is, new ItemStack(LoadProperties.rString));
xpHandler(player, PP, is, durabilityBefore, 2, false); xpHandler(player, PP, is, durabilityBefore, 2, false);
} }
@ -141,7 +141,7 @@ public class Repair {
PP.addXP(SkillType.REPAIR, dif * 10); PP.addXP(SkillType.REPAIR, dif * 10);
Skills.XpCheckSkill(SkillType.REPAIR, player); Skills.XpCheckSkill(SkillType.REPAIR, player);
//CLANG CLANG //CLANG CLANG (scary noise)
if (LoadProperties.spoutEnabled) { if (LoadProperties.spoutEnabled) {
SpoutSounds.playRepairNoise(player); SpoutSounds.playRepairNoise(player);
} }
@ -321,7 +321,7 @@ public class Repair {
else if (ItemChecks.isHoe(is) || ItemChecks.isSword(is) || is.getType().equals(Material.SHEARS)) { else if (ItemChecks.isHoe(is) || ItemChecks.isSword(is) || is.getType().equals(Material.SHEARS)) {
ramt = maxDurability / 2; ramt = maxDurability / 2;
} }
else if (ItemChecks.isAxe(is) || ItemChecks.isMiningPick(is) || is.getType().equals(Material.BOW)) { else if (ItemChecks.isAxe(is) || ItemChecks.isMiningPick(is) || ItemChecks.isStringTool(is)) {
ramt = maxDurability / 3; ramt = maxDurability / 3;
} }
else if (ItemChecks.isBoots(is)) { else if (ItemChecks.isBoots(is)) {
@ -391,7 +391,7 @@ public class Repair {
else if (ItemChecks.isLeatherArmor(is)) { else if (ItemChecks.isLeatherArmor(is)) {
player.sendMessage(mcLocale.getString("Skills.NeedMore") + " " + ChatColor.YELLOW + m.prettyItemString(LoadProperties.rLeather)); player.sendMessage(mcLocale.getString("Skills.NeedMore") + " " + ChatColor.YELLOW + m.prettyItemString(LoadProperties.rLeather));
} }
else if (is.getType().equals(Material.BOW)) { else if (ItemChecks.isStringTool(is)) {
player.sendMessage(mcLocale.getString("Skills.NeedMore") + " " + ChatColor.YELLOW + m.prettyItemString(LoadProperties.rString)); player.sendMessage(mcLocale.getString("Skills.NeedMore") + " " + ChatColor.YELLOW + m.prettyItemString(LoadProperties.rString));
} }
} }

View File

@ -239,8 +239,8 @@ permissions:
description: Allows ability to repair armor description: Allows ability to repair armor
mcmmo.ability.repair.toolrepair: mcmmo.ability.repair.toolrepair:
description: Allows ability to repair tools description: Allows ability to repair tools
mcmmo.ability.repair.bowrepair: mcmmo.ability.repair.stringrepair:
description: Allows ability to repair bows description: Allows ability to repair bows and fishing rods
mcmmo.ability.unarmed.*: mcmmo.ability.unarmed.*:
description: Allows access to all Unarmed abilities description: Allows access to all Unarmed abilities
children: children: