浏览代码

Fixed Beast Lore not working, fixes #771

bm01 12 年之前
父节点
当前提交
b779258d69
共有 2 个文件被更改,包括 13 次插入10 次删除
  1. 1 0
      Changelog.txt
  2. 12 10
      src/main/java/com/gmail/nossr50/util/skills/CombatUtils.java

+ 1 - 0
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!

+ 12 - 10
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()) {