mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-26 23:26:45 +01:00
Fixed bug where Skull Splitter would be applied twice.
This commit is contained in:
parent
38a8a6f2ff
commit
0262255bea
@ -4,6 +4,7 @@ import org.bukkit.entity.Player;
|
|||||||
import org.bukkit.entity.Tameable;
|
import org.bukkit.entity.Tameable;
|
||||||
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
||||||
|
|
||||||
|
import com.gmail.nossr50.datatypes.AbilityType;
|
||||||
import com.gmail.nossr50.datatypes.SkillType;
|
import com.gmail.nossr50.datatypes.SkillType;
|
||||||
import com.gmail.nossr50.skills.SkillManager;
|
import com.gmail.nossr50.skills.SkillManager;
|
||||||
import com.gmail.nossr50.util.Misc;
|
import com.gmail.nossr50.util.Misc;
|
||||||
@ -89,7 +90,7 @@ public class AxeManager extends SkillManager {
|
|||||||
* @param event The event to process
|
* @param event The event to process
|
||||||
*/
|
*/
|
||||||
public void skullSplitter(EntityDamageByEntityEvent event) {
|
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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3,6 +3,7 @@ package com.gmail.nossr50.skills.swords;
|
|||||||
import org.bukkit.entity.LivingEntity;
|
import org.bukkit.entity.LivingEntity;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
import com.gmail.nossr50.datatypes.AbilityType;
|
||||||
import com.gmail.nossr50.datatypes.SkillType;
|
import com.gmail.nossr50.datatypes.SkillType;
|
||||||
import com.gmail.nossr50.skills.SkillManager;
|
import com.gmail.nossr50.skills.SkillManager;
|
||||||
import com.gmail.nossr50.util.Combat;
|
import com.gmail.nossr50.util.Combat;
|
||||||
@ -76,7 +77,7 @@ public class SwordsManager extends SkillManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void serratedStrikes(LivingEntity target, int damage) {
|
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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -61,7 +61,6 @@ public class Combat {
|
|||||||
case PLAYER:
|
case PLAYER:
|
||||||
Player attacker = (Player) event.getDamager();
|
Player attacker = (Player) event.getDamager();
|
||||||
ItemStack itemInHand = attacker.getItemInHand();
|
ItemStack itemInHand = attacker.getItemInHand();
|
||||||
PlayerProfile attackerProfile = Users.getProfile(attacker);
|
|
||||||
|
|
||||||
if (ItemChecks.isSword(itemInHand)) {
|
if (ItemChecks.isSword(itemInHand)) {
|
||||||
if (targetIsPlayer || targetIsTamedPet) {
|
if (targetIsPlayer || targetIsTamedPet) {
|
||||||
@ -76,14 +75,10 @@ public class Combat {
|
|||||||
Skills.abilityCheck(attacker, SkillType.SWORDS);
|
Skills.abilityCheck(attacker, SkillType.SWORDS);
|
||||||
|
|
||||||
SwordsManager swordsManager = new SwordsManager(attacker);
|
SwordsManager swordsManager = new SwordsManager(attacker);
|
||||||
|
|
||||||
swordsManager.bleedCheck(target);
|
swordsManager.bleedCheck(target);
|
||||||
|
|
||||||
if (attackerProfile.getAbilityMode(AbilityType.SERRATED_STRIKES)) {
|
|
||||||
swordsManager.serratedStrikes(target, event.getDamage());
|
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)) {
|
else if (ItemChecks.isAxe(itemInHand) && Permissions.axes(attacker)) {
|
||||||
if (targetIsPlayer || targetIsTamedPet) {
|
if (targetIsPlayer || targetIsTamedPet) {
|
||||||
@ -96,18 +91,14 @@ public class Combat {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Skills.abilityCheck(attacker, SkillType.AXES);
|
Skills.abilityCheck(attacker, SkillType.AXES);
|
||||||
AxeManager axeManager = new AxeManager(attacker);
|
|
||||||
|
|
||||||
|
AxeManager axeManager = new AxeManager(attacker);
|
||||||
axeManager.bonusDamage(event);
|
axeManager.bonusDamage(event);
|
||||||
axeManager.criticalHitCheck(event);
|
axeManager.criticalHitCheck(event);
|
||||||
axeManager.impact(event);
|
axeManager.impact(event);
|
||||||
|
|
||||||
if (attackerProfile.getAbilityMode(AbilityType.SKULL_SPLIITER)) {
|
|
||||||
axeManager.skullSplitter(event);
|
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)) {
|
else if (itemInHand.getType() == Material.AIR && Permissions.unarmed(attacker)) {
|
||||||
if (targetIsPlayer || targetIsTamedPet) {
|
if (targetIsPlayer || targetIsTamedPet) {
|
||||||
@ -125,7 +116,7 @@ public class Combat {
|
|||||||
|
|
||||||
unarmedManager.bonusDamage(event);
|
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));
|
event.setDamage((int) (event.getDamage() * 1.5));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -133,7 +124,7 @@ public class Combat {
|
|||||||
unarmedManager.disarmCheck((Player) target);
|
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) {
|
else if (itemInHand.getType() == Material.BONE && target instanceof Tameable) {
|
||||||
TamingManager tamingManager = new TamingManager(attacker);
|
TamingManager tamingManager = new TamingManager(attacker);
|
||||||
|
Loading…
Reference in New Issue
Block a user