From 2be3e3b43c9d0497fc0138ed62f94e21c75e22f1 Mon Sep 17 00:00:00 2001 From: GJ Date: Tue, 16 Apr 2013 23:44:41 -0400 Subject: [PATCH] Changed Berserk to add items to inventory rather than denying pickup --- Changelog.txt | 1 + .../com/gmail/nossr50/commands/McrefreshCommand.java | 1 - .../com/gmail/nossr50/listeners/PlayerListener.java | 10 +--------- .../java/com/gmail/nossr50/util/skills/SkillUtils.java | 10 ++-------- 4 files changed, 4 insertions(+), 18 deletions(-) diff --git a/Changelog.txt b/Changelog.txt index 437afa83f..992f42112 100644 --- a/Changelog.txt +++ b/Changelog.txt @@ -22,6 +22,7 @@ Version 1.4.06-dev = Fixed bug where experience commands were adding levels to all skills when they shouldn't = Fixed mcmmo.commands.ptp.send not being set by default = Fixed NPE when trying to tab-complete /mctop + ! Changed Berserk to add items to inventory rather than denying pickup ! Changed Chimaera Wing's recipe result to use the ingredient Material ! Players will no longer pickup items to their hotbar while using Unarmed ! ExperienceAPI methods will now throw InvalidSkillException if the skill name passed in is invalid. diff --git a/src/main/java/com/gmail/nossr50/commands/McrefreshCommand.java b/src/main/java/com/gmail/nossr50/commands/McrefreshCommand.java index f743c5f9b..ea1cbec18 100644 --- a/src/main/java/com/gmail/nossr50/commands/McrefreshCommand.java +++ b/src/main/java/com/gmail/nossr50/commands/McrefreshCommand.java @@ -23,7 +23,6 @@ public class McrefreshCommand extends ToggleCommand { mcMMOPlayer.resetToolPrepMode(); mcMMOPlayer.resetAbilityMode(); - player.setCanPickupItems(true); player.sendMessage(LocaleLoader.getString("Ability.Generic.Refresh")); } diff --git a/src/main/java/com/gmail/nossr50/listeners/PlayerListener.java b/src/main/java/com/gmail/nossr50/listeners/PlayerListener.java index e4b8a116f..40c0959e8 100644 --- a/src/main/java/com/gmail/nossr50/listeners/PlayerListener.java +++ b/src/main/java/com/gmail/nossr50/listeners/PlayerListener.java @@ -242,7 +242,7 @@ public class PlayerListener implements Listener { } } - if (mcMMOPlayer.isUsingUnarmed() && ItemUtils.isShareable(dropStack)) { + if ((mcMMOPlayer.isUsingUnarmed() && ItemUtils.isShareable(dropStack)) || mcMMOPlayer.getAbilityMode(AbilityType.BERSERK)) { event.setCancelled(Unarmed.handleItemPickup(player.getInventory(), drop)); if (event.isCancelled()) { @@ -265,10 +265,6 @@ public class PlayerListener implements Listener { return; } - if (UserManager.getPlayer(player).getAbilityMode(AbilityType.BERSERK)) { - player.setCanPickupItems(true); - } - /* GARBAGE COLLECTION */ BleedTimerTask.bleedOut(player); // Bleed it out } @@ -282,10 +278,6 @@ public class PlayerListener implements Listener { public void onPlayerJoin(PlayerJoinEvent event) { Player player = event.getPlayer(); - if (UserManager.getPlayer(player).getAbilityMode(AbilityType.BERSERK)) { - player.setCanPickupItems(false); - } - if (Config.getInstance().getMOTDEnabled() && Permissions.motd(player)) { Motd.displayAll(player); } diff --git a/src/main/java/com/gmail/nossr50/util/skills/SkillUtils.java b/src/main/java/com/gmail/nossr50/util/skills/SkillUtils.java index e84d9eac5..26d92e8e2 100644 --- a/src/main/java/com/gmail/nossr50/util/skills/SkillUtils.java +++ b/src/main/java/com/gmail/nossr50/util/skills/SkillUtils.java @@ -180,10 +180,7 @@ public class SkillUtils { if (ability.getPermissions(player)) { if (mcMMOPlayer.getAbilityMode(ability) && (mcMMOPlayer.getProfile().getSkillDATS(ability) * Misc.TIME_CONVERSION_FACTOR) <= curTime) { - if (ability == AbilityType.BERSERK) { - player.setCanPickupItems(true); - } - else if (ability == AbilityType.SUPER_BREAKER || ability == AbilityType.GIGA_DRILL_BREAKER) { + if (ability == AbilityType.SUPER_BREAKER || ability == AbilityType.GIGA_DRILL_BREAKER) { handleAbilitySpeedDecrease(player); } @@ -404,10 +401,7 @@ public class SkillUtils { playerProfile.setSkillDATS(ability, System.currentTimeMillis() + (ticks * Misc.TIME_CONVERSION_FACTOR)); mcMMOPlayer.setAbilityMode(ability, true); - if (ability == AbilityType.BERSERK) { - player.setCanPickupItems(false); - } - else if (ability == AbilityType.SUPER_BREAKER || ability == AbilityType.GIGA_DRILL_BREAKER) { + if (ability == AbilityType.SUPER_BREAKER || ability == AbilityType.GIGA_DRILL_BREAKER) { handleAbilitySpeedIncrease(player); } }