diff --git a/src/main/java/com/gmail/nossr50/config/LoadProperties.java b/src/main/java/com/gmail/nossr50/config/LoadProperties.java index 354d9a42f..4b584d2a1 100644 --- a/src/main/java/com/gmail/nossr50/config/LoadProperties.java +++ b/src/main/java/com/gmail/nossr50/config/LoadProperties.java @@ -77,7 +77,7 @@ public class LoadProperties { levelCapAcrobatics, levelCapArchery, levelCapAxes, levelCapExcavation, levelCapFishing, levelCapHerbalism, levelCapMining, levelCapRepair, levelCapSwords, levelCapTaming, levelCapUnarmed, levelCapWoodcutting, - anvilID, saveInterval, fishingTier1, fishingTier2, fishingTier3, fishingTier4; + anvilID, saveInterval, fishingTier1, fishingTier2, fishingTier3, fishingTier4, fishingTier5; public static double xpbackground_r, xpbackground_g, xpbackground_b, xpborder_r, xpborder_g, xpborder_b, fishing_r, fishing_g, @@ -104,6 +104,7 @@ public class LoadProperties { public static List fishingRewardsTier2 = new ArrayList(); public static List fishingRewardsTier3 = new ArrayList(); public static List fishingRewardsTier4 = new ArrayList(); + public static List fishingRewardsTier5 = new ArrayList(); public static HUDType defaulthud; protected static File configFile; @@ -380,10 +381,11 @@ public class LoadProperties { keepEnchantsRank4 = readInteger("Arcane_Forging.Keep_Enchants.Chance.Rank_4", 40); fishingDrops = readBoolean("Fishing.Drops.Item_Drops_Enabled", true); - fishingTier1 = readInteger("Fishing.Drop_Level.Tier1", 200); - fishingTier2 = readInteger("Fishing.Drop_Level.Tier1", 400); - fishingTier3 = readInteger("Fishing.Drop_Level.Tier1", 600); - fishingTier4 = readInteger("Fishing.Drop_Level.Tier1", 800); + fishingTier1 = readInteger("Fishing.Drop_Level.Tier1", 0); + fishingTier2 = readInteger("Fishing.Drop_Level.Tier2", 200); + fishingTier3 = readInteger("Fishing.Drop_Level.Tier3", 400); + fishingTier4 = readInteger("Fishing.Drop_Level.Tier4", 600); + fishingTier5 = readInteger("Fishing.Drop_Level.Tier4", 800); fishingDropChanceTier1 = readInteger("Fishing.Drops.Drop_Chance.Tier_1", 20); fishingDropChanceTier2 = readInteger("Fishing.Drops.Drop_Chance.Tier_2", 25); fishingDropChanceTier3 = readInteger("Fishing.Drops.Drop_Chance.Tier_3", 30); @@ -531,6 +533,8 @@ public class LoadProperties { fishingRewardsTier3.add(fTreasure); if(dropLevel <= fishingTier4 && maxLevel >= fishingTier4) fishingRewardsTier4.add(fTreasure); + if(dropLevel <= fishingTier5 && maxLevel >= fishingTier5) + fishingRewardsTier5.add(fTreasure); } else if(treasure instanceof ExcavationTreasure) { if(!excavationTreasures.contains(treasureKey)) continue; diff --git a/src/main/java/com/gmail/nossr50/skills/Fishing.java b/src/main/java/com/gmail/nossr50/skills/Fishing.java index 19e4aa512..e02b09422 100644 --- a/src/main/java/com/gmail/nossr50/skills/Fishing.java +++ b/src/main/java/com/gmail/nossr50/skills/Fishing.java @@ -30,6 +30,7 @@ import com.gmail.nossr50.m; import com.gmail.nossr50.config.LoadProperties; import com.gmail.nossr50.datatypes.PlayerProfile; import com.gmail.nossr50.datatypes.SkillType; +import com.gmail.nossr50.datatypes.treasure.FishingTreasure; import com.gmail.nossr50.locale.mcLocale; public class Fishing { @@ -42,16 +43,23 @@ public class Fishing { if(lvl >= LoadProperties.fishingTier1 && lvl < LoadProperties.fishingTier2) { return 1; - } else if (lvl >= LoadProperties.fishingTier2 && lvl < LoadProperties.fishingTier3) + } + else if (lvl >= LoadProperties.fishingTier2 && lvl < LoadProperties.fishingTier3) { return 2; - } else if (lvl >= LoadProperties.fishingTier3 && lvl < LoadProperties.fishingTier4) + } + else if (lvl >= LoadProperties.fishingTier3 && lvl < LoadProperties.fishingTier4) { return 3; - } else + } + else if (lvl >= LoadProperties.fishingTier4 && lvl < LoadProperties.fishingTier5) { return 4; } + else + { + return 5; + } } public static void getFishingResults(Player player, PlayerFishEvent event) @@ -70,6 +78,9 @@ public class Fishing { case 4: getFishingResultsTier4(player, event); break; + case 5: + getFishingResultsTier5(player, event); + break; } m.mcDropItem(player.getLocation(), new ItemStack(Material.RAW_FISH, 1)); Users.getProfile(player).addXP(SkillType.FISHING, LoadProperties.mfishing, player); @@ -78,962 +89,1075 @@ public class Fishing { private static void getFishingResultsTier1(Player player, PlayerFishEvent event) { - int randomNum = (int)(Math.random() * 15); + int skillLevel = Users.getProfile(player).getSkillLevel(SkillType.FISHING); Item theCatch = (Item)event.getCaught(); if(Math.random() * 100 < LoadProperties.fishingDropChanceTier1) { - switch(randomNum) + for(FishingTreasure treasure : LoadProperties.fishingRewardsTier1) { - case 1: - if(LoadProperties.leatherArmor && LoadProperties.fishingDrops) - theCatch.setItemStack(new ItemStack(Material.LEATHER_BOOTS, 1)); - else - theCatch.setItemStack(new ItemStack(Material.RAW_FISH)); - break; - case 2: - if(LoadProperties.leatherArmor && LoadProperties.fishingDrops) - theCatch.setItemStack(new ItemStack(Material.LEATHER_HELMET, 1)); - else - theCatch.setItemStack(new ItemStack(Material.RAW_FISH)); - break; - case 3: - if(LoadProperties.leatherArmor && LoadProperties.fishingDrops) - theCatch.setItemStack(new ItemStack(Material.LEATHER_LEGGINGS, 1)); - else - theCatch.setItemStack(new ItemStack(Material.RAW_FISH)); - break; - case 4: - if(LoadProperties.leatherArmor && LoadProperties.fishingDrops) - theCatch.setItemStack(new ItemStack(Material.LEATHER_CHESTPLATE, 1)); - else - theCatch.setItemStack(new ItemStack(Material.RAW_FISH)); - break; - case 5: - if(LoadProperties.woodenTools && LoadProperties.fishingDrops) - theCatch.setItemStack(new ItemStack(Material.WOOD_AXE, 1)); - else - theCatch.setItemStack(new ItemStack(Material.RAW_FISH)); - break; - case 6: - if(LoadProperties.woodenTools && LoadProperties.fishingDrops) - theCatch.setItemStack(new ItemStack(Material.WOOD_PICKAXE, 1)); - else - theCatch.setItemStack(new ItemStack(Material.RAW_FISH)); - break; - case 7: - if(LoadProperties.woodenTools && LoadProperties.fishingDrops) - theCatch.setItemStack(new ItemStack(Material.WOOD_SWORD, 1)); - else - theCatch.setItemStack(new ItemStack(Material.RAW_FISH)); - break; - case 8: - if(LoadProperties.woodenTools && LoadProperties.fishingDrops) - theCatch.setItemStack(new ItemStack(Material.WOOD_HOE, 1)); - else - theCatch.setItemStack(new ItemStack(Material.RAW_FISH)); - break; - case 9: - if(LoadProperties.woodenTools && LoadProperties.fishingDrops) - theCatch.setItemStack(new ItemStack(Material.WOOD_SPADE, 1)); - else - theCatch.setItemStack(new ItemStack(Material.RAW_FISH)); - break; - case 10: - if(LoadProperties.stoneTools && LoadProperties.fishingDrops) - theCatch.setItemStack(new ItemStack(Material.STONE_AXE, 1)); - else - theCatch.setItemStack(new ItemStack(Material.RAW_FISH)); - break; - case 11: - if(LoadProperties.stoneTools && LoadProperties.fishingDrops) - theCatch.setItemStack(new ItemStack(Material.STONE_PICKAXE, 1)); - else - theCatch.setItemStack(new ItemStack(Material.RAW_FISH)); - break; - case 12: - if(LoadProperties.stoneTools && LoadProperties.fishingDrops) - theCatch.setItemStack(new ItemStack(Material.STONE_SWORD, 1)); - else - theCatch.setItemStack(new ItemStack(Material.RAW_FISH)); - break; - case 13: - if(LoadProperties.stoneTools && LoadProperties.fishingDrops) - theCatch.setItemStack(new ItemStack(Material.STONE_HOE, 1)); - else - theCatch.setItemStack(new ItemStack(Material.RAW_FISH)); - break; - case 14: - if(LoadProperties.stoneTools && LoadProperties.fishingDrops) - theCatch.setItemStack(new ItemStack(Material.STONE_SPADE, 1)); - else - theCatch.setItemStack(new ItemStack(Material.RAW_FISH)); - break; + if(Math.random() * 100 > (100.00 - treasure.getDropChance())) + { + if(skillLevel >= treasure.getDropLevel() && skillLevel <= treasure.getMaxLevel()) + { + Users.getProfile(player).addXP(SkillType.FISHING, treasure.getXp(), player); + theCatch.setItemStack(treasure.getDrop()); + } + } } - } else + } + else { theCatch.setItemStack(new ItemStack(Material.RAW_FISH)); } //Change durability to random value theCatch.getItemStack().setDurability((short) (Math.random() * theCatch.getItemStack().getType().getMaxDurability())); //Change the damage value - + +// Item theCatch = (Item)event.getCaught(); +// if(Math.random() * 100 < LoadProperties.fishingDropChanceTier1) +// { +// switch(randomNum) +// { +// case 1: +// if(LoadProperties.leatherArmor && LoadProperties.fishingDrops) +// theCatch.setItemStack(new ItemStack(Material.LEATHER_BOOTS, 1)); +// else +// theCatch.setItemStack(new ItemStack(Material.RAW_FISH)); +// break; +// case 2: +// if(LoadProperties.leatherArmor && LoadProperties.fishingDrops) +// theCatch.setItemStack(new ItemStack(Material.LEATHER_HELMET, 1)); +// else +// theCatch.setItemStack(new ItemStack(Material.RAW_FISH)); +// break; +// case 3: +// if(LoadProperties.leatherArmor && LoadProperties.fishingDrops) +// theCatch.setItemStack(new ItemStack(Material.LEATHER_LEGGINGS, 1)); +// else +// theCatch.setItemStack(new ItemStack(Material.RAW_FISH)); +// break; +// case 4: +// if(LoadProperties.leatherArmor && LoadProperties.fishingDrops) +// theCatch.setItemStack(new ItemStack(Material.LEATHER_CHESTPLATE, 1)); +// else +// theCatch.setItemStack(new ItemStack(Material.RAW_FISH)); +// break; +// case 5: +// if(LoadProperties.woodenTools && LoadProperties.fishingDrops) +// theCatch.setItemStack(new ItemStack(Material.WOOD_AXE, 1)); +// else +// theCatch.setItemStack(new ItemStack(Material.RAW_FISH)); +// break; +// case 6: +// if(LoadProperties.woodenTools && LoadProperties.fishingDrops) +// theCatch.setItemStack(new ItemStack(Material.WOOD_PICKAXE, 1)); +// else +// theCatch.setItemStack(new ItemStack(Material.RAW_FISH)); +// break; +// case 7: +// if(LoadProperties.woodenTools && LoadProperties.fishingDrops) +// theCatch.setItemStack(new ItemStack(Material.WOOD_SWORD, 1)); +// else +// theCatch.setItemStack(new ItemStack(Material.RAW_FISH)); +// break; +// case 8: +// if(LoadProperties.woodenTools && LoadProperties.fishingDrops) +// theCatch.setItemStack(new ItemStack(Material.WOOD_HOE, 1)); +// else +// theCatch.setItemStack(new ItemStack(Material.RAW_FISH)); +// break; +// case 9: +// if(LoadProperties.woodenTools && LoadProperties.fishingDrops) +// theCatch.setItemStack(new ItemStack(Material.WOOD_SPADE, 1)); +// else +// theCatch.setItemStack(new ItemStack(Material.RAW_FISH)); +// break; +// case 10: +// if(LoadProperties.stoneTools && LoadProperties.fishingDrops) +// theCatch.setItemStack(new ItemStack(Material.STONE_AXE, 1)); +// else +// theCatch.setItemStack(new ItemStack(Material.RAW_FISH)); +// break; +// case 11: +// if(LoadProperties.stoneTools && LoadProperties.fishingDrops) +// theCatch.setItemStack(new ItemStack(Material.STONE_PICKAXE, 1)); +// else +// theCatch.setItemStack(new ItemStack(Material.RAW_FISH)); +// break; +// case 12: +// if(LoadProperties.stoneTools && LoadProperties.fishingDrops) +// theCatch.setItemStack(new ItemStack(Material.STONE_SWORD, 1)); +// else +// theCatch.setItemStack(new ItemStack(Material.RAW_FISH)); +// break; +// case 13: +// if(LoadProperties.stoneTools && LoadProperties.fishingDrops) +// theCatch.setItemStack(new ItemStack(Material.STONE_HOE, 1)); +// else +// theCatch.setItemStack(new ItemStack(Material.RAW_FISH)); +// break; +// case 14: +// if(LoadProperties.stoneTools && LoadProperties.fishingDrops) +// theCatch.setItemStack(new ItemStack(Material.STONE_SPADE, 1)); +// else +// theCatch.setItemStack(new ItemStack(Material.RAW_FISH)); +// break; +// } +// } else +// { +// theCatch.setItemStack(new ItemStack(Material.RAW_FISH)); +// } +// //Change durability to random value +// theCatch.getItemStack().setDurability((short) (Math.random() * theCatch.getItemStack().getType().getMaxDurability())); //Change the damage value } private static void getFishingResultsTier2(Player player, PlayerFishEvent event) { - int randomNum = (int)(Math.random() * 20); + int skillLevel = Users.getProfile(player).getSkillLevel(SkillType.FISHING); Item theCatch = (Item)event.getCaught(); - if(Math.random() * 100 < LoadProperties.fishingDropChanceTier2) { - switch(randomNum) + for(FishingTreasure treasure : LoadProperties.fishingRewardsTier2) { - case 1: - if(LoadProperties.leatherArmor && LoadProperties.fishingDrops) - theCatch.setItemStack(new ItemStack(Material.LEATHER_BOOTS, 1)); - else - theCatch.setItemStack(new ItemStack(Material.RAW_FISH)); - break; - case 2: - if(LoadProperties.leatherArmor && LoadProperties.fishingDrops) - theCatch.setItemStack(new ItemStack(Material.LEATHER_HELMET, 1)); - else - theCatch.setItemStack(new ItemStack(Material.RAW_FISH)); - break; - case 3: - if(LoadProperties.leatherArmor && LoadProperties.fishingDrops) - theCatch.setItemStack(new ItemStack(Material.LEATHER_LEGGINGS, 1)); - else - theCatch.setItemStack(new ItemStack(Material.RAW_FISH)); - break; - case 4: - if(LoadProperties.leatherArmor && LoadProperties.fishingDrops) - theCatch.setItemStack(new ItemStack(Material.LEATHER_CHESTPLATE, 1)); - else - theCatch.setItemStack(new ItemStack(Material.RAW_FISH)); - break; - case 5: - if(LoadProperties.ironTools && LoadProperties.fishingDrops) - theCatch.setItemStack(new ItemStack(Material.IRON_AXE, 1)); - else - theCatch.setItemStack(new ItemStack(Material.RAW_FISH)); - break; - case 6: - if(LoadProperties.ironTools && LoadProperties.fishingDrops) - theCatch.setItemStack(new ItemStack(Material.IRON_PICKAXE, 1)); - else - theCatch.setItemStack(new ItemStack(Material.RAW_FISH)); - break; - case 7: - if(LoadProperties.ironTools && LoadProperties.fishingDrops) - theCatch.setItemStack(new ItemStack(Material.IRON_SWORD, 1)); - else - theCatch.setItemStack(new ItemStack(Material.RAW_FISH)); - break; - case 8: - if(LoadProperties.ironTools && LoadProperties.fishingDrops) - theCatch.setItemStack(new ItemStack(Material.IRON_HOE, 1)); - else - theCatch.setItemStack(new ItemStack(Material.RAW_FISH)); - break; - case 9: - if(LoadProperties.ironTools && LoadProperties.fishingDrops) - theCatch.setItemStack(new ItemStack(Material.IRON_SPADE, 1)); - else - theCatch.setItemStack(new ItemStack(Material.RAW_FISH)); - break; - case 10: - if(LoadProperties.stoneTools && LoadProperties.fishingDrops) - theCatch.setItemStack(new ItemStack(Material.STONE_AXE, 1)); - else - theCatch.setItemStack(new ItemStack(Material.RAW_FISH)); - break; - case 11: - if(LoadProperties.stoneTools && LoadProperties.fishingDrops) - theCatch.setItemStack(new ItemStack(Material.STONE_PICKAXE, 1)); - else - theCatch.setItemStack(new ItemStack(Material.RAW_FISH)); - break; - case 12: - if(LoadProperties.stoneTools && LoadProperties.fishingDrops) - theCatch.setItemStack(new ItemStack(Material.STONE_SWORD, 1)); - else - theCatch.setItemStack(new ItemStack(Material.RAW_FISH)); - break; - case 13: - if(LoadProperties.stoneTools && LoadProperties.fishingDrops) - theCatch.setItemStack(new ItemStack(Material.STONE_HOE, 1)); - else - theCatch.setItemStack(new ItemStack(Material.RAW_FISH)); - break; - case 14: - if(LoadProperties.stoneTools && LoadProperties.fishingDrops) - theCatch.setItemStack(new ItemStack(Material.STONE_SPADE, 1)); - else - theCatch.setItemStack(new ItemStack(Material.RAW_FISH)); - break; - case 15: - if(LoadProperties.ironArmor && LoadProperties.fishingDrops) - theCatch.setItemStack(new ItemStack(Material.IRON_BOOTS, 1)); - else - theCatch.setItemStack(new ItemStack(Material.RAW_FISH)); - break; - case 16: - if(LoadProperties.ironArmor && LoadProperties.fishingDrops) - theCatch.setItemStack(new ItemStack(Material.IRON_LEGGINGS, 1)); - else - theCatch.setItemStack(new ItemStack(Material.RAW_FISH)); - break; - case 17: - if(LoadProperties.ironArmor && LoadProperties.fishingDrops) - theCatch.setItemStack(new ItemStack(Material.IRON_CHESTPLATE, 1)); - else - theCatch.setItemStack(new ItemStack(Material.RAW_FISH)); - break; - case 18: - if(LoadProperties.ironArmor && LoadProperties.fishingDrops) - theCatch.setItemStack(new ItemStack(Material.IRON_HELMET, 1)); - else - theCatch.setItemStack(new ItemStack(Material.RAW_FISH)); - break; - case 19: - if(LoadProperties.enderPearl && LoadProperties.fishingDrops) - theCatch.setItemStack(new ItemStack(Material.ENDER_PEARL, 1)); - else - theCatch.setItemStack(new ItemStack(Material.RAW_FISH)); - break; + if(Math.random() * 100 > (100.00 - treasure.getDropChance())) + { + if(skillLevel >= treasure.getDropLevel() && skillLevel <= treasure.getMaxLevel()) + { + Users.getProfile(player).addXP(SkillType.FISHING, treasure.getXp(), player); + theCatch.setItemStack(treasure.getDrop()); + } + } } - } else + } + else { - theCatch.setItemStack(new ItemStack(Material.RAW_FISH, 1)); + theCatch.setItemStack(new ItemStack(Material.RAW_FISH)); } - //Change durability to random value theCatch.getItemStack().setDurability((short) (Math.random() * theCatch.getItemStack().getType().getMaxDurability())); //Change the damage value + +// int randomNum = (int)(Math.random() * 20); +// Item theCatch = (Item)event.getCaught(); +// +// if(Math.random() * 100 < LoadProperties.fishingDropChanceTier2) +// { +// switch(randomNum) +// { +// case 1: +// if(LoadProperties.leatherArmor && LoadProperties.fishingDrops) +// theCatch.setItemStack(new ItemStack(Material.LEATHER_BOOTS, 1)); +// else +// theCatch.setItemStack(new ItemStack(Material.RAW_FISH)); +// break; +// case 2: +// if(LoadProperties.leatherArmor && LoadProperties.fishingDrops) +// theCatch.setItemStack(new ItemStack(Material.LEATHER_HELMET, 1)); +// else +// theCatch.setItemStack(new ItemStack(Material.RAW_FISH)); +// break; +// case 3: +// if(LoadProperties.leatherArmor && LoadProperties.fishingDrops) +// theCatch.setItemStack(new ItemStack(Material.LEATHER_LEGGINGS, 1)); +// else +// theCatch.setItemStack(new ItemStack(Material.RAW_FISH)); +// break; +// case 4: +// if(LoadProperties.leatherArmor && LoadProperties.fishingDrops) +// theCatch.setItemStack(new ItemStack(Material.LEATHER_CHESTPLATE, 1)); +// else +// theCatch.setItemStack(new ItemStack(Material.RAW_FISH)); +// break; +// case 5: +// if(LoadProperties.ironTools && LoadProperties.fishingDrops) +// theCatch.setItemStack(new ItemStack(Material.IRON_AXE, 1)); +// else +// theCatch.setItemStack(new ItemStack(Material.RAW_FISH)); +// break; +// case 6: +// if(LoadProperties.ironTools && LoadProperties.fishingDrops) +// theCatch.setItemStack(new ItemStack(Material.IRON_PICKAXE, 1)); +// else +// theCatch.setItemStack(new ItemStack(Material.RAW_FISH)); +// break; +// case 7: +// if(LoadProperties.ironTools && LoadProperties.fishingDrops) +// theCatch.setItemStack(new ItemStack(Material.IRON_SWORD, 1)); +// else +// theCatch.setItemStack(new ItemStack(Material.RAW_FISH)); +// break; +// case 8: +// if(LoadProperties.ironTools && LoadProperties.fishingDrops) +// theCatch.setItemStack(new ItemStack(Material.IRON_HOE, 1)); +// else +// theCatch.setItemStack(new ItemStack(Material.RAW_FISH)); +// break; +// case 9: +// if(LoadProperties.ironTools && LoadProperties.fishingDrops) +// theCatch.setItemStack(new ItemStack(Material.IRON_SPADE, 1)); +// else +// theCatch.setItemStack(new ItemStack(Material.RAW_FISH)); +// break; +// case 10: +// if(LoadProperties.stoneTools && LoadProperties.fishingDrops) +// theCatch.setItemStack(new ItemStack(Material.STONE_AXE, 1)); +// else +// theCatch.setItemStack(new ItemStack(Material.RAW_FISH)); +// break; +// case 11: +// if(LoadProperties.stoneTools && LoadProperties.fishingDrops) +// theCatch.setItemStack(new ItemStack(Material.STONE_PICKAXE, 1)); +// else +// theCatch.setItemStack(new ItemStack(Material.RAW_FISH)); +// break; +// case 12: +// if(LoadProperties.stoneTools && LoadProperties.fishingDrops) +// theCatch.setItemStack(new ItemStack(Material.STONE_SWORD, 1)); +// else +// theCatch.setItemStack(new ItemStack(Material.RAW_FISH)); +// break; +// case 13: +// if(LoadProperties.stoneTools && LoadProperties.fishingDrops) +// theCatch.setItemStack(new ItemStack(Material.STONE_HOE, 1)); +// else +// theCatch.setItemStack(new ItemStack(Material.RAW_FISH)); +// break; +// case 14: +// if(LoadProperties.stoneTools && LoadProperties.fishingDrops) +// theCatch.setItemStack(new ItemStack(Material.STONE_SPADE, 1)); +// else +// theCatch.setItemStack(new ItemStack(Material.RAW_FISH)); +// break; +// case 15: +// if(LoadProperties.ironArmor && LoadProperties.fishingDrops) +// theCatch.setItemStack(new ItemStack(Material.IRON_BOOTS, 1)); +// else +// theCatch.setItemStack(new ItemStack(Material.RAW_FISH)); +// break; +// case 16: +// if(LoadProperties.ironArmor && LoadProperties.fishingDrops) +// theCatch.setItemStack(new ItemStack(Material.IRON_LEGGINGS, 1)); +// else +// theCatch.setItemStack(new ItemStack(Material.RAW_FISH)); +// break; +// case 17: +// if(LoadProperties.ironArmor && LoadProperties.fishingDrops) +// theCatch.setItemStack(new ItemStack(Material.IRON_CHESTPLATE, 1)); +// else +// theCatch.setItemStack(new ItemStack(Material.RAW_FISH)); +// break; +// case 18: +// if(LoadProperties.ironArmor && LoadProperties.fishingDrops) +// theCatch.setItemStack(new ItemStack(Material.IRON_HELMET, 1)); +// else +// theCatch.setItemStack(new ItemStack(Material.RAW_FISH)); +// break; +// case 19: +// if(LoadProperties.enderPearl && LoadProperties.fishingDrops) +// theCatch.setItemStack(new ItemStack(Material.ENDER_PEARL, 1)); +// else +// theCatch.setItemStack(new ItemStack(Material.RAW_FISH)); +// break; +// } +// } else +// { +// theCatch.setItemStack(new ItemStack(Material.RAW_FISH, 1)); +// } +// +// //Change durability to random value +// theCatch.getItemStack().setDurability((short) (Math.random() * theCatch.getItemStack().getType().getMaxDurability())); //Change the damage value } private static void getFishingResultsTier3(Player player, PlayerFishEvent event) { - int randomNum = (int)(Math.random() * 24); + int skillLevel = Users.getProfile(player).getSkillLevel(SkillType.FISHING); Item theCatch = (Item)event.getCaught(); - if(Math.random() * 100 < LoadProperties.fishingDropChanceTier3) { - switch(randomNum) + for(FishingTreasure treasure : LoadProperties.fishingRewardsTier3) { - case 1: - if(LoadProperties.goldArmor && LoadProperties.fishingDrops) - theCatch.setItemStack(new ItemStack(Material.GOLD_BOOTS, 1)); - else - theCatch.setItemStack(new ItemStack(Material.RAW_FISH)); - break; - case 2: - if(LoadProperties.goldArmor && LoadProperties.fishingDrops) - theCatch.setItemStack(new ItemStack(Material.GOLD_HELMET, 1)); - else - theCatch.setItemStack(new ItemStack(Material.RAW_FISH)); - break; - case 3: - if(LoadProperties.goldArmor && LoadProperties.fishingDrops) - theCatch.setItemStack(new ItemStack(Material.GOLD_LEGGINGS, 1)); - else - theCatch.setItemStack(new ItemStack(Material.RAW_FISH)); - break; - case 4: - if(LoadProperties.goldArmor && LoadProperties.fishingDrops) - theCatch.setItemStack(new ItemStack(Material.GOLD_CHESTPLATE, 1)); - else - theCatch.setItemStack(new ItemStack(Material.RAW_FISH)); - break; - case 5: - if(LoadProperties.ironTools && LoadProperties.fishingDrops) - theCatch.setItemStack(new ItemStack(Material.IRON_AXE, 1)); - else - theCatch.setItemStack(new ItemStack(Material.RAW_FISH)); - break; - case 6: - if(LoadProperties.ironTools && LoadProperties.fishingDrops) - theCatch.setItemStack(new ItemStack(Material.IRON_PICKAXE, 1)); - else - theCatch.setItemStack(new ItemStack(Material.RAW_FISH)); - break; - case 7: - if(LoadProperties.ironTools && LoadProperties.fishingDrops) - theCatch.setItemStack(new ItemStack(Material.IRON_SWORD, 1)); - else - theCatch.setItemStack(new ItemStack(Material.RAW_FISH)); - break; - case 8: - if(LoadProperties.ironTools && LoadProperties.fishingDrops) - theCatch.setItemStack(new ItemStack(Material.IRON_HOE, 1)); - else - theCatch.setItemStack(new ItemStack(Material.RAW_FISH)); - break; - case 9: - if(LoadProperties.ironTools && LoadProperties.fishingDrops) - theCatch.setItemStack(new ItemStack(Material.IRON_SPADE, 1)); - else - theCatch.setItemStack(new ItemStack(Material.RAW_FISH)); - break; - case 10: - if(LoadProperties.goldTools && LoadProperties.fishingDrops) - theCatch.setItemStack(new ItemStack(Material.GOLD_AXE, 1)); - else - theCatch.setItemStack(new ItemStack(Material.RAW_FISH)); - break; - case 11: - if(LoadProperties.goldTools && LoadProperties.fishingDrops) - theCatch.setItemStack(new ItemStack(Material.GOLD_PICKAXE, 1)); - else - theCatch.setItemStack(new ItemStack(Material.RAW_FISH)); - break; - case 12: - if(LoadProperties.goldTools && LoadProperties.fishingDrops) - theCatch.setItemStack(new ItemStack(Material.GOLD_SWORD, 1)); - else - theCatch.setItemStack(new ItemStack(Material.RAW_FISH)); - break; - case 13: - if(LoadProperties.goldTools && LoadProperties.fishingDrops) - theCatch.setItemStack(new ItemStack(Material.GOLD_HOE, 1)); - else - theCatch.setItemStack(new ItemStack(Material.RAW_FISH)); - break; - case 14: - if(LoadProperties.goldTools && LoadProperties.fishingDrops) - theCatch.setItemStack(new ItemStack(Material.GOLD_SPADE, 1)); - else - theCatch.setItemStack(new ItemStack(Material.RAW_FISH)); - break; - case 15: - if(LoadProperties.ironArmor && LoadProperties.fishingDrops) - theCatch.setItemStack(new ItemStack(Material.IRON_BOOTS, 1)); - else - theCatch.setItemStack(new ItemStack(Material.RAW_FISH)); - break; - case 16: - if(LoadProperties.ironArmor && LoadProperties.fishingDrops) - theCatch.setItemStack(new ItemStack(Material.IRON_LEGGINGS, 1)); - else - theCatch.setItemStack(new ItemStack(Material.RAW_FISH)); - break; - case 17: - if(LoadProperties.ironArmor && LoadProperties.fishingDrops) - theCatch.setItemStack(new ItemStack(Material.IRON_CHESTPLATE, 1)); - else - theCatch.setItemStack(new ItemStack(Material.RAW_FISH)); - break; - case 18: - if(LoadProperties.ironArmor && LoadProperties.fishingDrops) - theCatch.setItemStack(new ItemStack(Material.IRON_HELMET, 1)); - else - theCatch.setItemStack(new ItemStack(Material.RAW_FISH)); - break; - case 19: - if(LoadProperties.enderPearl && LoadProperties.fishingDrops) - theCatch.setItemStack(new ItemStack(Material.ENDER_PEARL, 1)); - else - theCatch.setItemStack(new ItemStack(Material.RAW_FISH)); - break; - case 20: - if(LoadProperties.blazeRod && LoadProperties.fishingDrops) - theCatch.setItemStack(new ItemStack(Material.BLAZE_ROD, 1)); - else - theCatch.setItemStack(new ItemStack(Material.RAW_FISH)); - break; - case 21: - if(LoadProperties.records && LoadProperties.fishingDrops) - theCatch.setItemStack(new ItemStack(Material.RECORD_3, 1)); - else - theCatch.setItemStack(new ItemStack(Material.RAW_FISH)); - break; - case 22: - if(LoadProperties.records && LoadProperties.fishingDrops) - theCatch.setItemStack(new ItemStack(Material.RECORD_4, 1)); - else - theCatch.setItemStack(new ItemStack(Material.RAW_FISH)); - break; - case 23: - if(LoadProperties.records && LoadProperties.fishingDrops) - theCatch.setItemStack(new ItemStack(Material.RECORD_5, 1)); - else - theCatch.setItemStack(new ItemStack(Material.RAW_FISH)); - break; + if(Math.random() * 100 > (100.00 - treasure.getDropChance())) + { + if(skillLevel >= treasure.getDropLevel() && skillLevel <= treasure.getMaxLevel()) + { + Users.getProfile(player).addXP(SkillType.FISHING, treasure.getXp(), player); + theCatch.setItemStack(treasure.getDrop()); + } + } } - } + } else { - theCatch.setItemStack(new ItemStack(Material.RAW_FISH, 1)); + theCatch.setItemStack(new ItemStack(Material.RAW_FISH)); } //Change durability to random value theCatch.getItemStack().setDurability((short) (Math.random() * theCatch.getItemStack().getType().getMaxDurability())); //Change the damage value + +// int randomNum = (int)(Math.random() * 24); +// Item theCatch = (Item)event.getCaught(); +// +// if(Math.random() * 100 < LoadProperties.fishingDropChanceTier3) +// { +// switch(randomNum) +// { +// case 1: +// if(LoadProperties.goldArmor && LoadProperties.fishingDrops) +// theCatch.setItemStack(new ItemStack(Material.GOLD_BOOTS, 1)); +// else +// theCatch.setItemStack(new ItemStack(Material.RAW_FISH)); +// break; +// case 2: +// if(LoadProperties.goldArmor && LoadProperties.fishingDrops) +// theCatch.setItemStack(new ItemStack(Material.GOLD_HELMET, 1)); +// else +// theCatch.setItemStack(new ItemStack(Material.RAW_FISH)); +// break; +// case 3: +// if(LoadProperties.goldArmor && LoadProperties.fishingDrops) +// theCatch.setItemStack(new ItemStack(Material.GOLD_LEGGINGS, 1)); +// else +// theCatch.setItemStack(new ItemStack(Material.RAW_FISH)); +// break; +// case 4: +// if(LoadProperties.goldArmor && LoadProperties.fishingDrops) +// theCatch.setItemStack(new ItemStack(Material.GOLD_CHESTPLATE, 1)); +// else +// theCatch.setItemStack(new ItemStack(Material.RAW_FISH)); +// break; +// case 5: +// if(LoadProperties.ironTools && LoadProperties.fishingDrops) +// theCatch.setItemStack(new ItemStack(Material.IRON_AXE, 1)); +// else +// theCatch.setItemStack(new ItemStack(Material.RAW_FISH)); +// break; +// case 6: +// if(LoadProperties.ironTools && LoadProperties.fishingDrops) +// theCatch.setItemStack(new ItemStack(Material.IRON_PICKAXE, 1)); +// else +// theCatch.setItemStack(new ItemStack(Material.RAW_FISH)); +// break; +// case 7: +// if(LoadProperties.ironTools && LoadProperties.fishingDrops) +// theCatch.setItemStack(new ItemStack(Material.IRON_SWORD, 1)); +// else +// theCatch.setItemStack(new ItemStack(Material.RAW_FISH)); +// break; +// case 8: +// if(LoadProperties.ironTools && LoadProperties.fishingDrops) +// theCatch.setItemStack(new ItemStack(Material.IRON_HOE, 1)); +// else +// theCatch.setItemStack(new ItemStack(Material.RAW_FISH)); +// break; +// case 9: +// if(LoadProperties.ironTools && LoadProperties.fishingDrops) +// theCatch.setItemStack(new ItemStack(Material.IRON_SPADE, 1)); +// else +// theCatch.setItemStack(new ItemStack(Material.RAW_FISH)); +// break; +// case 10: +// if(LoadProperties.goldTools && LoadProperties.fishingDrops) +// theCatch.setItemStack(new ItemStack(Material.GOLD_AXE, 1)); +// else +// theCatch.setItemStack(new ItemStack(Material.RAW_FISH)); +// break; +// case 11: +// if(LoadProperties.goldTools && LoadProperties.fishingDrops) +// theCatch.setItemStack(new ItemStack(Material.GOLD_PICKAXE, 1)); +// else +// theCatch.setItemStack(new ItemStack(Material.RAW_FISH)); +// break; +// case 12: +// if(LoadProperties.goldTools && LoadProperties.fishingDrops) +// theCatch.setItemStack(new ItemStack(Material.GOLD_SWORD, 1)); +// else +// theCatch.setItemStack(new ItemStack(Material.RAW_FISH)); +// break; +// case 13: +// if(LoadProperties.goldTools && LoadProperties.fishingDrops) +// theCatch.setItemStack(new ItemStack(Material.GOLD_HOE, 1)); +// else +// theCatch.setItemStack(new ItemStack(Material.RAW_FISH)); +// break; +// case 14: +// if(LoadProperties.goldTools && LoadProperties.fishingDrops) +// theCatch.setItemStack(new ItemStack(Material.GOLD_SPADE, 1)); +// else +// theCatch.setItemStack(new ItemStack(Material.RAW_FISH)); +// break; +// case 15: +// if(LoadProperties.ironArmor && LoadProperties.fishingDrops) +// theCatch.setItemStack(new ItemStack(Material.IRON_BOOTS, 1)); +// else +// theCatch.setItemStack(new ItemStack(Material.RAW_FISH)); +// break; +// case 16: +// if(LoadProperties.ironArmor && LoadProperties.fishingDrops) +// theCatch.setItemStack(new ItemStack(Material.IRON_LEGGINGS, 1)); +// else +// theCatch.setItemStack(new ItemStack(Material.RAW_FISH)); +// break; +// case 17: +// if(LoadProperties.ironArmor && LoadProperties.fishingDrops) +// theCatch.setItemStack(new ItemStack(Material.IRON_CHESTPLATE, 1)); +// else +// theCatch.setItemStack(new ItemStack(Material.RAW_FISH)); +// break; +// case 18: +// if(LoadProperties.ironArmor && LoadProperties.fishingDrops) +// theCatch.setItemStack(new ItemStack(Material.IRON_HELMET, 1)); +// else +// theCatch.setItemStack(new ItemStack(Material.RAW_FISH)); +// break; +// case 19: +// if(LoadProperties.enderPearl && LoadProperties.fishingDrops) +// theCatch.setItemStack(new ItemStack(Material.ENDER_PEARL, 1)); +// else +// theCatch.setItemStack(new ItemStack(Material.RAW_FISH)); +// break; +// case 20: +// if(LoadProperties.blazeRod && LoadProperties.fishingDrops) +// theCatch.setItemStack(new ItemStack(Material.BLAZE_ROD, 1)); +// else +// theCatch.setItemStack(new ItemStack(Material.RAW_FISH)); +// break; +// case 21: +// if(LoadProperties.records && LoadProperties.fishingDrops) +// theCatch.setItemStack(new ItemStack(Material.RECORD_3, 1)); +// else +// theCatch.setItemStack(new ItemStack(Material.RAW_FISH)); +// break; +// case 22: +// if(LoadProperties.records && LoadProperties.fishingDrops) +// theCatch.setItemStack(new ItemStack(Material.RECORD_4, 1)); +// else +// theCatch.setItemStack(new ItemStack(Material.RAW_FISH)); +// break; +// case 23: +// if(LoadProperties.records && LoadProperties.fishingDrops) +// theCatch.setItemStack(new ItemStack(Material.RECORD_5, 1)); +// else +// theCatch.setItemStack(new ItemStack(Material.RAW_FISH)); +// break; +// } +// } +// else +// { +// theCatch.setItemStack(new ItemStack(Material.RAW_FISH, 1)); +// } +// //Change durability to random value +// theCatch.getItemStack().setDurability((short) (Math.random() * theCatch.getItemStack().getType().getMaxDurability())); //Change the damage value } private static void getFishingResultsTier4(Player player, PlayerFishEvent event) { - int randomNum = (int)(Math.random() * 41); + int skillLevel = Users.getProfile(player).getSkillLevel(SkillType.FISHING); Item theCatch = (Item)event.getCaught(); - if(Math.random() * 100 < LoadProperties.fishingDropChanceTier4) { - switch(randomNum) + for(FishingTreasure treasure : LoadProperties.fishingRewardsTier4) { - case 1: - if(LoadProperties.goldArmor && LoadProperties.fishingDrops) - theCatch.setItemStack(new ItemStack(Material.GOLD_BOOTS, 1)); - else - theCatch.setItemStack(new ItemStack(Material.RAW_FISH)); - break; - case 2: - if(LoadProperties.goldArmor && LoadProperties.fishingDrops) - theCatch.setItemStack(new ItemStack(Material.GOLD_HELMET, 1)); - else - theCatch.setItemStack(new ItemStack(Material.RAW_FISH)); - break; - case 3: - if(LoadProperties.goldArmor && LoadProperties.fishingDrops) - theCatch.setItemStack(new ItemStack(Material.GOLD_LEGGINGS, 1)); - else - theCatch.setItemStack(new ItemStack(Material.RAW_FISH)); - break; - case 4: - if(LoadProperties.goldArmor && LoadProperties.fishingDrops) - theCatch.setItemStack(new ItemStack(Material.GOLD_CHESTPLATE, 1)); - else - theCatch.setItemStack(new ItemStack(Material.RAW_FISH)); - break; - case 5: - if(LoadProperties.ironTools && LoadProperties.fishingDrops) - theCatch.setItemStack(new ItemStack(Material.IRON_AXE, 1)); - else - theCatch.setItemStack(new ItemStack(Material.RAW_FISH)); - break; - case 6: - if(LoadProperties.ironTools && LoadProperties.fishingDrops) - theCatch.setItemStack(new ItemStack(Material.IRON_PICKAXE, 1)); - else - theCatch.setItemStack(new ItemStack(Material.RAW_FISH)); - break; - case 7: - if(LoadProperties.ironTools && LoadProperties.fishingDrops) - theCatch.setItemStack(new ItemStack(Material.IRON_SWORD, 1)); - else - theCatch.setItemStack(new ItemStack(Material.RAW_FISH)); - break; - case 8: - if(LoadProperties.ironTools && LoadProperties.fishingDrops) - theCatch.setItemStack(new ItemStack(Material.IRON_HOE, 1)); - else - theCatch.setItemStack(new ItemStack(Material.RAW_FISH)); - break; - case 9: - if(LoadProperties.ironTools && LoadProperties.fishingDrops) - theCatch.setItemStack(new ItemStack(Material.IRON_SPADE, 1)); - else - theCatch.setItemStack(new ItemStack(Material.RAW_FISH)); - break; - case 10: - if(LoadProperties.goldTools && LoadProperties.fishingDrops) - theCatch.setItemStack(new ItemStack(Material.GOLD_AXE, 1)); - else - theCatch.setItemStack(new ItemStack(Material.RAW_FISH)); - break; - case 11: - if(LoadProperties.goldTools && LoadProperties.fishingDrops) - theCatch.setItemStack(new ItemStack(Material.GOLD_PICKAXE, 1)); - else - theCatch.setItemStack(new ItemStack(Material.RAW_FISH)); - break; - case 12: - if(LoadProperties.goldTools && LoadProperties.fishingDrops) - theCatch.setItemStack(new ItemStack(Material.GOLD_SWORD, 1)); - else - theCatch.setItemStack(new ItemStack(Material.RAW_FISH)); - break; - case 13: - if(LoadProperties.goldTools && LoadProperties.fishingDrops) - theCatch.setItemStack(new ItemStack(Material.GOLD_HOE, 1)); - else - theCatch.setItemStack(new ItemStack(Material.RAW_FISH)); - break; - case 14: - if(LoadProperties.goldTools && LoadProperties.fishingDrops) - theCatch.setItemStack(new ItemStack(Material.GOLD_SPADE, 1)); - else - theCatch.setItemStack(new ItemStack(Material.RAW_FISH)); - break; - case 15: - if(LoadProperties.ironArmor && LoadProperties.fishingDrops) - theCatch.setItemStack(new ItemStack(Material.IRON_BOOTS, 1)); - else - theCatch.setItemStack(new ItemStack(Material.RAW_FISH)); - break; - case 16: - if(LoadProperties.ironArmor && LoadProperties.fishingDrops) - theCatch.setItemStack(new ItemStack(Material.IRON_LEGGINGS, 1)); - else - theCatch.setItemStack(new ItemStack(Material.RAW_FISH)); - break; - case 17: - if(LoadProperties.ironArmor && LoadProperties.fishingDrops) - theCatch.setItemStack(new ItemStack(Material.IRON_CHESTPLATE, 1)); - else - theCatch.setItemStack(new ItemStack(Material.RAW_FISH)); - break; - case 18: - if(LoadProperties.ironArmor && LoadProperties.fishingDrops) - theCatch.setItemStack(new ItemStack(Material.IRON_HELMET, 1)); - else - theCatch.setItemStack(new ItemStack(Material.RAW_FISH)); - break; - case 19: - if(LoadProperties.enderPearl && LoadProperties.fishingDrops) - theCatch.setItemStack(new ItemStack(Material.ENDER_PEARL, 1)); - else - theCatch.setItemStack(new ItemStack(Material.RAW_FISH)); - break; - case 20: - if(LoadProperties.blazeRod && LoadProperties.fishingDrops) - theCatch.setItemStack(new ItemStack(Material.BLAZE_ROD, 1)); - else - theCatch.setItemStack(new ItemStack(Material.RAW_FISH)); - break; - case 21: - if(LoadProperties.records && LoadProperties.fishingDrops) - theCatch.setItemStack(new ItemStack(Material.RECORD_3, 1)); - else - theCatch.setItemStack(new ItemStack(Material.RAW_FISH)); - break; - case 22: - if(LoadProperties.records && LoadProperties.fishingDrops) - theCatch.setItemStack(new ItemStack(Material.RECORD_4, 1)); - else - theCatch.setItemStack(new ItemStack(Material.RAW_FISH)); - break; - case 23: - if(LoadProperties.records && LoadProperties.fishingDrops) - theCatch.setItemStack(new ItemStack(Material.RECORD_5, 1)); - else - theCatch.setItemStack(new ItemStack(Material.RAW_FISH)); - break; - case 24: - if(LoadProperties.diamondArmor && LoadProperties.fishingDrops) - theCatch.setItemStack(new ItemStack(Material.DIAMOND_BOOTS, 1)); - else - theCatch.setItemStack(new ItemStack(Material.RAW_FISH)); - break; - case 25: - if(LoadProperties.diamondArmor && LoadProperties.fishingDrops) - theCatch.setItemStack(new ItemStack(Material.DIAMOND_HELMET, 1)); - else - theCatch.setItemStack(new ItemStack(Material.RAW_FISH)); - break; - case 26: - if(LoadProperties.diamondArmor && LoadProperties.fishingDrops) - theCatch.setItemStack(new ItemStack(Material.DIAMOND_LEGGINGS, 1)); - else - theCatch.setItemStack(new ItemStack(Material.RAW_FISH)); - break; - case 27: - if(LoadProperties.diamondArmor && LoadProperties.fishingDrops) - theCatch.setItemStack(new ItemStack(Material.DIAMOND_CHESTPLATE, 1)); - else - theCatch.setItemStack(new ItemStack(Material.RAW_FISH)); - break; - case 28: - if(LoadProperties.diamondTools && LoadProperties.fishingDrops) - theCatch.setItemStack(new ItemStack(Material.DIAMOND_AXE, 1)); - else - theCatch.setItemStack(new ItemStack(Material.RAW_FISH)); - break; - case 29: - if(LoadProperties.diamondTools && LoadProperties.fishingDrops) - theCatch.setItemStack(new ItemStack(Material.DIAMOND_PICKAXE, 1)); - else - theCatch.setItemStack(new ItemStack(Material.RAW_FISH)); - break; - case 30: - if(LoadProperties.diamondTools && LoadProperties.fishingDrops) - theCatch.setItemStack(new ItemStack(Material.DIAMOND_SWORD, 1)); - else - theCatch.setItemStack(new ItemStack(Material.RAW_FISH)); - break; - case 31: - if(LoadProperties.diamondTools && LoadProperties.fishingDrops) - theCatch.setItemStack(new ItemStack(Material.DIAMOND_HOE, 1)); - else - theCatch.setItemStack(new ItemStack(Material.RAW_FISH)); - break; - case 32: - if(LoadProperties.diamondTools && LoadProperties.fishingDrops) - theCatch.setItemStack(new ItemStack(Material.DIAMOND_SPADE, 1)); - else - theCatch.setItemStack(new ItemStack(Material.RAW_FISH)); - break; - case 33: - if(LoadProperties.records && LoadProperties.fishingDrops) - theCatch.setItemStack(new ItemStack(Material.RECORD_6, 1)); - else - theCatch.setItemStack(new ItemStack(Material.RAW_FISH)); - break; - case 34: - if(LoadProperties.records && LoadProperties.fishingDrops) - theCatch.setItemStack(new ItemStack(Material.RECORD_7, 1)); - else - theCatch.setItemStack(new ItemStack(Material.RAW_FISH)); - break; - case 35: - if(LoadProperties.records && LoadProperties.fishingDrops) - theCatch.setItemStack(new ItemStack(Material.RECORD_8, 1)); - else - theCatch.setItemStack(new ItemStack(Material.RAW_FISH)); - break; - case 36: - if(LoadProperties.records && LoadProperties.fishingDrops) - theCatch.setItemStack(new ItemStack(Material.RECORD_9, 1)); - else - theCatch.setItemStack(new ItemStack(Material.RAW_FISH)); - break; - case 37: - if(LoadProperties.records && LoadProperties.fishingDrops) - theCatch.setItemStack(new ItemStack(Material.RECORD_10, 1)); - else - theCatch.setItemStack(new ItemStack(Material.RAW_FISH)); - break; - case 38: - if(LoadProperties.records && LoadProperties.fishingDrops) - theCatch.setItemStack(new ItemStack(Material.RECORD_11, 1)); - else - theCatch.setItemStack(new ItemStack(Material.RAW_FISH)); - break; - case 39: - if(LoadProperties.glowstoneDust && LoadProperties.fishingDrops) - theCatch.setItemStack(new ItemStack(Material.GLOWSTONE_DUST, 16)); - else - theCatch.setItemStack(new ItemStack(Material.RAW_FISH)); - break; - case 40: - if(LoadProperties.fishingDiamonds && LoadProperties.fishingDrops) - theCatch.setItemStack(new ItemStack(Material.DIAMOND, (int)(Math.random() * 10))); - else - theCatch.setItemStack(new ItemStack(Material.RAW_FISH)); - break; + if(Math.random() * 100 > (100.00 - treasure.getDropChance())) + { + if(skillLevel >= treasure.getDropLevel() && skillLevel <= treasure.getMaxLevel()) + { + Users.getProfile(player).addXP(SkillType.FISHING, treasure.getXp(), player); + theCatch.setItemStack(treasure.getDrop()); + } + } } - } else + } + else { - theCatch.setItemStack(new ItemStack(Material.RAW_FISH, 1)); + theCatch.setItemStack(new ItemStack(Material.RAW_FISH)); } //Change durability to random value theCatch.getItemStack().setDurability((short) (Math.random() * theCatch.getItemStack().getType().getMaxDurability())); //Change the damage value + +// int randomNum = (int)(Math.random() * 41); +// Item theCatch = (Item)event.getCaught(); +// +// if(Math.random() * 100 < LoadProperties.fishingDropChanceTier4) +// { +// switch(randomNum) +// { +// case 1: +// if(LoadProperties.goldArmor && LoadProperties.fishingDrops) +// theCatch.setItemStack(new ItemStack(Material.GOLD_BOOTS, 1)); +// else +// theCatch.setItemStack(new ItemStack(Material.RAW_FISH)); +// break; +// case 2: +// if(LoadProperties.goldArmor && LoadProperties.fishingDrops) +// theCatch.setItemStack(new ItemStack(Material.GOLD_HELMET, 1)); +// else +// theCatch.setItemStack(new ItemStack(Material.RAW_FISH)); +// break; +// case 3: +// if(LoadProperties.goldArmor && LoadProperties.fishingDrops) +// theCatch.setItemStack(new ItemStack(Material.GOLD_LEGGINGS, 1)); +// else +// theCatch.setItemStack(new ItemStack(Material.RAW_FISH)); +// break; +// case 4: +// if(LoadProperties.goldArmor && LoadProperties.fishingDrops) +// theCatch.setItemStack(new ItemStack(Material.GOLD_CHESTPLATE, 1)); +// else +// theCatch.setItemStack(new ItemStack(Material.RAW_FISH)); +// break; +// case 5: +// if(LoadProperties.ironTools && LoadProperties.fishingDrops) +// theCatch.setItemStack(new ItemStack(Material.IRON_AXE, 1)); +// else +// theCatch.setItemStack(new ItemStack(Material.RAW_FISH)); +// break; +// case 6: +// if(LoadProperties.ironTools && LoadProperties.fishingDrops) +// theCatch.setItemStack(new ItemStack(Material.IRON_PICKAXE, 1)); +// else +// theCatch.setItemStack(new ItemStack(Material.RAW_FISH)); +// break; +// case 7: +// if(LoadProperties.ironTools && LoadProperties.fishingDrops) +// theCatch.setItemStack(new ItemStack(Material.IRON_SWORD, 1)); +// else +// theCatch.setItemStack(new ItemStack(Material.RAW_FISH)); +// break; +// case 8: +// if(LoadProperties.ironTools && LoadProperties.fishingDrops) +// theCatch.setItemStack(new ItemStack(Material.IRON_HOE, 1)); +// else +// theCatch.setItemStack(new ItemStack(Material.RAW_FISH)); +// break; +// case 9: +// if(LoadProperties.ironTools && LoadProperties.fishingDrops) +// theCatch.setItemStack(new ItemStack(Material.IRON_SPADE, 1)); +// else +// theCatch.setItemStack(new ItemStack(Material.RAW_FISH)); +// break; +// case 10: +// if(LoadProperties.goldTools && LoadProperties.fishingDrops) +// theCatch.setItemStack(new ItemStack(Material.GOLD_AXE, 1)); +// else +// theCatch.setItemStack(new ItemStack(Material.RAW_FISH)); +// break; +// case 11: +// if(LoadProperties.goldTools && LoadProperties.fishingDrops) +// theCatch.setItemStack(new ItemStack(Material.GOLD_PICKAXE, 1)); +// else +// theCatch.setItemStack(new ItemStack(Material.RAW_FISH)); +// break; +// case 12: +// if(LoadProperties.goldTools && LoadProperties.fishingDrops) +// theCatch.setItemStack(new ItemStack(Material.GOLD_SWORD, 1)); +// else +// theCatch.setItemStack(new ItemStack(Material.RAW_FISH)); +// break; +// case 13: +// if(LoadProperties.goldTools && LoadProperties.fishingDrops) +// theCatch.setItemStack(new ItemStack(Material.GOLD_HOE, 1)); +// else +// theCatch.setItemStack(new ItemStack(Material.RAW_FISH)); +// break; +// case 14: +// if(LoadProperties.goldTools && LoadProperties.fishingDrops) +// theCatch.setItemStack(new ItemStack(Material.GOLD_SPADE, 1)); +// else +// theCatch.setItemStack(new ItemStack(Material.RAW_FISH)); +// break; +// case 15: +// if(LoadProperties.ironArmor && LoadProperties.fishingDrops) +// theCatch.setItemStack(new ItemStack(Material.IRON_BOOTS, 1)); +// else +// theCatch.setItemStack(new ItemStack(Material.RAW_FISH)); +// break; +// case 16: +// if(LoadProperties.ironArmor && LoadProperties.fishingDrops) +// theCatch.setItemStack(new ItemStack(Material.IRON_LEGGINGS, 1)); +// else +// theCatch.setItemStack(new ItemStack(Material.RAW_FISH)); +// break; +// case 17: +// if(LoadProperties.ironArmor && LoadProperties.fishingDrops) +// theCatch.setItemStack(new ItemStack(Material.IRON_CHESTPLATE, 1)); +// else +// theCatch.setItemStack(new ItemStack(Material.RAW_FISH)); +// break; +// case 18: +// if(LoadProperties.ironArmor && LoadProperties.fishingDrops) +// theCatch.setItemStack(new ItemStack(Material.IRON_HELMET, 1)); +// else +// theCatch.setItemStack(new ItemStack(Material.RAW_FISH)); +// break; +// case 19: +// if(LoadProperties.enderPearl && LoadProperties.fishingDrops) +// theCatch.setItemStack(new ItemStack(Material.ENDER_PEARL, 1)); +// else +// theCatch.setItemStack(new ItemStack(Material.RAW_FISH)); +// break; +// case 20: +// if(LoadProperties.blazeRod && LoadProperties.fishingDrops) +// theCatch.setItemStack(new ItemStack(Material.BLAZE_ROD, 1)); +// else +// theCatch.setItemStack(new ItemStack(Material.RAW_FISH)); +// break; +// case 21: +// if(LoadProperties.records && LoadProperties.fishingDrops) +// theCatch.setItemStack(new ItemStack(Material.RECORD_3, 1)); +// else +// theCatch.setItemStack(new ItemStack(Material.RAW_FISH)); +// break; +// case 22: +// if(LoadProperties.records && LoadProperties.fishingDrops) +// theCatch.setItemStack(new ItemStack(Material.RECORD_4, 1)); +// else +// theCatch.setItemStack(new ItemStack(Material.RAW_FISH)); +// break; +// case 23: +// if(LoadProperties.records && LoadProperties.fishingDrops) +// theCatch.setItemStack(new ItemStack(Material.RECORD_5, 1)); +// else +// theCatch.setItemStack(new ItemStack(Material.RAW_FISH)); +// break; +// case 24: +// if(LoadProperties.diamondArmor && LoadProperties.fishingDrops) +// theCatch.setItemStack(new ItemStack(Material.DIAMOND_BOOTS, 1)); +// else +// theCatch.setItemStack(new ItemStack(Material.RAW_FISH)); +// break; +// case 25: +// if(LoadProperties.diamondArmor && LoadProperties.fishingDrops) +// theCatch.setItemStack(new ItemStack(Material.DIAMOND_HELMET, 1)); +// else +// theCatch.setItemStack(new ItemStack(Material.RAW_FISH)); +// break; +// case 26: +// if(LoadProperties.diamondArmor && LoadProperties.fishingDrops) +// theCatch.setItemStack(new ItemStack(Material.DIAMOND_LEGGINGS, 1)); +// else +// theCatch.setItemStack(new ItemStack(Material.RAW_FISH)); +// break; +// case 27: +// if(LoadProperties.diamondArmor && LoadProperties.fishingDrops) +// theCatch.setItemStack(new ItemStack(Material.DIAMOND_CHESTPLATE, 1)); +// else +// theCatch.setItemStack(new ItemStack(Material.RAW_FISH)); +// break; +// case 28: +// if(LoadProperties.diamondTools && LoadProperties.fishingDrops) +// theCatch.setItemStack(new ItemStack(Material.DIAMOND_AXE, 1)); +// else +// theCatch.setItemStack(new ItemStack(Material.RAW_FISH)); +// break; +// case 29: +// if(LoadProperties.diamondTools && LoadProperties.fishingDrops) +// theCatch.setItemStack(new ItemStack(Material.DIAMOND_PICKAXE, 1)); +// else +// theCatch.setItemStack(new ItemStack(Material.RAW_FISH)); +// break; +// case 30: +// if(LoadProperties.diamondTools && LoadProperties.fishingDrops) +// theCatch.setItemStack(new ItemStack(Material.DIAMOND_SWORD, 1)); +// else +// theCatch.setItemStack(new ItemStack(Material.RAW_FISH)); +// break; +// case 31: +// if(LoadProperties.diamondTools && LoadProperties.fishingDrops) +// theCatch.setItemStack(new ItemStack(Material.DIAMOND_HOE, 1)); +// else +// theCatch.setItemStack(new ItemStack(Material.RAW_FISH)); +// break; +// case 32: +// if(LoadProperties.diamondTools && LoadProperties.fishingDrops) +// theCatch.setItemStack(new ItemStack(Material.DIAMOND_SPADE, 1)); +// else +// theCatch.setItemStack(new ItemStack(Material.RAW_FISH)); +// break; +// case 33: +// if(LoadProperties.records && LoadProperties.fishingDrops) +// theCatch.setItemStack(new ItemStack(Material.RECORD_6, 1)); +// else +// theCatch.setItemStack(new ItemStack(Material.RAW_FISH)); +// break; +// case 34: +// if(LoadProperties.records && LoadProperties.fishingDrops) +// theCatch.setItemStack(new ItemStack(Material.RECORD_7, 1)); +// else +// theCatch.setItemStack(new ItemStack(Material.RAW_FISH)); +// break; +// case 35: +// if(LoadProperties.records && LoadProperties.fishingDrops) +// theCatch.setItemStack(new ItemStack(Material.RECORD_8, 1)); +// else +// theCatch.setItemStack(new ItemStack(Material.RAW_FISH)); +// break; +// case 36: +// if(LoadProperties.records && LoadProperties.fishingDrops) +// theCatch.setItemStack(new ItemStack(Material.RECORD_9, 1)); +// else +// theCatch.setItemStack(new ItemStack(Material.RAW_FISH)); +// break; +// case 37: +// if(LoadProperties.records && LoadProperties.fishingDrops) +// theCatch.setItemStack(new ItemStack(Material.RECORD_10, 1)); +// else +// theCatch.setItemStack(new ItemStack(Material.RAW_FISH)); +// break; +// case 38: +// if(LoadProperties.records && LoadProperties.fishingDrops) +// theCatch.setItemStack(new ItemStack(Material.RECORD_11, 1)); +// else +// theCatch.setItemStack(new ItemStack(Material.RAW_FISH)); +// break; +// case 39: +// if(LoadProperties.glowstoneDust && LoadProperties.fishingDrops) +// theCatch.setItemStack(new ItemStack(Material.GLOWSTONE_DUST, 16)); +// else +// theCatch.setItemStack(new ItemStack(Material.RAW_FISH)); +// break; +// case 40: +// if(LoadProperties.fishingDiamonds && LoadProperties.fishingDrops) +// theCatch.setItemStack(new ItemStack(Material.DIAMOND, (int)(Math.random() * 10))); +// else +// theCatch.setItemStack(new ItemStack(Material.RAW_FISH)); +// break; +// } +// } else +// { +// theCatch.setItemStack(new ItemStack(Material.RAW_FISH, 1)); +// } +// //Change durability to random value +// theCatch.getItemStack().setDurability((short) (Math.random() * theCatch.getItemStack().getType().getMaxDurability())); //Change the damage value } private static void getFishingResultsTier5(Player player, PlayerFishEvent event) { - int randomNum = (int)(Math.random() * 50); + int skillLevel = Users.getProfile(player).getSkillLevel(SkillType.FISHING); Item theCatch = (Item)event.getCaught(); - if(Math.random() * 100 < LoadProperties.fishingDropChanceTier5) { - switch(randomNum) + for(FishingTreasure treasure : LoadProperties.fishingRewardsTier5) { - case 1: - if(LoadProperties.goldArmor && LoadProperties.fishingDrops) - theCatch.setItemStack(new ItemStack(Material.GOLD_BOOTS, 1)); - else - theCatch.setItemStack(new ItemStack(Material.RAW_FISH)); - break; - case 2: - if(LoadProperties.goldArmor && LoadProperties.fishingDrops) - theCatch.setItemStack(new ItemStack(Material.GOLD_HELMET, 1)); - else - theCatch.setItemStack(new ItemStack(Material.RAW_FISH)); - break; - case 3: - if(LoadProperties.goldArmor && LoadProperties.fishingDrops) - theCatch.setItemStack(new ItemStack(Material.GOLD_LEGGINGS, 1)); - else - theCatch.setItemStack(new ItemStack(Material.RAW_FISH)); - break; - case 4: - if(LoadProperties.goldArmor && LoadProperties.fishingDrops) - theCatch.setItemStack(new ItemStack(Material.GOLD_CHESTPLATE, 1)); - else - theCatch.setItemStack(new ItemStack(Material.RAW_FISH)); - break; - case 5: - if(LoadProperties.ironTools && LoadProperties.fishingDrops) - theCatch.setItemStack(new ItemStack(Material.IRON_AXE, 1)); - else - theCatch.setItemStack(new ItemStack(Material.RAW_FISH)); - break; - case 6: - if(LoadProperties.ironTools && LoadProperties.fishingDrops) - theCatch.setItemStack(new ItemStack(Material.IRON_PICKAXE, 1)); - else - theCatch.setItemStack(new ItemStack(Material.RAW_FISH)); - break; - case 7: - if(LoadProperties.ironTools && LoadProperties.fishingDrops) - theCatch.setItemStack(new ItemStack(Material.IRON_SWORD, 1)); - else - theCatch.setItemStack(new ItemStack(Material.RAW_FISH)); - break; - case 8: - if(LoadProperties.ironTools && LoadProperties.fishingDrops) - theCatch.setItemStack(new ItemStack(Material.IRON_HOE, 1)); - else - theCatch.setItemStack(new ItemStack(Material.RAW_FISH)); - break; - case 9: - if(LoadProperties.ironTools && LoadProperties.fishingDrops) - theCatch.setItemStack(new ItemStack(Material.IRON_SPADE, 1)); - else - theCatch.setItemStack(new ItemStack(Material.RAW_FISH)); - break; - case 10: - if(LoadProperties.goldTools && LoadProperties.fishingDrops) - theCatch.setItemStack(new ItemStack(Material.GOLD_AXE, 1)); - else - theCatch.setItemStack(new ItemStack(Material.RAW_FISH)); - break; - case 11: - if(LoadProperties.goldTools && LoadProperties.fishingDrops) - theCatch.setItemStack(new ItemStack(Material.GOLD_PICKAXE, 1)); - else - theCatch.setItemStack(new ItemStack(Material.RAW_FISH)); - break; - case 12: - if(LoadProperties.goldTools && LoadProperties.fishingDrops) - theCatch.setItemStack(new ItemStack(Material.GOLD_SWORD, 1)); - else - theCatch.setItemStack(new ItemStack(Material.RAW_FISH)); - break; - case 13: - if(LoadProperties.goldTools && LoadProperties.fishingDrops) - theCatch.setItemStack(new ItemStack(Material.GOLD_HOE, 1)); - else - theCatch.setItemStack(new ItemStack(Material.RAW_FISH)); - break; - case 14: - if(LoadProperties.goldTools && LoadProperties.fishingDrops) - theCatch.setItemStack(new ItemStack(Material.GOLD_SPADE, 1)); - else - theCatch.setItemStack(new ItemStack(Material.RAW_FISH)); - break; - case 15: - if(LoadProperties.ironArmor && LoadProperties.fishingDrops) - theCatch.setItemStack(new ItemStack(Material.IRON_BOOTS, 1)); - else - theCatch.setItemStack(new ItemStack(Material.RAW_FISH)); - break; - case 16: - if(LoadProperties.ironArmor && LoadProperties.fishingDrops) - theCatch.setItemStack(new ItemStack(Material.IRON_LEGGINGS, 1)); - else - theCatch.setItemStack(new ItemStack(Material.RAW_FISH)); - break; - case 17: - if(LoadProperties.ironArmor && LoadProperties.fishingDrops) - theCatch.setItemStack(new ItemStack(Material.IRON_CHESTPLATE, 1)); - else - theCatch.setItemStack(new ItemStack(Material.RAW_FISH)); - break; - case 18: - if(LoadProperties.ironArmor && LoadProperties.fishingDrops) - theCatch.setItemStack(new ItemStack(Material.IRON_HELMET, 1)); - else - theCatch.setItemStack(new ItemStack(Material.RAW_FISH)); - break; - case 19: - if(LoadProperties.enderPearl && LoadProperties.fishingDrops) - theCatch.setItemStack(new ItemStack(Material.ENDER_PEARL, 1)); - else - theCatch.setItemStack(new ItemStack(Material.RAW_FISH)); - break; - case 20: - if(LoadProperties.blazeRod && LoadProperties.fishingDrops) - theCatch.setItemStack(new ItemStack(Material.BLAZE_ROD, 1)); - else - theCatch.setItemStack(new ItemStack(Material.RAW_FISH)); - break; - case 21: - if(LoadProperties.records && LoadProperties.fishingDrops) - theCatch.setItemStack(new ItemStack(Material.RECORD_3, 1)); - else - theCatch.setItemStack(new ItemStack(Material.RAW_FISH)); - break; - case 22: - if(LoadProperties.records && LoadProperties.fishingDrops) - theCatch.setItemStack(new ItemStack(Material.RECORD_4, 1)); - else - theCatch.setItemStack(new ItemStack(Material.RAW_FISH)); - break; - case 23: - if(LoadProperties.records && LoadProperties.fishingDrops) - theCatch.setItemStack(new ItemStack(Material.RECORD_5, 1));else - theCatch.setItemStack(new ItemStack(Material.RAW_FISH)); - break; - case 24: - if(LoadProperties.diamondArmor && LoadProperties.fishingDrops) - theCatch.setItemStack(new ItemStack(Material.DIAMOND_BOOTS, 1)); - else - theCatch.setItemStack(new ItemStack(Material.RAW_FISH)); - break; - case 25: - if(LoadProperties.diamondArmor && LoadProperties.fishingDrops) - theCatch.setItemStack(new ItemStack(Material.DIAMOND_HELMET, 1)); - else - theCatch.setItemStack(new ItemStack(Material.RAW_FISH)); - break; - case 26: - if(LoadProperties.diamondArmor && LoadProperties.fishingDrops) - theCatch.setItemStack(new ItemStack(Material.DIAMOND_LEGGINGS, 1)); - else - theCatch.setItemStack(new ItemStack(Material.RAW_FISH)); - break; - case 27: - if(LoadProperties.diamondArmor && LoadProperties.fishingDrops) - theCatch.setItemStack(new ItemStack(Material.DIAMOND_CHESTPLATE, 1)); - else - theCatch.setItemStack(new ItemStack(Material.RAW_FISH)); - break; - case 28: - if(LoadProperties.diamondTools && LoadProperties.fishingDrops) - theCatch.setItemStack(new ItemStack(Material.DIAMOND_AXE, 1)); - else - theCatch.setItemStack(new ItemStack(Material.RAW_FISH)); - break; - case 29: - if(LoadProperties.diamondTools && LoadProperties.fishingDrops) - theCatch.setItemStack(new ItemStack(Material.DIAMOND_PICKAXE, 1)); - else - theCatch.setItemStack(new ItemStack(Material.RAW_FISH)); - break; - case 30: - if(LoadProperties.diamondTools && LoadProperties.fishingDrops) - theCatch.setItemStack(new ItemStack(Material.DIAMOND_SWORD, 1)); - else - theCatch.setItemStack(new ItemStack(Material.RAW_FISH)); - break; - case 31: - if(LoadProperties.diamondTools && LoadProperties.fishingDrops) - theCatch.setItemStack(new ItemStack(Material.DIAMOND_HOE, 1)); - else - theCatch.setItemStack(new ItemStack(Material.RAW_FISH)); - break; - case 32: - if(LoadProperties.diamondTools && LoadProperties.fishingDrops) - theCatch.setItemStack(new ItemStack(Material.DIAMOND_SPADE, 1)); - else - theCatch.setItemStack(new ItemStack(Material.RAW_FISH)); - break; - case 33: - if(LoadProperties.records && LoadProperties.fishingDrops) - theCatch.setItemStack(new ItemStack(Material.RECORD_6, 1)); - else - theCatch.setItemStack(new ItemStack(Material.RAW_FISH)); - break; - case 34: - if(LoadProperties.records && LoadProperties.fishingDrops) - theCatch.setItemStack(new ItemStack(Material.RECORD_7, 1)); - else - theCatch.setItemStack(new ItemStack(Material.RAW_FISH)); - break; - case 35: - if(LoadProperties.records && LoadProperties.fishingDrops) - theCatch.setItemStack(new ItemStack(Material.RECORD_8, 1)); - else - theCatch.setItemStack(new ItemStack(Material.RAW_FISH)); - break; - case 36: - if(LoadProperties.records && LoadProperties.fishingDrops) - theCatch.setItemStack(new ItemStack(Material.RECORD_9, 1)); - else - theCatch.setItemStack(new ItemStack(Material.RAW_FISH)); - break; - case 37: - if(LoadProperties.records && LoadProperties.fishingDrops) - theCatch.setItemStack(new ItemStack(Material.RECORD_10, 1)); - else - theCatch.setItemStack(new ItemStack(Material.RAW_FISH)); - break; - case 38: - if(LoadProperties.records && LoadProperties.fishingDrops) - theCatch.setItemStack(new ItemStack(Material.RECORD_11, 1)); - else - theCatch.setItemStack(new ItemStack(Material.RAW_FISH)); - break; - case 39: - if(LoadProperties.glowstoneDust && LoadProperties.fishingDrops) - theCatch.setItemStack(new ItemStack(Material.GLOWSTONE_DUST, 16)); - else - theCatch.setItemStack(new ItemStack(Material.RAW_FISH)); - break; - case 40: - if(LoadProperties.fishingDiamonds && LoadProperties.fishingDrops) - theCatch.setItemStack(new ItemStack(Material.DIAMOND, (int)(Math.random() * 20))); - else - theCatch.setItemStack(new ItemStack(Material.RAW_FISH)); - break; - case 41: - if(LoadProperties.diamondArmor && LoadProperties.fishingDrops) - theCatch.setItemStack(new ItemStack(Material.DIAMOND_BOOTS, 1)); - else - theCatch.setItemStack(new ItemStack(Material.RAW_FISH)); - break; - case 42: - if(LoadProperties.diamondArmor && LoadProperties.fishingDrops) - theCatch.setItemStack(new ItemStack(Material.DIAMOND_HELMET, 1)); - else - theCatch.setItemStack(new ItemStack(Material.RAW_FISH)); - break; - case 43: - if(LoadProperties.diamondArmor && LoadProperties.fishingDrops) - theCatch.setItemStack(new ItemStack(Material.DIAMOND_LEGGINGS, 1)); - else - theCatch.setItemStack(new ItemStack(Material.RAW_FISH)); - break; - case 44: - if(LoadProperties.diamondArmor && LoadProperties.fishingDrops) - theCatch.setItemStack(new ItemStack(Material.DIAMOND_CHESTPLATE, 1)); - else - theCatch.setItemStack(new ItemStack(Material.RAW_FISH)); - break; - case 45: - if(LoadProperties.diamondTools && LoadProperties.fishingDrops) - theCatch.setItemStack(new ItemStack(Material.DIAMOND_AXE, 1)); - else - theCatch.setItemStack(new ItemStack(Material.RAW_FISH)); - break; - case 46: - if(LoadProperties.diamondTools && LoadProperties.fishingDrops) - theCatch.setItemStack(new ItemStack(Material.DIAMOND_PICKAXE, 1)); - else - theCatch.setItemStack(new ItemStack(Material.RAW_FISH)); - break; - case 47: - if(LoadProperties.diamondTools && LoadProperties.fishingDrops) - theCatch.setItemStack(new ItemStack(Material.DIAMOND_SWORD, 1)); - else - theCatch.setItemStack(new ItemStack(Material.RAW_FISH)); - break; - case 48: - if(LoadProperties.diamondTools && LoadProperties.fishingDrops) - theCatch.setItemStack(new ItemStack(Material.DIAMOND_HOE, 1)); - else - theCatch.setItemStack(new ItemStack(Material.RAW_FISH)); - break; - case 49: - if(LoadProperties.diamondTools && LoadProperties.fishingDrops) - theCatch.setItemStack(new ItemStack(Material.DIAMOND_SPADE, 1)); - else - theCatch.setItemStack(new ItemStack(Material.RAW_FISH)); - break; + if(Math.random() * 100 > (100.00 - treasure.getDropChance())) + { + if(skillLevel >= treasure.getDropLevel() && skillLevel <= treasure.getMaxLevel()) + { + Users.getProfile(player).addXP(SkillType.FISHING, treasure.getXp(), player); + theCatch.setItemStack(treasure.getDrop()); + } + } } - } else { - theCatch.setItemStack(new ItemStack(Material.RAW_FISH, 1)); + } + else + { + theCatch.setItemStack(new ItemStack(Material.RAW_FISH)); } //Change durability to random value theCatch.getItemStack().setDurability((short) (Math.random() * theCatch.getItemStack().getType().getMaxDurability())); //Change the damage value + +// int randomNum = (int)(Math.random() * 50); +// Item theCatch = (Item)event.getCaught(); +// +// if(Math.random() * 100 < LoadProperties.fishingDropChanceTier5) +// { +// switch(randomNum) +// { +// case 1: +// if(LoadProperties.goldArmor && LoadProperties.fishingDrops) +// theCatch.setItemStack(new ItemStack(Material.GOLD_BOOTS, 1)); +// else +// theCatch.setItemStack(new ItemStack(Material.RAW_FISH)); +// break; +// case 2: +// if(LoadProperties.goldArmor && LoadProperties.fishingDrops) +// theCatch.setItemStack(new ItemStack(Material.GOLD_HELMET, 1)); +// else +// theCatch.setItemStack(new ItemStack(Material.RAW_FISH)); +// break; +// case 3: +// if(LoadProperties.goldArmor && LoadProperties.fishingDrops) +// theCatch.setItemStack(new ItemStack(Material.GOLD_LEGGINGS, 1)); +// else +// theCatch.setItemStack(new ItemStack(Material.RAW_FISH)); +// break; +// case 4: +// if(LoadProperties.goldArmor && LoadProperties.fishingDrops) +// theCatch.setItemStack(new ItemStack(Material.GOLD_CHESTPLATE, 1)); +// else +// theCatch.setItemStack(new ItemStack(Material.RAW_FISH)); +// break; +// case 5: +// if(LoadProperties.ironTools && LoadProperties.fishingDrops) +// theCatch.setItemStack(new ItemStack(Material.IRON_AXE, 1)); +// else +// theCatch.setItemStack(new ItemStack(Material.RAW_FISH)); +// break; +// case 6: +// if(LoadProperties.ironTools && LoadProperties.fishingDrops) +// theCatch.setItemStack(new ItemStack(Material.IRON_PICKAXE, 1)); +// else +// theCatch.setItemStack(new ItemStack(Material.RAW_FISH)); +// break; +// case 7: +// if(LoadProperties.ironTools && LoadProperties.fishingDrops) +// theCatch.setItemStack(new ItemStack(Material.IRON_SWORD, 1)); +// else +// theCatch.setItemStack(new ItemStack(Material.RAW_FISH)); +// break; +// case 8: +// if(LoadProperties.ironTools && LoadProperties.fishingDrops) +// theCatch.setItemStack(new ItemStack(Material.IRON_HOE, 1)); +// else +// theCatch.setItemStack(new ItemStack(Material.RAW_FISH)); +// break; +// case 9: +// if(LoadProperties.ironTools && LoadProperties.fishingDrops) +// theCatch.setItemStack(new ItemStack(Material.IRON_SPADE, 1)); +// else +// theCatch.setItemStack(new ItemStack(Material.RAW_FISH)); +// break; +// case 10: +// if(LoadProperties.goldTools && LoadProperties.fishingDrops) +// theCatch.setItemStack(new ItemStack(Material.GOLD_AXE, 1)); +// else +// theCatch.setItemStack(new ItemStack(Material.RAW_FISH)); +// break; +// case 11: +// if(LoadProperties.goldTools && LoadProperties.fishingDrops) +// theCatch.setItemStack(new ItemStack(Material.GOLD_PICKAXE, 1)); +// else +// theCatch.setItemStack(new ItemStack(Material.RAW_FISH)); +// break; +// case 12: +// if(LoadProperties.goldTools && LoadProperties.fishingDrops) +// theCatch.setItemStack(new ItemStack(Material.GOLD_SWORD, 1)); +// else +// theCatch.setItemStack(new ItemStack(Material.RAW_FISH)); +// break; +// case 13: +// if(LoadProperties.goldTools && LoadProperties.fishingDrops) +// theCatch.setItemStack(new ItemStack(Material.GOLD_HOE, 1)); +// else +// theCatch.setItemStack(new ItemStack(Material.RAW_FISH)); +// break; +// case 14: +// if(LoadProperties.goldTools && LoadProperties.fishingDrops) +// theCatch.setItemStack(new ItemStack(Material.GOLD_SPADE, 1)); +// else +// theCatch.setItemStack(new ItemStack(Material.RAW_FISH)); +// break; +// case 15: +// if(LoadProperties.ironArmor && LoadProperties.fishingDrops) +// theCatch.setItemStack(new ItemStack(Material.IRON_BOOTS, 1)); +// else +// theCatch.setItemStack(new ItemStack(Material.RAW_FISH)); +// break; +// case 16: +// if(LoadProperties.ironArmor && LoadProperties.fishingDrops) +// theCatch.setItemStack(new ItemStack(Material.IRON_LEGGINGS, 1)); +// else +// theCatch.setItemStack(new ItemStack(Material.RAW_FISH)); +// break; +// case 17: +// if(LoadProperties.ironArmor && LoadProperties.fishingDrops) +// theCatch.setItemStack(new ItemStack(Material.IRON_CHESTPLATE, 1)); +// else +// theCatch.setItemStack(new ItemStack(Material.RAW_FISH)); +// break; +// case 18: +// if(LoadProperties.ironArmor && LoadProperties.fishingDrops) +// theCatch.setItemStack(new ItemStack(Material.IRON_HELMET, 1)); +// else +// theCatch.setItemStack(new ItemStack(Material.RAW_FISH)); +// break; +// case 19: +// if(LoadProperties.enderPearl && LoadProperties.fishingDrops) +// theCatch.setItemStack(new ItemStack(Material.ENDER_PEARL, 1)); +// else +// theCatch.setItemStack(new ItemStack(Material.RAW_FISH)); +// break; +// case 20: +// if(LoadProperties.blazeRod && LoadProperties.fishingDrops) +// theCatch.setItemStack(new ItemStack(Material.BLAZE_ROD, 1)); +// else +// theCatch.setItemStack(new ItemStack(Material.RAW_FISH)); +// break; +// case 21: +// if(LoadProperties.records && LoadProperties.fishingDrops) +// theCatch.setItemStack(new ItemStack(Material.RECORD_3, 1)); +// else +// theCatch.setItemStack(new ItemStack(Material.RAW_FISH)); +// break; +// case 22: +// if(LoadProperties.records && LoadProperties.fishingDrops) +// theCatch.setItemStack(new ItemStack(Material.RECORD_4, 1)); +// else +// theCatch.setItemStack(new ItemStack(Material.RAW_FISH)); +// break; +// case 23: +// if(LoadProperties.records && LoadProperties.fishingDrops) +// theCatch.setItemStack(new ItemStack(Material.RECORD_5, 1));else +// theCatch.setItemStack(new ItemStack(Material.RAW_FISH)); +// break; +// case 24: +// if(LoadProperties.diamondArmor && LoadProperties.fishingDrops) +// theCatch.setItemStack(new ItemStack(Material.DIAMOND_BOOTS, 1)); +// else +// theCatch.setItemStack(new ItemStack(Material.RAW_FISH)); +// break; +// case 25: +// if(LoadProperties.diamondArmor && LoadProperties.fishingDrops) +// theCatch.setItemStack(new ItemStack(Material.DIAMOND_HELMET, 1)); +// else +// theCatch.setItemStack(new ItemStack(Material.RAW_FISH)); +// break; +// case 26: +// if(LoadProperties.diamondArmor && LoadProperties.fishingDrops) +// theCatch.setItemStack(new ItemStack(Material.DIAMOND_LEGGINGS, 1)); +// else +// theCatch.setItemStack(new ItemStack(Material.RAW_FISH)); +// break; +// case 27: +// if(LoadProperties.diamondArmor && LoadProperties.fishingDrops) +// theCatch.setItemStack(new ItemStack(Material.DIAMOND_CHESTPLATE, 1)); +// else +// theCatch.setItemStack(new ItemStack(Material.RAW_FISH)); +// break; +// case 28: +// if(LoadProperties.diamondTools && LoadProperties.fishingDrops) +// theCatch.setItemStack(new ItemStack(Material.DIAMOND_AXE, 1)); +// else +// theCatch.setItemStack(new ItemStack(Material.RAW_FISH)); +// break; +// case 29: +// if(LoadProperties.diamondTools && LoadProperties.fishingDrops) +// theCatch.setItemStack(new ItemStack(Material.DIAMOND_PICKAXE, 1)); +// else +// theCatch.setItemStack(new ItemStack(Material.RAW_FISH)); +// break; +// case 30: +// if(LoadProperties.diamondTools && LoadProperties.fishingDrops) +// theCatch.setItemStack(new ItemStack(Material.DIAMOND_SWORD, 1)); +// else +// theCatch.setItemStack(new ItemStack(Material.RAW_FISH)); +// break; +// case 31: +// if(LoadProperties.diamondTools && LoadProperties.fishingDrops) +// theCatch.setItemStack(new ItemStack(Material.DIAMOND_HOE, 1)); +// else +// theCatch.setItemStack(new ItemStack(Material.RAW_FISH)); +// break; +// case 32: +// if(LoadProperties.diamondTools && LoadProperties.fishingDrops) +// theCatch.setItemStack(new ItemStack(Material.DIAMOND_SPADE, 1)); +// else +// theCatch.setItemStack(new ItemStack(Material.RAW_FISH)); +// break; +// case 33: +// if(LoadProperties.records && LoadProperties.fishingDrops) +// theCatch.setItemStack(new ItemStack(Material.RECORD_6, 1)); +// else +// theCatch.setItemStack(new ItemStack(Material.RAW_FISH)); +// break; +// case 34: +// if(LoadProperties.records && LoadProperties.fishingDrops) +// theCatch.setItemStack(new ItemStack(Material.RECORD_7, 1)); +// else +// theCatch.setItemStack(new ItemStack(Material.RAW_FISH)); +// break; +// case 35: +// if(LoadProperties.records && LoadProperties.fishingDrops) +// theCatch.setItemStack(new ItemStack(Material.RECORD_8, 1)); +// else +// theCatch.setItemStack(new ItemStack(Material.RAW_FISH)); +// break; +// case 36: +// if(LoadProperties.records && LoadProperties.fishingDrops) +// theCatch.setItemStack(new ItemStack(Material.RECORD_9, 1)); +// else +// theCatch.setItemStack(new ItemStack(Material.RAW_FISH)); +// break; +// case 37: +// if(LoadProperties.records && LoadProperties.fishingDrops) +// theCatch.setItemStack(new ItemStack(Material.RECORD_10, 1)); +// else +// theCatch.setItemStack(new ItemStack(Material.RAW_FISH)); +// break; +// case 38: +// if(LoadProperties.records && LoadProperties.fishingDrops) +// theCatch.setItemStack(new ItemStack(Material.RECORD_11, 1)); +// else +// theCatch.setItemStack(new ItemStack(Material.RAW_FISH)); +// break; +// case 39: +// if(LoadProperties.glowstoneDust && LoadProperties.fishingDrops) +// theCatch.setItemStack(new ItemStack(Material.GLOWSTONE_DUST, 16)); +// else +// theCatch.setItemStack(new ItemStack(Material.RAW_FISH)); +// break; +// case 40: +// if(LoadProperties.fishingDiamonds && LoadProperties.fishingDrops) +// theCatch.setItemStack(new ItemStack(Material.DIAMOND, (int)(Math.random() * 20))); +// else +// theCatch.setItemStack(new ItemStack(Material.RAW_FISH)); +// break; +// case 41: +// if(LoadProperties.diamondArmor && LoadProperties.fishingDrops) +// theCatch.setItemStack(new ItemStack(Material.DIAMOND_BOOTS, 1)); +// else +// theCatch.setItemStack(new ItemStack(Material.RAW_FISH)); +// break; +// case 42: +// if(LoadProperties.diamondArmor && LoadProperties.fishingDrops) +// theCatch.setItemStack(new ItemStack(Material.DIAMOND_HELMET, 1)); +// else +// theCatch.setItemStack(new ItemStack(Material.RAW_FISH)); +// break; +// case 43: +// if(LoadProperties.diamondArmor && LoadProperties.fishingDrops) +// theCatch.setItemStack(new ItemStack(Material.DIAMOND_LEGGINGS, 1)); +// else +// theCatch.setItemStack(new ItemStack(Material.RAW_FISH)); +// break; +// case 44: +// if(LoadProperties.diamondArmor && LoadProperties.fishingDrops) +// theCatch.setItemStack(new ItemStack(Material.DIAMOND_CHESTPLATE, 1)); +// else +// theCatch.setItemStack(new ItemStack(Material.RAW_FISH)); +// break; +// case 45: +// if(LoadProperties.diamondTools && LoadProperties.fishingDrops) +// theCatch.setItemStack(new ItemStack(Material.DIAMOND_AXE, 1)); +// else +// theCatch.setItemStack(new ItemStack(Material.RAW_FISH)); +// break; +// case 46: +// if(LoadProperties.diamondTools && LoadProperties.fishingDrops) +// theCatch.setItemStack(new ItemStack(Material.DIAMOND_PICKAXE, 1)); +// else +// theCatch.setItemStack(new ItemStack(Material.RAW_FISH)); +// break; +// case 47: +// if(LoadProperties.diamondTools && LoadProperties.fishingDrops) +// theCatch.setItemStack(new ItemStack(Material.DIAMOND_SWORD, 1)); +// else +// theCatch.setItemStack(new ItemStack(Material.RAW_FISH)); +// break; +// case 48: +// if(LoadProperties.diamondTools && LoadProperties.fishingDrops) +// theCatch.setItemStack(new ItemStack(Material.DIAMOND_HOE, 1)); +// else +// theCatch.setItemStack(new ItemStack(Material.RAW_FISH)); +// break; +// case 49: +// if(LoadProperties.diamondTools && LoadProperties.fishingDrops) +// theCatch.setItemStack(new ItemStack(Material.DIAMOND_SPADE, 1)); +// else +// theCatch.setItemStack(new ItemStack(Material.RAW_FISH)); +// break; +// } +// } else { +// theCatch.setItemStack(new ItemStack(Material.RAW_FISH, 1)); +// } +// //Change durability to random value +// theCatch.getItemStack().setDurability((short) (Math.random() * theCatch.getItemStack().getType().getMaxDurability())); //Change the damage value } public static void processResults(PlayerFishEvent event) { diff --git a/src/main/resources/config.yml b/src/main/resources/config.yml index 684e22847..067a55e5b 100644 --- a/src/main/resources/config.yml +++ b/src/main/resources/config.yml @@ -215,6 +215,11 @@ Experience: # Settings for Fishing ### Fishing: + Drop_Level: + Tier1: 200 + Tier2: 400 + Tier3: 600 + Tier4: 800 Drops: Item_Drops_Enabled: true Drop_Chance: