diff --git a/src/main/java/com/gmail/nossr50/mcMMO.java b/src/main/java/com/gmail/nossr50/mcMMO.java index 849ccada0..53bb4f5a7 100644 --- a/src/main/java/com/gmail/nossr50/mcMMO.java +++ b/src/main/java/com/gmail/nossr50/mcMMO.java @@ -14,8 +14,6 @@ import org.bukkit.plugin.PluginDescriptionFile; import org.bukkit.plugin.PluginManager; import org.bukkit.plugin.java.JavaPlugin; import org.bukkit.scheduler.BukkitScheduler; -import org.bukkit.World; - import com.gmail.nossr50.commands.general.AddlevelsCommand; import com.gmail.nossr50.commands.general.AddxpCommand; import com.gmail.nossr50.commands.general.InspectCommand; diff --git a/src/main/java/com/gmail/nossr50/skills/gathering/Fishing.java b/src/main/java/com/gmail/nossr50/skills/gathering/Fishing.java index 858464fb5..f110636aa 100755 --- a/src/main/java/com/gmail/nossr50/skills/gathering/Fishing.java +++ b/src/main/java/com/gmail/nossr50/skills/gathering/Fishing.java @@ -1,6 +1,5 @@ package com.gmail.nossr50.skills.gathering; -import java.lang.reflect.Method; import java.util.ArrayList; import java.util.List; import java.util.Map; @@ -14,6 +13,8 @@ import org.bukkit.entity.Item; import org.bukkit.entity.LivingEntity; import org.bukkit.entity.Player; import org.bukkit.entity.Sheep; +import org.bukkit.entity.Skeleton; +import org.bukkit.entity.Skeleton.SkeletonType; import org.bukkit.event.player.PlayerFishEvent; import org.bukkit.inventory.ItemStack; import org.bukkit.material.Wool; @@ -261,7 +262,7 @@ public class Fishing { break; case CREEPER: - if (DROP_NUMBER > 95) { + if (DROP_NUMBER > 97) { Misc.dropItem(location, new ItemStack(Material.SKULL_ITEM, 1, (short) 4)); } else { Misc.dropItem(location, new ItemStack(Material.SULPHUR)); @@ -281,7 +282,7 @@ public class Fishing { break; case IRON_GOLEM: - if (DROP_NUMBER > 95) { + if (DROP_NUMBER > 97) { Misc.dropItem(location, new ItemStack(Material.PUMPKIN)); } else if (DROP_NUMBER > 85) { Misc.dropItem(location, new ItemStack(Material.IRON_INGOT)); @@ -337,29 +338,8 @@ public class Fishing { break; case SKELETON: - Object o; - Class c; - Method m; - - o = le; - c = o.getClass(); - - boolean isWitherSkeleton = false; - - try { - m = c.getDeclaredMethod("getHandle"); - o = m.invoke(o); - - c = o.getClass(); - m = c.getDeclaredMethod("getSkeletonType"); - o = m.invoke(o); - - if(o instanceof Integer) - isWitherSkeleton = (((Integer) o) == 1); - } catch(Exception e) {} - - if (isWitherSkeleton) { - if (DROP_NUMBER > 95) { + if (((Skeleton)le).getSkeletonType() == SkeletonType.WITHER) { + if (DROP_NUMBER > 97) { Misc.dropItem(location, new ItemStack(Material.SKULL_ITEM, 1, (short) 1)); } else if (DROP_NUMBER > 50) { Misc.dropItem(location, new ItemStack(Material.BONE)); @@ -368,7 +348,7 @@ public class Fishing { Misc.randomDropItems(location, new ItemStack(Material.COAL), 50, 2); } } else { - if (DROP_NUMBER > 95) { + if (DROP_NUMBER > 97) { Misc.dropItem(location, new ItemStack(Material.SKULL_ITEM)); } else if (DROP_NUMBER > 50) { Misc.dropItem(location, new ItemStack(Material.BONE)); @@ -384,7 +364,7 @@ public class Fishing { break; case SNOWMAN: - if (DROP_NUMBER > 95) { + if (DROP_NUMBER > 97) { Misc.dropItem(location, new ItemStack(Material.PUMPKIN)); } else { Misc.dropItem(location, new ItemStack(Material.SNOW_BALL)); @@ -401,7 +381,7 @@ public class Fishing { break; case SQUID: - Misc.dropItem(location, new ItemStack(Material.INK_SACK, 1, (short) 0, (byte) 0x0)); + Misc.dropItem(location, new ItemStack(Material.INK_SACK, 1, (short) 0)); break; case WITCH: @@ -436,7 +416,7 @@ public class Fishing { break; case ZOMBIE: - if (DROP_NUMBER > 95) { + if (DROP_NUMBER > 97) { Misc.dropItem(location, new ItemStack(Material.SKULL_ITEM, 1, (short) 2)); } else { Misc.dropItem(location, new ItemStack(Material.ROTTEN_FLESH)); diff --git a/src/main/java/com/gmail/nossr50/skills/repair/Repair.java b/src/main/java/com/gmail/nossr50/skills/repair/Repair.java index 87ac93bdf..eeedf2e9b 100644 --- a/src/main/java/com/gmail/nossr50/skills/repair/Repair.java +++ b/src/main/java/com/gmail/nossr50/skills/repair/Repair.java @@ -210,12 +210,12 @@ public class Repair { * @return The final amount of durability repaired to the item */ protected static short repairCalculate(Player player, int skillLevel, short durability, int repairAmount) { - double bonus; - if(skillLevel >= repairMasteryMaxBonusLevel) bonus = (double) repairMasteryChanceMax; - else bonus = ((double) skillLevel / (double) repairMasteryMaxBonusLevel) * (double) repairMasteryChanceMax; + float bonus; + if(skillLevel >= repairMasteryMaxBonusLevel) bonus = repairMasteryChanceMax; + else bonus = (skillLevel / repairMasteryMaxBonusLevel) * repairMasteryChanceMax; if (permInstance.repairMastery(player)) { - bonus = ((double) repairAmount * bonus); + bonus = (repairAmount * bonus); repairAmount += (int) bonus; } diff --git a/src/main/java/com/gmail/nossr50/skills/repair/Salvage.java b/src/main/java/com/gmail/nossr50/skills/repair/Salvage.java index a67fea83b..e2bfa534e 100644 --- a/src/main/java/com/gmail/nossr50/skills/repair/Salvage.java +++ b/src/main/java/com/gmail/nossr50/skills/repair/Salvage.java @@ -1,8 +1,8 @@ package com.gmail.nossr50.skills.repair; +import org.bukkit.GameMode; import org.bukkit.Location; import org.bukkit.Material; -import org.bukkit.World; import org.bukkit.entity.Player; import org.bukkit.inventory.ItemStack; import org.getspout.spoutapi.SpoutManager; @@ -14,6 +14,7 @@ import com.gmail.nossr50.datatypes.PlayerProfile; import com.gmail.nossr50.datatypes.SkillType; import com.gmail.nossr50.locale.LocaleLoader; import com.gmail.nossr50.util.ItemChecks; +import com.gmail.nossr50.util.Misc; import com.gmail.nossr50.util.Permissions; import com.gmail.nossr50.util.Users; @@ -27,13 +28,12 @@ public class Salvage { return; } - if (player.getGameMode().equals(0)){ + if(player.getGameMode() == GameMode.SURVIVAL) { final PlayerProfile profile = Users.getProfile(player); final int skillLevel = profile.getSkillLevel(SkillType.REPAIR); final int unlockLevel = configInstance.getSalvageUnlockLevel(); if (skillLevel >= unlockLevel) { - final World world = player.getWorld(); final float currentdura = inHand.getDurability(); if (currentdura == 0) { @@ -42,7 +42,7 @@ public class Salvage { player.setItemInHand(new ItemStack(0)); location.setY(location.getY() + 1); - world.dropItem(location, new ItemStack(itemID, salvagedAmount)); + Misc.dropItem(location, new ItemStack(itemID, salvagedAmount)); player.sendMessage(LocaleLoader.getString("Repair.Skills.SalvageSuccess")); } else { player.sendMessage(LocaleLoader.getString("Repair.Skills.NotFullDurability"));