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

Fixes #678
This commit is contained in:
GJ 2013-02-13 12:10:10 -05:00
parent 7110e6ec3d
commit 8312570825
3 changed files with 7 additions and 4 deletions

View File

@ -31,6 +31,7 @@ Version 1.4.00-dev
+ Added the "wait" music disc to the default fishing treasures + Added the "wait" music disc to the default fishing treasures
+ Added "Chinese (Taiwan)" localization files (zh_TW) + Added "Chinese (Taiwan)" localization files (zh_TW)
+ Added '/hardcore' and '/vampirism' commands for toggling these modes on or off. + 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 /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 the durability of non-armor equipped blocks
= Fixed Impact reducing improperly the durability of armors (as a consequence it is now more effective) = Fixed Impact reducing improperly the durability of armors (as a consequence it is now more effective)

View File

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

View File

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