Browse Source

Fixed bug where fired arrows could raise skill levels other than Archery

GJ 12 years ago
parent
commit
0879e1f326

+ 1 - 0
Changelog.txt

@@ -32,6 +32,7 @@ Version 1.4.00-dev
  + Added "Chinese (Taiwan)" localization files (zh_TW)
  + Added '/hardcore' and '/vampirism' commands for toggling these modes on or off.
  = Fixed bug where splash potions could raise a player's unarmed level
+ = Fixed bug where fired arrows could raise skill levels other than Archery
  = Fixed /ptp telporting the target to the player, rather than the other way around.
  = Fixed Impact reducing the durability of non-armor equipped blocks
  = Fixed Impact reducing improperly the durability of armors (as a consequence it is now more effective)

+ 4 - 4
src/main/java/com/gmail/nossr50/skills/utilities/CombatTools.java

@@ -72,7 +72,7 @@ public final class CombatTools {
             Material heldItemType = heldItem.getType();
             DamageCause damageCause = event.getCause();
 
-            if (ItemChecks.isSword(heldItem) && damageCause != DamageCause.MAGIC) {
+            if (ItemChecks.isSword(heldItem) && damageCause == DamageCause.ENTITY_ATTACK) {
                 if (targetIsPlayer || targetIsTamedPet) {
                     if (!Swords.pvpEnabled) {
                         return;
@@ -103,7 +103,7 @@ public final class CombatTools {
                     startGainXp(mcMMOPlayer, target, SkillType.SWORDS);
                 }
             }
-            else if (ItemChecks.isAxe(heldItem) && damageCause != DamageCause.MAGIC) {
+            else if (ItemChecks.isAxe(heldItem) && damageCause == DamageCause.ENTITY_ATTACK) {
                 if (targetIsPlayer || targetIsTamedPet) {
                     if (!Axes.pvpEnabled) {
                         return;
@@ -141,7 +141,7 @@ public final class CombatTools {
                     startGainXp(mcMMOPlayer, target, SkillType.AXES);
                 }
             }
-            else if (heldItemType == Material.AIR && damageCause != DamageCause.MAGIC) {
+            else if (heldItemType == Material.AIR && damageCause == DamageCause.ENTITY_ATTACK) {
                 if (targetIsPlayer || targetIsTamedPet) {
                     if (!configInstance.getUnarmedPVP()) {
                         return;
@@ -176,7 +176,7 @@ public final class CombatTools {
                     startGainXp(mcMMOPlayer, target, SkillType.UNARMED);
                 }
             }
-            else if (heldItemType == Material.BONE && target instanceof Tameable && Permissions.beastLore(player) && damageCause != DamageCause.MAGIC) {
+            else if (heldItemType == Material.BONE && target instanceof Tameable && Permissions.beastLore(player) && damageCause == DamageCause.ENTITY_ATTACK) {
                 TamingManager tamingManager = new TamingManager(Users.getPlayer(player));
                 tamingManager.beastLore(target);
                 event.setCancelled(true);