From bf8649c0a74677ea2fc24b58adbceccfecbf4bd9 Mon Sep 17 00:00:00 2001 From: Blake Bartenbach Date: Sat, 21 Apr 2012 21:49:51 -0500 Subject: [PATCH] Added ability to repair Fishing Rods --- .../java/com/gmail/nossr50/ItemChecks.java | 779 +++++++++-------- .../gmail/nossr50/config/LoadProperties.java | 4 +- .../com/gmail/nossr50/locale/mcLocale.java | 1 + .../java/com/gmail/nossr50/mcPermissions.java | 814 +++++++++--------- .../java/com/gmail/nossr50/skills/Repair.java | 8 +- src/main/resources/plugin.yml | 4 +- 6 files changed, 815 insertions(+), 795 deletions(-) diff --git a/src/main/java/com/gmail/nossr50/ItemChecks.java b/src/main/java/com/gmail/nossr50/ItemChecks.java index 2e5b3b664..0331b955c 100644 --- a/src/main/java/com/gmail/nossr50/ItemChecks.java +++ b/src/main/java/com/gmail/nossr50/ItemChecks.java @@ -1,380 +1,399 @@ -package com.gmail.nossr50; - -import org.bukkit.Material; -import org.bukkit.inventory.ItemStack; - -public class ItemChecks { - - /** - * Checks if the item is a sword. - * - * @param is Item to check - * @return true if the item is a sword, false otherwise - */ - public static boolean isSword(ItemStack is) { - switch (is.getType()) { - case DIAMOND_SWORD: - case GOLD_SWORD: - case IRON_SWORD: - case STONE_SWORD: - case WOOD_SWORD: - return true; - - default: - return false; - } - } - - /** - * Checks if the item is a hoe. - * - * @param is Item to check - * @return true if the item is a hoe, false otherwise - */ - public static boolean isHoe(ItemStack is) { - switch (is.getType()) { - case DIAMOND_HOE: - case GOLD_HOE: - case IRON_HOE: - case STONE_HOE: - case WOOD_HOE: - return true; - - default: - return false; - } - } - - /** - * Checks if the item is a shovel. - * - * @param is Item to check - * @return true if the item is a shovel, false otherwise - */ - public static boolean isShovel(ItemStack is) { - switch (is.getType()) { - case DIAMOND_SPADE: - case GOLD_SPADE: - case IRON_SPADE: - case STONE_SPADE: - case WOOD_SPADE: - return true; - - default: - return false; - } - } - - /** - * Checks if the item is an axe. - * - * @param is Item to check - * @return true if the item is an axe, false otherwise - */ - public static boolean isAxe(ItemStack is) { - switch (is.getType()) { - case DIAMOND_AXE: - case GOLD_AXE: - case IRON_AXE: - case STONE_AXE: - case WOOD_AXE: - return true; - - default: - return false; - } - } - - /** - * Checks if the item is a pickaxe. - * - * @param is Item to check - * @return true if the item is a pickaxe, false otherwise - */ - public static boolean isMiningPick(ItemStack is) { - switch (is.getType()) { - case DIAMOND_PICKAXE: - case GOLD_PICKAXE: - case IRON_PICKAXE: - case STONE_PICKAXE: - case WOOD_PICKAXE: - return true; - - default: - return false; - } - } - - /** - * Checks if the item is a helmet. - * - * @param is Item to check - * @return true if the item is a helmet, false otherwise - */ - public static boolean isHelmet(ItemStack is) { - switch (is.getType()) { - case DIAMOND_HELMET: - case GOLD_HELMET: - case IRON_HELMET: - case LEATHER_HELMET: - return true; - - default: - return false; - } - } - - /** - * Checks if the item is a chestplate. - * - * @param is Item to check - * @return true if the item is a chestplate, false otherwise - */ - public static boolean isChestplate(ItemStack is) { - switch (is.getType()) { - case DIAMOND_CHESTPLATE: - case GOLD_CHESTPLATE: - case IRON_CHESTPLATE: - case LEATHER_CHESTPLATE: - return true; - - default: - return false; - } - } - - /** - * Checks if the item is a pair of pants. - * - * @param is Item to check - * @return true if the item is a pair of pants, false otherwise - */ - public static boolean isPants(ItemStack is) { - switch (is.getType()) { - case DIAMOND_LEGGINGS: - case GOLD_LEGGINGS: - case IRON_LEGGINGS: - case LEATHER_LEGGINGS: - return true; - - default: - return false; - } - } - - /** - * Checks if the item is a pair of boots. - * - * @param is Item to check - * @return true if the item is a pair of boots, false otherwise - */ - public static boolean isBoots(ItemStack is) { - switch (is.getType()) { - case DIAMOND_BOOTS: - case GOLD_BOOTS: - case IRON_BOOTS: - case LEATHER_BOOTS: - return true; - - default: - return false; - } - } - - /** - * Checks to see if an item is a wearable armor piece. - * - * @param is Item to check - * @return true if the item is armor, false otherwise - */ - public static boolean isArmor(ItemStack is) { - return isLeatherArmor(is) || isGoldArmor(is) || isIronArmor(is) || isDiamondArmor(is); - } - - /** - * Checks to see if an item is a leather armor piece. - * - * @param is Item to check - * @return true if the item is leather armor, false otherwise - */ - public static boolean isLeatherArmor(ItemStack is) { - switch (is.getType()) { - case LEATHER_BOOTS: - case LEATHER_CHESTPLATE: - case LEATHER_HELMET: - case LEATHER_LEGGINGS: - return true; - - default: - return false; - } - } - - /** - * Checks to see if an item is a gold armor piece. - * - * @param is Item to check - * @return true if the item is gold armor, false otherwise - */ - public static boolean isGoldArmor(ItemStack is) { - switch (is.getType()) { - case GOLD_BOOTS: - case GOLD_CHESTPLATE: - case GOLD_HELMET: - case GOLD_LEGGINGS: - return true; - - default: - return false; - } - } - - /** - * Checks to see if an item is an iron armor piece. - * - * @param is Item to check - * @return true if the item is iron armor, false otherwise - */ - public static boolean isIronArmor(ItemStack is) { - switch (is.getType()) { - case IRON_BOOTS: - case IRON_CHESTPLATE: - case IRON_HELMET: - case IRON_LEGGINGS: - return true; - - default: - return false; - } - } - - /** - * Checks to see if an item is a diamond armor piece. - * - * @param is Item to check - * @return true if the item is diamond armor, false otherwise - */ - public static boolean isDiamondArmor(ItemStack is) { - switch (is.getType()) { - case DIAMOND_BOOTS: - case DIAMOND_CHESTPLATE: - case DIAMOND_HELMET: - case DIAMOND_LEGGINGS: - return true; - - default: - return false; - } - } - - /** - * Checks to see if an item is a tool. - * - * @param is Item to check - * @return true if the item is a tool, false otherwise - */ - public static boolean isTool(ItemStack is) { - return isStoneTool(is) || isWoodTool(is) || isGoldTool(is) || isIronTool(is) || isDiamondTool(is) || is.getType().equals(Material.BOW); - } - - /** - * Checks to see if an item is a stone tool. - * - * @param is Item to check - * @return true if the item is a stone tool, false otherwise - */ - public static boolean isStoneTool(ItemStack is) { - switch (is.getType()) { - case STONE_AXE: - case STONE_HOE: - case STONE_PICKAXE: - case STONE_SPADE: - case STONE_SWORD: - return true; - - default: - return false; - } - } - - /** - * Checks to see if an item is a wooden tool. - * - * @param is Item to check - * @return true if the item is a wooden tool, false otherwise - */ - public static boolean isWoodTool(ItemStack is) { - switch (is.getType()) { - case WOOD_AXE: - case WOOD_HOE: - case WOOD_PICKAXE: - case WOOD_SPADE: - case WOOD_SWORD: - return true; - - default: - return false; - } - } - - /** - * Checks to see if an item is a gold tool. - * - * @param is Item to check - * @return true if the item is a stone tool, false otherwise - */ - public static boolean isGoldTool(ItemStack is) { - switch (is.getType()) { - case GOLD_AXE: - case GOLD_HOE: - case GOLD_PICKAXE: - case GOLD_SPADE: - case GOLD_SWORD: - return true; - - default: - return false; - } - } - - /** - * Checks to see if an item is an iron tool. - * - * @param is Item to check - * @return true if the item is an iron tool, false otherwise - */ - public static boolean isIronTool(ItemStack is) { - switch (is.getType()) { - case IRON_AXE: - case IRON_HOE: - case IRON_PICKAXE: - case IRON_SPADE: - case IRON_SWORD: - case SHEARS: - return true; - - default: - return false; - } - } - - /** - * Checks to see if an item is a diamond tool. - * - * @param is Item to check - * @return true if the item is a diamond tool, false otherwise - */ - public static boolean isDiamondTool(ItemStack is) { - switch (is.getType()) { - case DIAMOND_AXE: - case DIAMOND_HOE: - case DIAMOND_PICKAXE: - case DIAMOND_SPADE: - case DIAMOND_SWORD: - return true; - - default: - return false; - } - } -} +package com.gmail.nossr50; + +import org.bukkit.Material; +import org.bukkit.inventory.ItemStack; + +public class ItemChecks { + + /** + * Checks if the item is a sword. + * + * @param is Item to check + * @return true if the item is a sword, false otherwise + */ + public static boolean isSword(ItemStack is) { + switch (is.getType()) { + case DIAMOND_SWORD: + case GOLD_SWORD: + case IRON_SWORD: + case STONE_SWORD: + case WOOD_SWORD: + return true; + + default: + return false; + } + } + + /** + * Checks if the item is a hoe. + * + * @param is Item to check + * @return true if the item is a hoe, false otherwise + */ + public static boolean isHoe(ItemStack is) { + switch (is.getType()) { + case DIAMOND_HOE: + case GOLD_HOE: + case IRON_HOE: + case STONE_HOE: + case WOOD_HOE: + return true; + + default: + return false; + } + } + + /** + * Checks if the item is a shovel. + * + * @param is Item to check + * @return true if the item is a shovel, false otherwise + */ + public static boolean isShovel(ItemStack is) { + switch (is.getType()) { + case DIAMOND_SPADE: + case GOLD_SPADE: + case IRON_SPADE: + case STONE_SPADE: + case WOOD_SPADE: + return true; + + default: + return false; + } + } + + /** + * Checks if the item is an axe. + * + * @param is Item to check + * @return true if the item is an axe, false otherwise + */ + public static boolean isAxe(ItemStack is) { + switch (is.getType()) { + case DIAMOND_AXE: + case GOLD_AXE: + case IRON_AXE: + case STONE_AXE: + case WOOD_AXE: + return true; + + default: + return false; + } + } + + /** + * Checks if the item is a pickaxe. + * + * @param is Item to check + * @return true if the item is a pickaxe, false otherwise + */ + public static boolean isMiningPick(ItemStack is) { + switch (is.getType()) { + case DIAMOND_PICKAXE: + case GOLD_PICKAXE: + case IRON_PICKAXE: + case STONE_PICKAXE: + case WOOD_PICKAXE: + return true; + + default: + return false; + } + } + + /** + * Checks if the item is a helmet. + * + * @param is Item to check + * @return true if the item is a helmet, false otherwise + */ + public static boolean isHelmet(ItemStack is) { + switch (is.getType()) { + case DIAMOND_HELMET: + case GOLD_HELMET: + case IRON_HELMET: + case LEATHER_HELMET: + return true; + + default: + return false; + } + } + + /** + * Checks if the item is a chestplate. + * + * @param is Item to check + * @return true if the item is a chestplate, false otherwise + */ + public static boolean isChestplate(ItemStack is) { + switch (is.getType()) { + case DIAMOND_CHESTPLATE: + case GOLD_CHESTPLATE: + case IRON_CHESTPLATE: + case LEATHER_CHESTPLATE: + return true; + + default: + return false; + } + } + + /** + * Checks if the item is a pair of pants. + * + * @param is Item to check + * @return true if the item is a pair of pants, false otherwise + */ + public static boolean isPants(ItemStack is) { + switch (is.getType()) { + case DIAMOND_LEGGINGS: + case GOLD_LEGGINGS: + case IRON_LEGGINGS: + case LEATHER_LEGGINGS: + return true; + + default: + return false; + } + } + + /** + * Checks if the item is a pair of boots. + * + * @param is Item to check + * @return true if the item is a pair of boots, false otherwise + */ + public static boolean isBoots(ItemStack is) { + switch (is.getType()) { + case DIAMOND_BOOTS: + case GOLD_BOOTS: + case IRON_BOOTS: + case LEATHER_BOOTS: + return true; + + default: + return false; + } + } + + /** + * Checks to see if an item is a wearable armor piece. + * + * @param is Item to check + * @return true if the item is armor, false otherwise + */ + public static boolean isArmor(ItemStack is) { + return isLeatherArmor(is) || isGoldArmor(is) || isIronArmor(is) || isDiamondArmor(is); + } + + /** + * Checks to see if an item is a leather armor piece. + * + * @param is Item to check + * @return true if the item is leather armor, false otherwise + */ + public static boolean isLeatherArmor(ItemStack is) { + switch (is.getType()) { + case LEATHER_BOOTS: + case LEATHER_CHESTPLATE: + case LEATHER_HELMET: + case LEATHER_LEGGINGS: + return true; + + default: + return false; + } + } + + /** + * Checks to see if an item is a gold armor piece. + * + * @param is Item to check + * @return true if the item is gold armor, false otherwise + */ + public static boolean isGoldArmor(ItemStack is) { + switch (is.getType()) { + case GOLD_BOOTS: + case GOLD_CHESTPLATE: + case GOLD_HELMET: + case GOLD_LEGGINGS: + return true; + + default: + return false; + } + } + + /** + * Checks to see if an item is an iron armor piece. + * + * @param is Item to check + * @return true if the item is iron armor, false otherwise + */ + public static boolean isIronArmor(ItemStack is) { + switch (is.getType()) { + case IRON_BOOTS: + case IRON_CHESTPLATE: + case IRON_HELMET: + case IRON_LEGGINGS: + return true; + + default: + return false; + } + } + + /** + * Checks to see if an item is a diamond armor piece. + * + * @param is Item to check + * @return true if the item is diamond armor, false otherwise + */ + public static boolean isDiamondArmor(ItemStack is) { + switch (is.getType()) { + case DIAMOND_BOOTS: + case DIAMOND_CHESTPLATE: + case DIAMOND_HELMET: + case DIAMOND_LEGGINGS: + return true; + + default: + return false; + } + } + + /** + * Checks to see if an item is a tool. + * + * @param is Item to check + * @return true if the item is a tool, false otherwise + */ + public static boolean isTool(ItemStack is) { + return isStoneTool(is) || isWoodTool(is) || isGoldTool(is) || isIronTool(is) || isDiamondTool(is) || isStringTool(is); + } + + /** + * Checks to see if an item is a stone tool. + * + * @param is Item to check + * @return true if the item is a stone tool, false otherwise + */ + public static boolean isStoneTool(ItemStack is) { + switch (is.getType()) { + case STONE_AXE: + case STONE_HOE: + case STONE_PICKAXE: + case STONE_SPADE: + case STONE_SWORD: + return true; + + default: + return false; + } + } + + /** + * Checks to see if an item is a wooden tool. + * + * @param is Item to check + * @return true if the item is a wooden tool, false otherwise + */ + public static boolean isWoodTool(ItemStack is) { + switch (is.getType()) { + case WOOD_AXE: + case WOOD_HOE: + case WOOD_PICKAXE: + case WOOD_SPADE: + case WOOD_SWORD: + return true; + + default: + return false; + } + } + + /** + * Checks to see if an item is a gold tool. + * + * @param is Item to check + * @return true if the item is a stone tool, false otherwise + */ + public static boolean isGoldTool(ItemStack is) { + switch (is.getType()) { + case GOLD_AXE: + case GOLD_HOE: + case GOLD_PICKAXE: + case GOLD_SPADE: + case GOLD_SWORD: + return true; + + default: + 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. + * + * @param is Item to check + * @return true if the item is an iron tool, false otherwise + */ + public static boolean isIronTool(ItemStack is) { + switch (is.getType()) { + case IRON_AXE: + case IRON_HOE: + case IRON_PICKAXE: + case IRON_SPADE: + case IRON_SWORD: + case SHEARS: + return true; + + default: + return false; + } + } + + /** + * Checks to see if an item is a diamond tool. + * + * @param is Item to check + * @return true if the item is a diamond tool, false otherwise + */ + public static boolean isDiamondTool(ItemStack is) { + switch (is.getType()) { + case DIAMOND_AXE: + case DIAMOND_HOE: + case DIAMOND_PICKAXE: + case DIAMOND_SPADE: + case DIAMOND_SWORD: + return true; + + default: + return false; + } + } +} \ No newline at end of file diff --git a/src/main/java/com/gmail/nossr50/config/LoadProperties.java b/src/main/java/com/gmail/nossr50/config/LoadProperties.java index 1465c3571..14a5ed868 100644 --- a/src/main/java/com/gmail/nossr50/config/LoadProperties.java +++ b/src/main/java/com/gmail/nossr50/config/LoadProperties.java @@ -87,7 +87,7 @@ public class LoadProperties extends ConfigLoader{ public static Boolean anvilmessages; public static int rWood, rStone, rIron, rGold, rDiamond, rString, rLeather; public static int anvilID; - public static int repairStoneLevel, repairIronLevel, repairGoldLevel, repairdiamondlevel, repairBowLevel; + public static int repairStoneLevel, repairIronLevel, repairGoldLevel, repairdiamondlevel, repairStringLevel; /* Taming */ public static int mtameWolf, mtameOcelot; @@ -377,7 +377,7 @@ public class LoadProperties extends ConfigLoader{ repairIronLevel = config.getInt("Skills.Repair.Iron.Level_Required", 0); repairGoldLevel = config.getInt("Skills.Repair.Gold.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); miningxpmodifier = config.getDouble("Experience.Formula.Multiplier.Mining", 1.0); diff --git a/src/main/java/com/gmail/nossr50/locale/mcLocale.java b/src/main/java/com/gmail/nossr50/locale/mcLocale.java index 7e8472da8..293f9b907 100644 --- a/src/main/java/com/gmail/nossr50/locale/mcLocale.java +++ b/src/main/java/com/gmail/nossr50/locale/mcLocale.java @@ -50,6 +50,7 @@ public class mcLocale { return output; } catch (MissingResourceException e) { + e.printStackTrace(); return '!' + key + '!'; } } diff --git a/src/main/java/com/gmail/nossr50/mcPermissions.java b/src/main/java/com/gmail/nossr50/mcPermissions.java index 61ea27a29..d628930c2 100644 --- a/src/main/java/com/gmail/nossr50/mcPermissions.java +++ b/src/main/java/com/gmail/nossr50/mcPermissions.java @@ -1,407 +1,407 @@ -package com.gmail.nossr50; - -import org.bukkit.entity.Player; - -public class mcPermissions { - private static volatile mcPermissions instance; - - public boolean permission(Player player, String perm) { - return player.hasPermission(perm); - } - - public static mcPermissions getInstance() { - if (instance == null) { - instance = new mcPermissions(); - } - - return instance; - } - - /* - * GENERIC PERMISSIONS - */ - - public boolean motd(Player player) { - return player.hasPermission("mcmmo.motd"); - } - - public boolean admin(Player player) { - return player.hasPermission("mcmmo.admin"); - } - - public boolean arcaneBypass(Player player) { - return player.hasPermission("mcmmo.bypass.arcanebypass"); - } - - /* - * MCMMO.TOOLS.* - */ - - public boolean mcrefresh(Player player) { - return player.hasPermission("mcmmo.tools.mcrefresh"); - } - - public boolean mcremove(Player player) { - return player.hasPermission("mcmmo.tools.mcremove"); - } - - public boolean mmoedit(Player player) { - return player.hasPermission("mcmmo.tools.mmoedit"); - } - - public boolean mcgod(Player player) { - return player.hasPermission("mcmmo.tools.mcgod"); - } - - /* - * MCMMO.ABILITY.TAMING.* - */ - - public boolean fastFoodService(Player player) { - return player.hasPermission("mcmmo.ability.taming.fastfoodservice"); - } - - public boolean sharpenedclaws(Player player) { - return player.hasPermission("mcmmo.ability.taming.sharpenedclaws"); - } - - public boolean gore(Player player) { - return player.hasPermission("mcmmo.ability.taming.gore"); - } - - public boolean callOfTheWild(Player player) { - return player.hasPermission("mcmmo.ability.taming.callofthewild"); - } - - public boolean environmentallyAware(Player player) { - return player.hasPermission("mcmmo.ability.taming.environmentallyaware"); - } - - public boolean thickFur(Player player) { - return player.hasPermission("mcmmo.ability.taming.thickfur"); - } - - public boolean shockProof(Player player) { - return player.hasPermission("mcmmo.ability.taming.shockproof"); - } - - public boolean beastLore(Player player) { - return player.hasPermission("mcmmo.ability.taming.beastlore"); - } - - /* - * MCMMO.ABILITY.FISHING.* - */ - - public boolean shakeMob(Player player) { - return player.hasPermission("mcmmo.ability.fishing.shakemob"); - } - - /* - * MCMMO.ABILITY.MINING.* - */ - - public boolean superBreaker(Player player) { - return player.hasPermission("mcmmo.ability.mining.superbreaker"); - } - - public boolean miningDoubleDrops(Player player) { - return player.hasPermission("mcmmo.ability.mining.doubledrops"); - } - - /* - * MCMMO.ABILITY.WOODCUTTING.* - */ - - public boolean treeFeller(Player player) { - return player.hasPermission("mcmmo.ability.woodcutting.treefeller"); - } - - public boolean leafBlower(Player player) { - return player.hasPermission("mcmmo.ability.woodcutting.leafblower"); - } - - public boolean woodcuttingDoubleDrops(Player player) { - return player.hasPermission("mcmmo.ability.woodcutting.doubledrops"); - } - - /* - * MCMMO.ABILITY.REPAIR.* - */ - - public boolean repairBonus(Player player) { - return player.hasPermission("mcmmo.ability.repair.repairbonus"); - } - - public boolean arcaneForging(Player player) { - return player.hasPermission("mcmmo.ability.repair.arcaneforging"); - } - - public boolean woodRepair(Player player) { - return player.hasPermission("mcmmo.ability.repair.woodrepair"); - } - - public boolean stoneRepair(Player player) { - return player.hasPermission("mcmmo.ability.repair.stonerepair"); - } - - public boolean leatherRepair(Player player) { - return player.hasPermission("mcmmo.ability.repair.leatherrepair"); - } - - public boolean ironRepair(Player player) { - return player.hasPermission("mcmmo.ability.repair.ironrepair"); - } - - public boolean goldRepair(Player player) { - return player.hasPermission("mcmmo.ability.repair.goldrepair"); - } - - public boolean diamondRepair(Player player) { - return player.hasPermission("mcmmo.ability.repair.diamondrepair"); - } - - public boolean armorRepair(Player player) { - return player.hasPermission("mcmmo.ability.repair.armorrepair"); - } - - public boolean toolRepair(Player player) { - return player.hasPermission("mcmmo.ability.repair.toolrepair"); - } - - public boolean bowRepair(Player player) { - return player.hasPermission("mcmmo.ability.repair.bowrepair"); - } - - /* - * MCMMO.ABILITY.UNARMED.* - */ - - public boolean unarmedBonus(Player player) { - return player.hasPermission("mcmmo.ability.unarmed.bonusdamage"); - } - - public boolean disarm(Player player) { - return player.hasPermission("mcmmo.ability.unarmed.disarm"); - } - - public boolean berserk(Player player) { - return player.hasPermission("mcmmo.ability.unarmed.berserk"); - } - - public boolean deflect(Player player) { - return player.hasPermission("mcmmo.ability.unarmed.deflect"); - } - - /* - * MCMMO.ABILITY.ARCHERY.* - */ - - public boolean trackArrows(Player player) { - return player.hasPermission("mcmmo.ability.archery.trackarrows"); - } - - public boolean ignition(Player player) { - return player.hasPermission("mcmmo.ability.archery.ignition"); - } - - public boolean daze(Player player) { - return player.hasPermission("mcmmo.ability.archery.daze"); - } - - /* - * MCMMO.ABILITY.HERBALISM.* - */ - - public boolean herbalismDoubleDrops(Player player) { - return player.hasPermission("mcmmo.ability.herbalism.doubledrops"); - } - - public boolean greenTerra(Player player) { - return player.hasPermission("mcmmo.ability.herbalism.greenterra"); - } - - public boolean greenThumbBlocks(Player player) { - return player.hasPermission("mcmmo.ability.herbalism.greenthumbblocks"); - } - - public boolean greenThumbWheat(Player player) { - return player.hasPermission("mcmmo.ability.herbalism.greenthumbwheat"); - } - - /* - * MCMMO.ABILITY.EXCAVATION.* - */ - - public boolean gigaDrillBreaker(Player player) { - return player.hasPermission("mcmmo.ability.excavation.gigadrillbreaker"); - } - - public boolean excavationTreasures(Player player) { - return player.hasPermission("mcmmo.ability.excavation.treasures"); - } - - /* - * MCMMO.ABILITY.SWORDS.* - */ - - public boolean swordsBleed(Player player) { - return player.hasPermission("mcmmo.ability.swords.bleed"); - } - - public boolean serratedStrikes(Player player) { - return player.hasPermission("mcmmo.ability.swords.serratedstrikes"); - } - - public boolean counterAttack(Player player) { - return player.hasPermission("mcmmo.ability.swords.counterattack"); - } - - /* - * MCMMO.ABILITY.AXES.* - */ - - public boolean skullSplitter(Player player) { - return player.hasPermission("mcmmo.ability.axes.skullsplitter"); - } - - public boolean axeBonus(Player player) { - return player.hasPermission("mcmmo.ability.axes.bonusdamage"); - } - - public boolean criticalHit(Player player) { - return player.hasPermission("mcmmo.ability.axes.criticalhit"); - } - - public boolean impact(Player player) { - return player.hasPermission("mcmmo.ability.axes.impact"); - } - - /* - * MCMMO.ABILITY.ACROBATICS.* - */ - - public boolean roll(Player player) { - return player.hasPermission("mcmmo.ability.acrobatics.roll"); - } - - public boolean gracefulRoll(Player player) { - return player.hasPermission("mcmmo.ability.acrobatics.gracefulroll"); - } - - public boolean dodge(Player player) { - return player.hasPermission("mcmmo.ability.acrobatics.dodge"); - } - - /* - * MCMMO.ABILITY.BLASTMINING.* - */ - - public boolean biggerBombs(Player player) { - return player.hasPermission("mcmmo.ability.blastmining.biggerbombs"); - } - - public boolean demolitionsExpertise(Player player) { - return player.hasPermission("mcmmo.ability.blastmining.demolitionsexpertise"); - } - - /* - * MCMMO.ITEM.* - */ - - public boolean chimaeraWing(Player player) { - return player.hasPermission("mcmmo.item.chimaerawing"); - } - - /* - * MCMMO.COMMANDS.* - */ - - public boolean mcAbility(Player player) { - return player.hasPermission("mcmmo.commands.ability"); - } - - public boolean partyTeleport(Player player) { - return player.hasPermission("mcmmo.commands.ptp"); - } - - public boolean inspect(Player player) { - return player.hasPermission("mcmmo.commands.inspect"); - } - - public boolean party(Player player) { - return player.hasPermission("mcmmo.commands.party"); - } - - /* - * MCMMO.CHAT.* - */ - - public boolean partyChat(Player player) { - return player.hasPermission("mcmmo.chat.partychat"); - } - - public boolean partyLock(Player player) { - return player.hasPermission("mcmmo.chat.partylock"); - } - - public boolean adminChat(Player player) { - return player.hasPermission("mcmmo.chat.adminchat"); - } - - /* - * MCMMO.SKILLS.* - */ - - public boolean taming(Player player) { - return player.hasPermission("mcmmo.skills.taming"); - } - - public boolean mining(Player player) { - return player.hasPermission("mcmmo.skills.mining"); - } - - public boolean blastMining(Player player) { - return player.hasPermission("mcmmo.skills.blastmining"); - } - - public boolean fishing(Player player) { - return player.hasPermission("mcmmo.skills.fishing"); - } - - public boolean woodcutting(Player player) { - return player.hasPermission("mcmmo.skills.woodcutting"); - } - - public boolean repair(Player player) { - return player.hasPermission("mcmmo.skills.repair"); - } - - public boolean unarmed(Player player) { - return player.hasPermission("mcmmo.skills.unarmed"); - } - - public boolean archery(Player player) { - return player.hasPermission("mcmmo.skills.archery"); - } - - public boolean herbalism(Player player) { - return player.hasPermission("mcmmo.skills.herbalism"); - } - - public boolean excavation(Player player) { - return player.hasPermission("mcmmo.skills.excavation"); - } - - public boolean swords(Player player) { - return player.hasPermission("mcmmo.skills.swords"); - } - - public boolean axes(Player player) { - return player.hasPermission("mcmmo.skills.axes"); - } - - public boolean acrobatics(Player player) { - return player.hasPermission("mcmmo.skills.acrobatics"); - } -} +package com.gmail.nossr50; + +import org.bukkit.entity.Player; + +public class mcPermissions { + private static volatile mcPermissions instance; + + public boolean permission(Player player, String perm) { + return player.hasPermission(perm); + } + + public static mcPermissions getInstance() { + if (instance == null) { + instance = new mcPermissions(); + } + + return instance; + } + + /* + * GENERIC PERMISSIONS + */ + + public boolean motd(Player player) { + return player.hasPermission("mcmmo.motd"); + } + + public boolean admin(Player player) { + return player.hasPermission("mcmmo.admin"); + } + + public boolean arcaneBypass(Player player) { + return player.hasPermission("mcmmo.bypass.arcanebypass"); + } + + /* + * MCMMO.TOOLS.* + */ + + public boolean mcrefresh(Player player) { + return player.hasPermission("mcmmo.tools.mcrefresh"); + } + + public boolean mcremove(Player player) { + return player.hasPermission("mcmmo.tools.mcremove"); + } + + public boolean mmoedit(Player player) { + return player.hasPermission("mcmmo.tools.mmoedit"); + } + + public boolean mcgod(Player player) { + return player.hasPermission("mcmmo.tools.mcgod"); + } + + /* + * MCMMO.ABILITY.TAMING.* + */ + + public boolean fastFoodService(Player player) { + return player.hasPermission("mcmmo.ability.taming.fastfoodservice"); + } + + public boolean sharpenedclaws(Player player) { + return player.hasPermission("mcmmo.ability.taming.sharpenedclaws"); + } + + public boolean gore(Player player) { + return player.hasPermission("mcmmo.ability.taming.gore"); + } + + public boolean callOfTheWild(Player player) { + return player.hasPermission("mcmmo.ability.taming.callofthewild"); + } + + public boolean environmentallyAware(Player player) { + return player.hasPermission("mcmmo.ability.taming.environmentallyaware"); + } + + public boolean thickFur(Player player) { + return player.hasPermission("mcmmo.ability.taming.thickfur"); + } + + public boolean shockProof(Player player) { + return player.hasPermission("mcmmo.ability.taming.shockproof"); + } + + public boolean beastLore(Player player) { + return player.hasPermission("mcmmo.ability.taming.beastlore"); + } + + /* + * MCMMO.ABILITY.FISHING.* + */ + + public boolean shakeMob(Player player) { + return player.hasPermission("mcmmo.ability.fishing.shakemob"); + } + + /* + * MCMMO.ABILITY.MINING.* + */ + + public boolean superBreaker(Player player) { + return player.hasPermission("mcmmo.ability.mining.superbreaker"); + } + + public boolean miningDoubleDrops(Player player) { + return player.hasPermission("mcmmo.ability.mining.doubledrops"); + } + + /* + * MCMMO.ABILITY.WOODCUTTING.* + */ + + public boolean treeFeller(Player player) { + return player.hasPermission("mcmmo.ability.woodcutting.treefeller"); + } + + public boolean leafBlower(Player player) { + return player.hasPermission("mcmmo.ability.woodcutting.leafblower"); + } + + public boolean woodcuttingDoubleDrops(Player player) { + return player.hasPermission("mcmmo.ability.woodcutting.doubledrops"); + } + + /* + * MCMMO.ABILITY.REPAIR.* + */ + + public boolean repairBonus(Player player) { + return player.hasPermission("mcmmo.ability.repair.repairbonus"); + } + + public boolean arcaneForging(Player player) { + return player.hasPermission("mcmmo.ability.repair.arcaneforging"); + } + + public boolean woodRepair(Player player) { + return player.hasPermission("mcmmo.ability.repair.woodrepair"); + } + + public boolean stoneRepair(Player player) { + return player.hasPermission("mcmmo.ability.repair.stonerepair"); + } + + public boolean leatherRepair(Player player) { + return player.hasPermission("mcmmo.ability.repair.leatherrepair"); + } + + public boolean ironRepair(Player player) { + return player.hasPermission("mcmmo.ability.repair.ironrepair"); + } + + public boolean goldRepair(Player player) { + return player.hasPermission("mcmmo.ability.repair.goldrepair"); + } + + public boolean diamondRepair(Player player) { + return player.hasPermission("mcmmo.ability.repair.diamondrepair"); + } + + public boolean armorRepair(Player player) { + return player.hasPermission("mcmmo.ability.repair.armorrepair"); + } + + public boolean toolRepair(Player player) { + return player.hasPermission("mcmmo.ability.repair.toolrepair"); + } + + public boolean stringRepair(Player player) { + return player.hasPermission("mcmmo.ability.repair.stringrepair"); + } + + /* + * MCMMO.ABILITY.UNARMED.* + */ + + public boolean unarmedBonus(Player player) { + return player.hasPermission("mcmmo.ability.unarmed.bonusdamage"); + } + + public boolean disarm(Player player) { + return player.hasPermission("mcmmo.ability.unarmed.disarm"); + } + + public boolean berserk(Player player) { + return player.hasPermission("mcmmo.ability.unarmed.berserk"); + } + + public boolean deflect(Player player) { + return player.hasPermission("mcmmo.ability.unarmed.deflect"); + } + + /* + * MCMMO.ABILITY.ARCHERY.* + */ + + public boolean trackArrows(Player player) { + return player.hasPermission("mcmmo.ability.archery.trackarrows"); + } + + public boolean ignition(Player player) { + return player.hasPermission("mcmmo.ability.archery.ignition"); + } + + public boolean daze(Player player) { + return player.hasPermission("mcmmo.ability.archery.daze"); + } + + /* + * MCMMO.ABILITY.HERBALISM.* + */ + + public boolean herbalismDoubleDrops(Player player) { + return player.hasPermission("mcmmo.ability.herbalism.doubledrops"); + } + + public boolean greenTerra(Player player) { + return player.hasPermission("mcmmo.ability.herbalism.greenterra"); + } + + public boolean greenThumbBlocks(Player player) { + return player.hasPermission("mcmmo.ability.herbalism.greenthumbblocks"); + } + + public boolean greenThumbWheat(Player player) { + return player.hasPermission("mcmmo.ability.herbalism.greenthumbwheat"); + } + + /* + * MCMMO.ABILITY.EXCAVATION.* + */ + + public boolean gigaDrillBreaker(Player player) { + return player.hasPermission("mcmmo.ability.excavation.gigadrillbreaker"); + } + + public boolean excavationTreasures(Player player) { + return player.hasPermission("mcmmo.ability.excavation.treasures"); + } + + /* + * MCMMO.ABILITY.SWORDS.* + */ + + public boolean swordsBleed(Player player) { + return player.hasPermission("mcmmo.ability.swords.bleed"); + } + + public boolean serratedStrikes(Player player) { + return player.hasPermission("mcmmo.ability.swords.serratedstrikes"); + } + + public boolean counterAttack(Player player) { + return player.hasPermission("mcmmo.ability.swords.counterattack"); + } + + /* + * MCMMO.ABILITY.AXES.* + */ + + public boolean skullSplitter(Player player) { + return player.hasPermission("mcmmo.ability.axes.skullsplitter"); + } + + public boolean axeBonus(Player player) { + return player.hasPermission("mcmmo.ability.axes.bonusdamage"); + } + + public boolean criticalHit(Player player) { + return player.hasPermission("mcmmo.ability.axes.criticalhit"); + } + + public boolean impact(Player player) { + return player.hasPermission("mcmmo.ability.axes.impact"); + } + + /* + * MCMMO.ABILITY.ACROBATICS.* + */ + + public boolean roll(Player player) { + return player.hasPermission("mcmmo.ability.acrobatics.roll"); + } + + public boolean gracefulRoll(Player player) { + return player.hasPermission("mcmmo.ability.acrobatics.gracefulroll"); + } + + public boolean dodge(Player player) { + return player.hasPermission("mcmmo.ability.acrobatics.dodge"); + } + + /* + * MCMMO.ABILITY.BLASTMINING.* + */ + + public boolean biggerBombs(Player player) { + return player.hasPermission("mcmmo.ability.blastmining.biggerbombs"); + } + + public boolean demolitionsExpertise(Player player) { + return player.hasPermission("mcmmo.ability.blastmining.demolitionsexpertise"); + } + + /* + * MCMMO.ITEM.* + */ + + public boolean chimaeraWing(Player player) { + return player.hasPermission("mcmmo.item.chimaerawing"); + } + + /* + * MCMMO.COMMANDS.* + */ + + public boolean mcAbility(Player player) { + return player.hasPermission("mcmmo.commands.ability"); + } + + public boolean partyTeleport(Player player) { + return player.hasPermission("mcmmo.commands.ptp"); + } + + public boolean inspect(Player player) { + return player.hasPermission("mcmmo.commands.inspect"); + } + + public boolean party(Player player) { + return player.hasPermission("mcmmo.commands.party"); + } + + /* + * MCMMO.CHAT.* + */ + + public boolean partyChat(Player player) { + return player.hasPermission("mcmmo.chat.partychat"); + } + + public boolean partyLock(Player player) { + return player.hasPermission("mcmmo.chat.partylock"); + } + + public boolean adminChat(Player player) { + return player.hasPermission("mcmmo.chat.adminchat"); + } + + /* + * MCMMO.SKILLS.* + */ + + public boolean taming(Player player) { + return player.hasPermission("mcmmo.skills.taming"); + } + + public boolean mining(Player player) { + return player.hasPermission("mcmmo.skills.mining"); + } + + public boolean blastMining(Player player) { + return player.hasPermission("mcmmo.skills.blastmining"); + } + + public boolean fishing(Player player) { + return player.hasPermission("mcmmo.skills.fishing"); + } + + public boolean woodcutting(Player player) { + return player.hasPermission("mcmmo.skills.woodcutting"); + } + + public boolean repair(Player player) { + return player.hasPermission("mcmmo.skills.repair"); + } + + public boolean unarmed(Player player) { + return player.hasPermission("mcmmo.skills.unarmed"); + } + + public boolean archery(Player player) { + return player.hasPermission("mcmmo.skills.archery"); + } + + public boolean herbalism(Player player) { + return player.hasPermission("mcmmo.skills.herbalism"); + } + + public boolean excavation(Player player) { + return player.hasPermission("mcmmo.skills.excavation"); + } + + public boolean swords(Player player) { + return player.hasPermission("mcmmo.skills.swords"); + } + + public boolean axes(Player player) { + return player.hasPermission("mcmmo.skills.axes"); + } + + public boolean acrobatics(Player player) { + return player.hasPermission("mcmmo.skills.acrobatics"); + } +} \ No newline at end of file diff --git a/src/main/java/com/gmail/nossr50/skills/Repair.java b/src/main/java/com/gmail/nossr50/skills/Repair.java index 8a37dd84f..6a9b6bcdf 100644 --- a/src/main/java/com/gmail/nossr50/skills/Repair.java +++ b/src/main/java/com/gmail/nossr50/skills/Repair.java @@ -93,7 +93,7 @@ public class Repair { repairItem(player, is, new ItemStack(LoadProperties.rGold)); 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)); xpHandler(player, PP, is, durabilityBefore, 2, false); } @@ -141,7 +141,7 @@ public class Repair { PP.addXP(SkillType.REPAIR, dif * 10); Skills.XpCheckSkill(SkillType.REPAIR, player); - //CLANG CLANG + //CLANG CLANG (scary noise) if (LoadProperties.spoutEnabled) { SpoutSounds.playRepairNoise(player); } @@ -321,7 +321,7 @@ public class Repair { else if (ItemChecks.isHoe(is) || ItemChecks.isSword(is) || is.getType().equals(Material.SHEARS)) { 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; } else if (ItemChecks.isBoots(is)) { @@ -391,7 +391,7 @@ public class Repair { else if (ItemChecks.isLeatherArmor(is)) { 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)); } } diff --git a/src/main/resources/plugin.yml b/src/main/resources/plugin.yml index 6fecf2faa..9be0e90e8 100644 --- a/src/main/resources/plugin.yml +++ b/src/main/resources/plugin.yml @@ -239,8 +239,8 @@ permissions: description: Allows ability to repair armor mcmmo.ability.repair.toolrepair: description: Allows ability to repair tools - mcmmo.ability.repair.bowrepair: - description: Allows ability to repair bows + mcmmo.ability.repair.stringrepair: + description: Allows ability to repair bows and fishing rods mcmmo.ability.unarmed.*: description: Allows access to all Unarmed abilities children: