mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-12-29 03:57:54 +01:00
We were calling deflect twice. Also made individual functions for each
type of combat.
This commit is contained in:
parent
3f7b17961f
commit
a1792fe125
@ -170,7 +170,7 @@ public class EntityListener implements Listener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
CombatUtils.combatChecks(event, attacker, target);
|
CombatUtils.processCombatAttack(event, attacker, target);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -261,24 +261,25 @@ public class mcMMO extends JavaPlugin {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void checkForUpdates() {
|
private void checkForUpdates() {
|
||||||
if (Config.getInstance().getUpdateCheckEnabled()) {
|
if (!Config.getInstance().getUpdateCheckEnabled()) {
|
||||||
try {
|
return;
|
||||||
updateAvailable = UpdateChecker.updateAvailable();
|
}
|
||||||
}
|
|
||||||
catch (Exception e) {
|
|
||||||
updateAvailable = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (updateAvailable) {
|
try {
|
||||||
getLogger().info(LocaleLoader.getString("UpdateChecker.outdated"));
|
updateAvailable = UpdateChecker.updateAvailable();
|
||||||
getLogger().info(LocaleLoader.getString("UpdateChecker.newavailable"));
|
}
|
||||||
}
|
catch (Exception e) {
|
||||||
|
updateAvailable = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (updateAvailable) {
|
||||||
|
getLogger().info(LocaleLoader.getString("UpdateChecker.outdated"));
|
||||||
|
getLogger().info(LocaleLoader.getString("UpdateChecker.newavailable"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void loadConfigFiles() {
|
private void loadConfigFiles() {
|
||||||
// Force the loading of config files
|
// Force the loading of config files
|
||||||
Config configInstance = Config.getInstance();
|
|
||||||
TreasureConfig.getInstance();
|
TreasureConfig.getInstance();
|
||||||
HiddenConfig.getInstance();
|
HiddenConfig.getInstance();
|
||||||
AdvancedConfig.getInstance();
|
AdvancedConfig.getInstance();
|
||||||
@ -286,19 +287,19 @@ public class mcMMO extends JavaPlugin {
|
|||||||
|
|
||||||
List<Repairable> repairables = new ArrayList<Repairable>();
|
List<Repairable> repairables = new ArrayList<Repairable>();
|
||||||
|
|
||||||
if (configInstance.getToolModsEnabled()) {
|
if (Config.getInstance().getToolModsEnabled()) {
|
||||||
repairables.addAll(CustomToolConfig.getInstance().getLoadedRepairables());
|
repairables.addAll(CustomToolConfig.getInstance().getLoadedRepairables());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (configInstance.getArmorModsEnabled()) {
|
if (Config.getInstance().getArmorModsEnabled()) {
|
||||||
repairables.addAll(CustomArmorConfig.getInstance().getLoadedRepairables());
|
repairables.addAll(CustomArmorConfig.getInstance().getLoadedRepairables());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (configInstance.getBlockModsEnabled()) {
|
if (Config.getInstance().getBlockModsEnabled()) {
|
||||||
CustomBlockConfig.getInstance();
|
CustomBlockConfig.getInstance();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (configInstance.getEntityModsEnabled()) {
|
if (Config.getInstance().getEntityModsEnabled()) {
|
||||||
CustomEntityConfig.getInstance();
|
CustomEntityConfig.getInstance();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -309,21 +310,22 @@ public class mcMMO extends JavaPlugin {
|
|||||||
repairableManager.registerRepairables(repairables);
|
repairableManager.registerRepairables(repairables);
|
||||||
|
|
||||||
// Check if Repair Anvil and Salvage Anvil have different itemID's
|
// Check if Repair Anvil and Salvage Anvil have different itemID's
|
||||||
if (configInstance.getSalvageAnvilId() == configInstance.getRepairAnvilId()) {
|
if (Config.getInstance().getSalvageAnvilId() == Config.getInstance().getRepairAnvilId()) {
|
||||||
getLogger().warning("Can't use the same itemID for Repair/Salvage Anvils!");
|
getLogger().warning("Can't use the same itemID for Repair/Salvage Anvils!");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setupSpout() {
|
private void setupSpout() {
|
||||||
// Check for Spout
|
if (!getServer().getPluginManager().isPluginEnabled("Spout")) {
|
||||||
if (getServer().getPluginManager().isPluginEnabled("Spout")) {
|
return;
|
||||||
spoutEnabled = true;
|
|
||||||
|
|
||||||
SpoutConfig.getInstance();
|
|
||||||
getServer().getPluginManager().registerEvents(new SpoutListener(), this);
|
|
||||||
SpoutUtils.preCacheFiles();
|
|
||||||
SpoutUtils.reloadSpoutPlayers(); // Handle spout players after a /reload
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
spoutEnabled = true;
|
||||||
|
|
||||||
|
SpoutConfig.getInstance();
|
||||||
|
getServer().getPluginManager().registerEvents(new SpoutListener(), this);
|
||||||
|
SpoutUtils.preCacheFiles();
|
||||||
|
SpoutUtils.reloadSpoutPlayers(); // Handle spout players after a /reload
|
||||||
}
|
}
|
||||||
|
|
||||||
private void registerEvents() {
|
private void registerEvents() {
|
||||||
|
@ -46,12 +46,136 @@ import com.gmail.nossr50.util.player.UserManager;
|
|||||||
public final class CombatUtils {
|
public final class CombatUtils {
|
||||||
private CombatUtils() {}
|
private CombatUtils() {}
|
||||||
|
|
||||||
|
private static void processSwordCombat(LivingEntity target, Player player, int damage) {
|
||||||
|
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
|
||||||
|
SwordsManager swordsManager = mcMMOPlayer.getSwordsManager();
|
||||||
|
|
||||||
|
if (swordsManager.canActivateAbility()) {
|
||||||
|
SkillUtils.abilityCheck(mcMMOPlayer, SkillType.SWORDS);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (swordsManager.canUseBleed()) {
|
||||||
|
swordsManager.bleedCheck(target);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (swordsManager.canUseSerratedStrike()) {
|
||||||
|
swordsManager.serratedStrikes(target, damage);
|
||||||
|
}
|
||||||
|
|
||||||
|
startGainXp(mcMMOPlayer, target, SkillType.SWORDS);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void processAxeCombat(LivingEntity target, Player player, EntityDamageByEntityEvent event) {
|
||||||
|
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
|
||||||
|
AxesManager axesManager = mcMMOPlayer.getAxesManager();
|
||||||
|
|
||||||
|
if (axesManager.canActivateAbility()) {
|
||||||
|
SkillUtils.abilityCheck(mcMMOPlayer, SkillType.AXES);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (axesManager.canUseAxeMastery()) {
|
||||||
|
event.setDamage(axesManager.axeMasteryCheck(event.getDamage()));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (axesManager.canCriticalHit(target)) {
|
||||||
|
event.setDamage(axesManager.criticalHitCheck(target, event.getDamage()));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (axesManager.canImpact(target)) {
|
||||||
|
axesManager.impactCheck(target);
|
||||||
|
}
|
||||||
|
else if (axesManager.canGreaterImpact(target)) {
|
||||||
|
event.setDamage(axesManager.greaterImpactCheck(target, event.getDamage()));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (axesManager.canUseSkullSplitter(target)) {
|
||||||
|
axesManager.skullSplitterCheck(target, event.getDamage());
|
||||||
|
}
|
||||||
|
|
||||||
|
startGainXp(mcMMOPlayer, target, SkillType.AXES);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void processUnarmedCombat(LivingEntity target, Player player, EntityDamageByEntityEvent event) {
|
||||||
|
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
|
||||||
|
UnarmedManager unarmedManager = mcMMOPlayer.getUnarmedManager();
|
||||||
|
|
||||||
|
if (unarmedManager.canActivateAbility()) {
|
||||||
|
SkillUtils.abilityCheck(mcMMOPlayer, SkillType.UNARMED);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (unarmedManager.canUseIronArm()) {
|
||||||
|
event.setDamage(unarmedManager.ironArmCheck(event.getDamage()));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (unarmedManager.canUseBerserk()) {
|
||||||
|
event.setDamage(unarmedManager.berserkDamage(event.getDamage()));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (unarmedManager.canDisarm(target)) {
|
||||||
|
unarmedManager.disarmCheck((Player) target);
|
||||||
|
}
|
||||||
|
|
||||||
|
startGainXp(mcMMOPlayer, target, SkillType.UNARMED);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void processTamingCombat(LivingEntity target, Player master, Wolf wolf, EntityDamageByEntityEvent event) {
|
||||||
|
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(master);
|
||||||
|
TamingManager tamingManager = mcMMOPlayer.getTamingManager();
|
||||||
|
|
||||||
|
if (tamingManager.canUseFastFoodService()) {
|
||||||
|
tamingManager.fastFoodService(wolf, event.getDamage());
|
||||||
|
}
|
||||||
|
|
||||||
|
if (tamingManager.canUseSharpenedClaws()) {
|
||||||
|
event.setDamage(Taming.sharpenedClaws(event.getDamage()));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (tamingManager.canUseGore()) {
|
||||||
|
event.setDamage(tamingManager.gore(target, event.getDamage()));
|
||||||
|
}
|
||||||
|
|
||||||
|
startGainXp(mcMMOPlayer, target, SkillType.TAMING);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void processArcheryCombat(LivingEntity target, Player player, EntityDamageByEntityEvent event, Entity arrow) {
|
||||||
|
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
|
||||||
|
ArcheryManager archeryManager = mcMMOPlayer.getArcheryManager();
|
||||||
|
|
||||||
|
if (archeryManager.canSkillShot()) {
|
||||||
|
event.setDamage(archeryManager.skillShotCheck(event.getDamage()));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (target instanceof Player && SkillType.UNARMED.getPVPEnabled()) {
|
||||||
|
UnarmedManager unarmedManager = UserManager.getPlayer((Player) target).getUnarmedManager();
|
||||||
|
|
||||||
|
if (unarmedManager.canDeflect()) {
|
||||||
|
event.setCancelled(unarmedManager.deflectCheck());
|
||||||
|
|
||||||
|
if (event.isCancelled()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (archeryManager.canDaze(target)) {
|
||||||
|
event.setDamage(archeryManager.dazeCheck((Player) target, event.getDamage()));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!arrow.hasMetadata(mcMMO.infiniteArrowKey) && archeryManager.canTrackArrows()) {
|
||||||
|
archeryManager.trackArrows(target);
|
||||||
|
}
|
||||||
|
|
||||||
|
archeryManager.distanceXpBonus(target, arrow);
|
||||||
|
|
||||||
|
startGainXp(mcMMOPlayer, target, SkillType.ARCHERY, arrow.getMetadata(mcMMO.bowForceKey).get(0).asDouble());
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Apply combat modifiers and process and XP gain.
|
* Apply combat modifiers and process and XP gain.
|
||||||
*
|
*
|
||||||
* @param event The event to run the combat checks on.
|
* @param event The event to run the combat checks on.
|
||||||
*/
|
*/
|
||||||
public static void combatChecks(EntityDamageByEntityEvent event, Entity attacker, LivingEntity target) {
|
public static void processCombatAttack(EntityDamageByEntityEvent event, Entity attacker, LivingEntity target) {
|
||||||
Entity damager = event.getDamager();
|
Entity damager = event.getDamager();
|
||||||
|
|
||||||
if (attacker instanceof Player && damager.getType() == EntityType.PLAYER) {
|
if (attacker instanceof Player && damager.getType() == EntityType.PLAYER) {
|
||||||
@ -61,12 +185,11 @@ public final class CombatUtils {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
|
|
||||||
ItemStack heldItem = player.getItemInHand();
|
ItemStack heldItem = player.getItemInHand();
|
||||||
|
|
||||||
if (target instanceof Tameable) {
|
if (target instanceof Tameable) {
|
||||||
if (heldItem.getType() == Material.BONE) {
|
if (heldItem.getType() == Material.BONE) {
|
||||||
TamingManager tamingManager = mcMMOPlayer.getTamingManager();
|
TamingManager tamingManager = UserManager.getPlayer(player).getTamingManager();
|
||||||
|
|
||||||
if (tamingManager.canUseBeastLore()) {
|
if (tamingManager.canUseBeastLore()) {
|
||||||
tamingManager.beastLore(target);
|
tamingManager.beastLore(target);
|
||||||
@ -86,21 +209,7 @@ public final class CombatUtils {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (Permissions.skillEnabled(player, SkillType.SWORDS)) {
|
if (Permissions.skillEnabled(player, SkillType.SWORDS)) {
|
||||||
SwordsManager swordsManager = mcMMOPlayer.getSwordsManager();
|
processSwordCombat(target, player, event.getDamage());
|
||||||
|
|
||||||
if (swordsManager.canActivateAbility()) {
|
|
||||||
SkillUtils.abilityCheck(mcMMOPlayer, SkillType.SWORDS);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (swordsManager.canUseBleed()) {
|
|
||||||
swordsManager.bleedCheck(target);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (swordsManager.canUseSerratedStrike()) {
|
|
||||||
swordsManager.serratedStrikes(target, event.getDamage());
|
|
||||||
}
|
|
||||||
|
|
||||||
startGainXp(mcMMOPlayer, target, SkillType.SWORDS);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (ItemUtils.isAxe(heldItem)) {
|
else if (ItemUtils.isAxe(heldItem)) {
|
||||||
@ -109,32 +218,7 @@ public final class CombatUtils {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (Permissions.skillEnabled(player, SkillType.AXES)) {
|
if (Permissions.skillEnabled(player, SkillType.AXES)) {
|
||||||
AxesManager axesManager = mcMMOPlayer.getAxesManager();
|
processAxeCombat(target, player, event);
|
||||||
|
|
||||||
if (axesManager.canActivateAbility()) {
|
|
||||||
SkillUtils.abilityCheck(mcMMOPlayer, SkillType.AXES);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (axesManager.canUseAxeMastery()) {
|
|
||||||
event.setDamage(axesManager.axeMasteryCheck(event.getDamage()));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (axesManager.canCriticalHit(target)) {
|
|
||||||
event.setDamage(axesManager.criticalHitCheck(target, event.getDamage()));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (axesManager.canImpact(target)) {
|
|
||||||
axesManager.impactCheck(target);
|
|
||||||
}
|
|
||||||
else if (axesManager.canGreaterImpact(target)) {
|
|
||||||
event.setDamage(axesManager.greaterImpactCheck(target, event.getDamage()));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (axesManager.canUseSkullSplitter(target)) {
|
|
||||||
axesManager.skullSplitterCheck(target, event.getDamage());
|
|
||||||
}
|
|
||||||
|
|
||||||
startGainXp(mcMMOPlayer, target, SkillType.AXES);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (heldItem.getType() == Material.AIR) {
|
else if (heldItem.getType() == Material.AIR) {
|
||||||
@ -143,25 +227,7 @@ public final class CombatUtils {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (Permissions.skillEnabled(player, SkillType.UNARMED)) {
|
if (Permissions.skillEnabled(player, SkillType.UNARMED)) {
|
||||||
UnarmedManager unarmedManager = mcMMOPlayer.getUnarmedManager();
|
processUnarmedCombat(target, player, event);
|
||||||
|
|
||||||
if (unarmedManager.canActivateAbility()) {
|
|
||||||
SkillUtils.abilityCheck(mcMMOPlayer, SkillType.UNARMED);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (unarmedManager.canUseIronArm()) {
|
|
||||||
event.setDamage(unarmedManager.ironArmCheck(event.getDamage()));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (unarmedManager.canUseBerserk()) {
|
|
||||||
event.setDamage(unarmedManager.berserkDamage(event.getDamage()));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (unarmedManager.canDisarm(target)) {
|
|
||||||
unarmedManager.disarmCheck((Player) target);
|
|
||||||
}
|
|
||||||
|
|
||||||
startGainXp(mcMMOPlayer, target, SkillType.UNARMED);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -169,36 +235,20 @@ public final class CombatUtils {
|
|||||||
switch (damager.getType()) {
|
switch (damager.getType()) {
|
||||||
case WOLF:
|
case WOLF:
|
||||||
Wolf wolf = (Wolf) damager;
|
Wolf wolf = (Wolf) damager;
|
||||||
|
AnimalTamer tamer = wolf.getOwner();
|
||||||
|
|
||||||
if (wolf.isTamed() && wolf.getOwner() instanceof Player) {
|
if (tamer == null || !(tamer instanceof Player) || !shouldProcessSkill(target, SkillType.TAMING)) {
|
||||||
Player master = (Player) wolf.getOwner();
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
if (Misc.isNPCEntity(master)) {
|
Player master = (Player) tamer;
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!shouldProcessSkill(target, SkillType.TAMING)) {
|
if (Misc.isNPCEntity(master)) {
|
||||||
return;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Permissions.skillEnabled(master, SkillType.TAMING)) {
|
if (Permissions.skillEnabled(master, SkillType.TAMING)) {
|
||||||
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(master);
|
processTamingCombat(target, master, wolf, event);
|
||||||
TamingManager tamingManager = mcMMOPlayer.getTamingManager();
|
|
||||||
|
|
||||||
if (tamingManager.canUseFastFoodService()) {
|
|
||||||
tamingManager.fastFoodService(wolf, event.getDamage());
|
|
||||||
}
|
|
||||||
|
|
||||||
if (tamingManager.canUseSharpenedClaws()) {
|
|
||||||
event.setDamage(Taming.sharpenedClaws(event.getDamage()));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (tamingManager.canUseGore()) {
|
|
||||||
event.setDamage(tamingManager.gore(target, event.getDamage()));
|
|
||||||
}
|
|
||||||
|
|
||||||
startGainXp(mcMMOPlayer, target, SkillType.TAMING);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
@ -206,12 +256,7 @@ public final class CombatUtils {
|
|||||||
case ARROW:
|
case ARROW:
|
||||||
LivingEntity shooter = ((Arrow) damager).getShooter();
|
LivingEntity shooter = ((Arrow) damager).getShooter();
|
||||||
|
|
||||||
/* Break instead of return due to Dodge/Counter/Deflect abilities */
|
if (shooter == null || !(shooter instanceof Player) || !shouldProcessSkill(target, SkillType.ARCHERY)) {
|
||||||
if (shooter == null || !(shooter instanceof Player)) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!shouldProcessSkill(target, SkillType.ARCHERY)) {
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -222,38 +267,8 @@ public final class CombatUtils {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (Permissions.skillEnabled(player, SkillType.ARCHERY)) {
|
if (Permissions.skillEnabled(player, SkillType.ARCHERY)) {
|
||||||
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
|
processArcheryCombat(target, player, event, damager);
|
||||||
ArcheryManager archeryManager = mcMMOPlayer.getArcheryManager();
|
|
||||||
|
|
||||||
if (archeryManager.canSkillShot()) {
|
|
||||||
event.setDamage(archeryManager.skillShotCheck(event.getDamage()));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (target instanceof Player && SkillType.UNARMED.getPVPEnabled()) {
|
|
||||||
UnarmedManager unarmedManager = UserManager.getPlayer((Player) target).getUnarmedManager();
|
|
||||||
|
|
||||||
if (unarmedManager.canDeflect()) {
|
|
||||||
event.setCancelled(unarmedManager.deflectCheck());
|
|
||||||
|
|
||||||
if (event.isCancelled()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (archeryManager.canDaze(target)) {
|
|
||||||
event.setDamage(archeryManager.dazeCheck((Player) target, event.getDamage()));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!damager.hasMetadata(mcMMO.infiniteArrowKey) && archeryManager.canTrackArrows()) {
|
|
||||||
archeryManager.trackArrows(target);
|
|
||||||
}
|
|
||||||
|
|
||||||
archeryManager.distanceXpBonus(target, damager);
|
|
||||||
|
|
||||||
startGainXp(mcMMOPlayer, target, SkillType.ARCHERY, damager.getMetadata(mcMMO.bowForceKey).get(0).asDouble());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
@ -261,12 +276,11 @@ public final class CombatUtils {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (target instanceof Player) {
|
if (target instanceof Player) {
|
||||||
Player player = (Player) target;
|
if (Misc.isNPCEntity(target)) {
|
||||||
|
|
||||||
if (Misc.isNPCEntity(player)) {
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Player player = (Player) target;
|
||||||
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
|
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
|
||||||
AcrobaticsManager acrobaticsManager = mcMMOPlayer.getAcrobaticsManager();
|
AcrobaticsManager acrobaticsManager = mcMMOPlayer.getAcrobaticsManager();
|
||||||
|
|
||||||
@ -285,24 +299,6 @@ public final class CombatUtils {
|
|||||||
swordsManager.counterAttackChecks((LivingEntity) damager, event.getDamage());
|
swordsManager.counterAttackChecks((LivingEntity) damager, event.getDamage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (damager.getType() == EntityType.ARROW) {
|
|
||||||
LivingEntity shooter = ((Arrow) damager).getShooter();
|
|
||||||
|
|
||||||
if (shooter instanceof Player || !SkillType.UNARMED.getPVEEnabled()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
UnarmedManager unarmedManager = mcMMOPlayer.getUnarmedManager();
|
|
||||||
|
|
||||||
if (unarmedManager.canDeflect()) {
|
|
||||||
event.setCancelled(unarmedManager.deflectCheck());
|
|
||||||
|
|
||||||
if (event.isCancelled()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else if (attacker instanceof Player) {
|
else if (attacker instanceof Player) {
|
||||||
Player player = (Player) attacker;
|
Player player = (Player) attacker;
|
||||||
|
@ -462,7 +462,7 @@ public class SkillUtils {
|
|||||||
* @param shouldArmSwing true if an armswing event should be fired, false otherwise
|
* @param shouldArmSwing true if an armswing event should be fired, false otherwise
|
||||||
* @return true if the event wasn't cancelled, false otherwise
|
* @return true if the event wasn't cancelled, false otherwise
|
||||||
*/
|
*/
|
||||||
public static boolean blockBreakSimulate(Block block, Player player, Boolean shouldArmSwing) {
|
public static boolean blockBreakSimulate(Block block, Player player, boolean shouldArmSwing) {
|
||||||
PluginManager pluginManger = mcMMO.p.getServer().getPluginManager();
|
PluginManager pluginManger = mcMMO.p.getServer().getPluginManager();
|
||||||
|
|
||||||
// Support for NoCheat
|
// Support for NoCheat
|
||||||
|
Loading…
Reference in New Issue
Block a user