Ver código fonte

Fixed bug where splash potions could raise a player's unarmed level.
Fixes #678

GJ 12 anos atrás
pai
commit
8312570825

+ 1 - 0
Changelog.txt

@@ -31,6 +31,7 @@ Version 1.4.00-dev
  + Added the "wait" music disc to the default fishing treasures
  + 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 /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)

+ 1 - 0
src/main/java/com/gmail/nossr50/listeners/EntityListener.java

@@ -4,6 +4,7 @@ import org.bukkit.Material;
 import org.bukkit.block.Block;
 import org.bukkit.entity.AnimalTamer;
 import org.bukkit.entity.Entity;
+import org.bukkit.entity.EntityType;
 import org.bukkit.entity.FallingBlock;
 import org.bukkit.entity.LivingEntity;
 import org.bukkit.entity.Player;

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

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