From b779258d695c19c416af8c4b27387d4fba165277 Mon Sep 17 00:00:00 2001 From: bm01 Date: Sun, 3 Mar 2013 14:21:19 +0100 Subject: [PATCH] Fixed Beast Lore not working, fixes #771 --- Changelog.txt | 1 + .../nossr50/util/skills/CombatUtils.java | 22 ++++++++++--------- 2 files changed, 13 insertions(+), 10 deletions(-) diff --git a/Changelog.txt b/Changelog.txt index 4a39677b2..4422da366 100644 --- a/Changelog.txt +++ b/Changelog.txt @@ -16,6 +16,7 @@ Version 1.4.01-dev = Fixed bug where the wrong flag was being set when taking damage = Fixed bug where the PTP cooldown was set improperly = Fixed bug where ptp permissions weren't being handled properly + = Fixed bug where Beast Lore wouldn't work Version 1.4.00 + Added new Child Skill - Smelting! diff --git a/src/main/java/com/gmail/nossr50/util/skills/CombatUtils.java b/src/main/java/com/gmail/nossr50/util/skills/CombatUtils.java index e53aea1d4..c29f367a6 100644 --- a/src/main/java/com/gmail/nossr50/util/skills/CombatUtils.java +++ b/src/main/java/com/gmail/nossr50/util/skills/CombatUtils.java @@ -61,14 +61,19 @@ public final class CombatUtils { return; } - if (target instanceof Tameable && isFriendlyPet(player, (Tameable) target)) { - return; - } - ItemStack heldItem = player.getItemInHand(); - Material heldItemType = heldItem.getType(); - if (ItemUtils.isSword(heldItem)) { + if (target instanceof Tameable) { + if (heldItem.getType() == Material.BONE && Permissions.beastLore(player)) { + SkillManagerStore.getInstance().getTamingManager(player.getName()).beastLore(target); + event.setCancelled(true); + return; + } + else if (isFriendlyPet(player, (Tameable) target)) { + return; + } + } + else if (ItemUtils.isSword(heldItem)) { if (targetIsPlayer || targetIsTamedPet) { if (!SkillType.SWORDS.getPVPEnabled()) { return; @@ -133,7 +138,7 @@ public final class CombatUtils { startGainXp(axeManager.getMcMMOPlayer(), target, SkillType.AXES); } } - else if (heldItemType == Material.AIR) { + else if (heldItem.getType() == Material.AIR) { if (targetIsPlayer || targetIsTamedPet) { if (!SkillType.UNARMED.getPVPEnabled()) { return; @@ -173,9 +178,6 @@ public final class CombatUtils { startGainXp(mcMMOPlayer, target, SkillType.UNARMED); } } - else if (heldItemType == Material.BONE && target instanceof Tameable && Permissions.beastLore(player)) { - SkillManagerStore.getInstance().getTamingManager(player.getName()).beastLore(target); - } } switch (damager.getType()) {