From d1041c30db95d3aa279f3a04270fd7a5587dd11a Mon Sep 17 00:00:00 2001 From: GJ Date: Tue, 27 Mar 2012 07:51:30 -0400 Subject: [PATCH] Fixed IllegalArguementException in Fishing when the result stack didn't have a max durability. --- src/main/java/com/gmail/nossr50/skills/Fishing.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/gmail/nossr50/skills/Fishing.java b/src/main/java/com/gmail/nossr50/skills/Fishing.java index cf1a09cfd..e5cad6602 100644 --- a/src/main/java/com/gmail/nossr50/skills/Fishing.java +++ b/src/main/java/com/gmail/nossr50/skills/Fishing.java @@ -109,7 +109,11 @@ public class Fishing { theCatch.setItemStack(new ItemStack(Material.RAW_FISH)); } - theCatch.getItemStack().setDurability((short) (random.nextInt(theCatch.getItemStack().getType().getMaxDurability()))); //Change durability to random value + short maxDurability = theCatch.getItemStack().getType().getMaxDurability(); + + if (maxDurability > 0) { + theCatch.getItemStack().setDurability((short) (random.nextInt(maxDurability))); //Change durability to random value + } m.mcDropItem(player.getLocation(), new ItemStack(Material.RAW_FISH)); //Always drop a fish PP.addXP(SkillType.FISHING, LoadProperties.mfishing, player);