Fixed bug where Skull Splitter would be applied twice.

This commit is contained in:
GJ 2013-01-17 12:04:56 -05:00
parent 38a8a6f2ff
commit 0262255bea
3 changed files with 11 additions and 18 deletions

View File

@ -4,6 +4,7 @@ import org.bukkit.entity.Player;
import org.bukkit.entity.Tameable;
import org.bukkit.event.entity.EntityDamageByEntityEvent;
import com.gmail.nossr50.datatypes.AbilityType;
import com.gmail.nossr50.datatypes.SkillType;
import com.gmail.nossr50.skills.SkillManager;
import com.gmail.nossr50.util.Misc;
@ -89,7 +90,7 @@ public class AxeManager extends SkillManager {
* @param event The event to process
*/
public void skullSplitter(EntityDamageByEntityEvent event) {
if (Misc.isNPC(player) || !Permissions.skullSplitter(player)) {
if (Misc.isNPC(player) || !Permissions.skullSplitter(player) || !profile.getAbilityMode(AbilityType.SKULL_SPLIITER)) {
return;
}

View File

@ -3,6 +3,7 @@ package com.gmail.nossr50.skills.swords;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import com.gmail.nossr50.datatypes.AbilityType;
import com.gmail.nossr50.datatypes.SkillType;
import com.gmail.nossr50.skills.SkillManager;
import com.gmail.nossr50.util.Combat;
@ -76,7 +77,7 @@ public class SwordsManager extends SkillManager {
}
public void serratedStrikes(LivingEntity target, int damage) {
if (Misc.isNPC(player) || !Permissions.serratedStrikes(player)) {
if (Misc.isNPC(player) || !Permissions.serratedStrikes(player) || !profile.getAbilityMode(AbilityType.SERRATED_STRIKES)) {
return;
}

View File

@ -61,7 +61,6 @@ public class Combat {
case PLAYER:
Player attacker = (Player) event.getDamager();
ItemStack itemInHand = attacker.getItemInHand();
PlayerProfile attackerProfile = Users.getProfile(attacker);
if (ItemChecks.isSword(itemInHand)) {
if (targetIsPlayer || targetIsTamedPet) {
@ -76,14 +75,10 @@ public class Combat {
Skills.abilityCheck(attacker, SkillType.SWORDS);
SwordsManager swordsManager = new SwordsManager(attacker);
swordsManager.bleedCheck(target);
swordsManager.serratedStrikes(target, event.getDamage());
if (attackerProfile.getAbilityMode(AbilityType.SERRATED_STRIKES)) {
swordsManager.serratedStrikes(target, event.getDamage());
}
startGainXp(attacker, attackerProfile, target, SkillType.SWORDS);
startGainXp(attacker, swordsManager.getProfile(), target, SkillType.SWORDS);
}
else if (ItemChecks.isAxe(itemInHand) && Permissions.axes(attacker)) {
if (targetIsPlayer || targetIsTamedPet) {
@ -96,18 +91,14 @@ public class Combat {
}
Skills.abilityCheck(attacker, SkillType.AXES);
AxeManager axeManager = new AxeManager(attacker);
AxeManager axeManager = new AxeManager(attacker);
axeManager.bonusDamage(event);
axeManager.criticalHitCheck(event);
axeManager.impact(event);
axeManager.skullSplitter(event);
if (attackerProfile.getAbilityMode(AbilityType.SKULL_SPLIITER)) {
axeManager.skullSplitter(event);
applyAbilityAoE(attacker, target, event.getDamage() / 2, SkillType.AXES);
}
startGainXp(attacker, attackerProfile, target, SkillType.AXES);
startGainXp(attacker, axeManager.getProfile(), target, SkillType.AXES);
}
else if (itemInHand.getType() == Material.AIR && Permissions.unarmed(attacker)) {
if (targetIsPlayer || targetIsTamedPet) {
@ -125,7 +116,7 @@ public class Combat {
unarmedManager.bonusDamage(event);
if (attackerProfile.getAbilityMode(AbilityType.BERSERK) && Permissions.berserk(attacker)) {
if (unarmedManager.getProfile().getAbilityMode(AbilityType.BERSERK) && Permissions.berserk(attacker)) {
event.setDamage((int) (event.getDamage() * 1.5));
}
@ -133,7 +124,7 @@ public class Combat {
unarmedManager.disarmCheck((Player) target);
}
startGainXp(attacker, attackerProfile, target, SkillType.UNARMED);
startGainXp(attacker, unarmedManager.getProfile(), target, SkillType.UNARMED);
}
else if (itemInHand.getType() == Material.BONE && target instanceof Tameable) {
TamingManager tamingManager = new TamingManager(attacker);