From 8ed269631569071d6130b520668eb8e084091f88 Mon Sep 17 00:00:00 2001 From: GJ Date: Tue, 12 Jun 2012 15:11:13 -0400 Subject: [PATCH] Fix issue with trying to remove all of the item in hand. --- .../skills/taming/CallOfTheWildEventHandler.java | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/gmail/nossr50/skills/taming/CallOfTheWildEventHandler.java b/src/main/java/com/gmail/nossr50/skills/taming/CallOfTheWildEventHandler.java index 2086ac7ce..4365b0dac 100644 --- a/src/main/java/com/gmail/nossr50/skills/taming/CallOfTheWildEventHandler.java +++ b/src/main/java/com/gmail/nossr50/skills/taming/CallOfTheWildEventHandler.java @@ -1,6 +1,7 @@ package com.gmail.nossr50.skills.taming; import org.bukkit.ChatColor; +import org.bukkit.Material; import org.bukkit.entity.Entity; import org.bukkit.entity.EntityType; import org.bukkit.entity.LivingEntity; @@ -68,7 +69,14 @@ public class CallOfTheWildEventHandler { } protected void processResourceCost() { - player.getItemInHand().setAmount(inHand.getAmount() - summonAmount); + int newAmount = inHand.getAmount() - summonAmount; + + if (newAmount == 0) { + player.setItemInHand(new ItemStack(Material.AIR)); + } + else { + player.getItemInHand().setAmount(inHand.getAmount() - summonAmount); + } } protected void sendSuccessMessage() {