From 78d2fa752084a6a47bb048e3fa8314765ea8df2d Mon Sep 17 00:00:00 2001 From: GJ Date: Tue, 9 Apr 2013 16:51:33 -0400 Subject: [PATCH] Only care if it was unarmed. --- .../gmail/nossr50/datatypes/player/McMMOPlayer.java | 12 ++++-------- .../com/gmail/nossr50/listeners/PlayerListener.java | 2 +- .../java/com/gmail/nossr50/party/ShareHandler.java | 1 - 3 files changed, 5 insertions(+), 10 deletions(-) diff --git a/src/main/java/com/gmail/nossr50/datatypes/player/McMMOPlayer.java b/src/main/java/com/gmail/nossr50/datatypes/player/McMMOPlayer.java index e54f367dd..6b5a6bdde 100644 --- a/src/main/java/com/gmail/nossr50/datatypes/player/McMMOPlayer.java +++ b/src/main/java/com/gmail/nossr50/datatypes/player/McMMOPlayer.java @@ -85,7 +85,7 @@ public class McMMOPlayer { private int recentlyHurt; private int respawnATS; - private SkillType lastGained; + private boolean isUsingUnarmed; public McMMOPlayer(Player player) { String playerName = player.getName(); @@ -493,7 +493,7 @@ public class McMMOPlayer { spoutHud.setLastGained(skillType); } - lastGained = skillType; + isUsingUnarmed = skillType == SkillType.UNARMED; SkillUtils.xpCheckSkill(skillType, player, profile); } @@ -645,12 +645,8 @@ public class McMMOPlayer { partyChatMode = !partyChatMode; } - public SkillType getLastGained() { - return lastGained; - } - - public void setLastGained(SkillType type) { - this.lastGained = type; + public boolean isUsingUnarmed() { + return isUsingUnarmed; } /** diff --git a/src/main/java/com/gmail/nossr50/listeners/PlayerListener.java b/src/main/java/com/gmail/nossr50/listeners/PlayerListener.java index e6a7b2444..15fe49dde 100644 --- a/src/main/java/com/gmail/nossr50/listeners/PlayerListener.java +++ b/src/main/java/com/gmail/nossr50/listeners/PlayerListener.java @@ -223,7 +223,7 @@ public class PlayerListener implements Listener { PlayerInventory inventory = player.getInventory(); int firstEmpty = inventory.firstEmpty(); - if (mcMMOPlayer.getLastGained() == SkillType.UNARMED && ItemUtils.isShareable(dropStack) && firstEmpty == inventory.getHeldItemSlot()) { + if (mcMMOPlayer.isUsingUnarmed() && ItemUtils.isShareable(dropStack) && firstEmpty == inventory.getHeldItemSlot()) { int nextSlot = firstEmpty + 1; for (Iterator iterator = inventory.iterator(nextSlot); iterator.hasNext();) { diff --git a/src/main/java/com/gmail/nossr50/party/ShareHandler.java b/src/main/java/com/gmail/nossr50/party/ShareHandler.java index 74c3cfe65..d67242c8a 100644 --- a/src/main/java/com/gmail/nossr50/party/ShareHandler.java +++ b/src/main/java/com/gmail/nossr50/party/ShareHandler.java @@ -4,7 +4,6 @@ import java.util.List; import org.bukkit.entity.Item; import org.bukkit.entity.Player; -import org.bukkit.event.player.PlayerPickupItemEvent; import org.bukkit.inventory.ItemStack; import com.gmail.nossr50.config.Config;