From 8312570825311e5291da8e0bdd8c84f07278cd6d Mon Sep 17 00:00:00 2001 From: GJ Date: Wed, 13 Feb 2013 12:10:10 -0500 Subject: [PATCH] Fixed bug where splash potions could raise a player's unarmed level. Fixes #678 --- Changelog.txt | 1 + .../java/com/gmail/nossr50/listeners/EntityListener.java | 1 + .../com/gmail/nossr50/skills/utilities/CombatTools.java | 9 +++++---- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/Changelog.txt b/Changelog.txt index 7c56a7603..090d58fdf 100644 --- a/Changelog.txt +++ b/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) diff --git a/src/main/java/com/gmail/nossr50/listeners/EntityListener.java b/src/main/java/com/gmail/nossr50/listeners/EntityListener.java index d313d8a18..b0ffc55cd 100644 --- a/src/main/java/com/gmail/nossr50/listeners/EntityListener.java +++ b/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; diff --git a/src/main/java/com/gmail/nossr50/skills/utilities/CombatTools.java b/src/main/java/com/gmail/nossr50/skills/utilities/CombatTools.java index c9665c4d9..9b36770e7 100644 --- a/src/main/java/com/gmail/nossr50/skills/utilities/CombatTools.java +++ b/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);