ItemStack heldItem = player.getItemInHand();
if (target instanceof Tameable) {
if (heldItem.getType() == Material.BONE) {
TamingManager tamingManager = UserManager.getPlayer(player).getTamingManager();
if (tamingManager.canUseBeastLore()) {
tamingManager.beastLore(target);
event.setCancelled(true);
return;
}
}
if (isFriendlyPet(player, (Tameable) target)) {
return;
}
}
if (ItemUtils.isSword(heldItem)) {
if (!SkillType.SWORDS.shouldProcess(target)) {
return;
}
if (SkillType.SWORDS.getPermissions(player)) {
processSwordCombat(target, player, event);
}
}
else if (ItemUtils.isAxe(heldItem)) {
if (!SkillType.AXES.shouldProcess(target)) {
return;
}
if (SkillType.AXES.getPermissions(player)) {
processAxeCombat(target, player, event);
}
}
else if (heldItem.getType() == Material.AIR) {
if (!SkillType.UNARMED.shouldProcess(target)) {
return;
}
if (SkillType.UNARMED.getPermissions(player)) {
processUnarmedCombat(target, player, event);
}
}
}
else if (entityType == EntityType.WOLF) {
Wolf wolf = (Wolf) damager;
AnimalTamer tamer = wolf.getOwner();
if (tamer != null && tamer instanceof Player && SkillType.TAMING.shouldProcess(target)) {
Player master = (Player) tamer;
if (!Misc.isNPCEntity(master) && SkillType.TAMING.getPermissions(master)) {
processTamingCombat(target, master, wolf, event);
}
}
}
else if (entityType == EntityType.ARROW) {
Arrow arrow = (Arrow) damager;
ProjectileSource projectileSource = arrow.getShooter();
if (projectileSource != null && projectileSource instanceof Player && SkillType.ARCHERY.shouldProcess(target)) {
Player player = (Player) projectileSource;
if (!Misc.isNPCEntity(player) && SkillType.ARCHERY.getPermissions(player)) {
processArcheryCombat(target, player, event, arrow);
}
if (target.getType() != EntityType.CREEPER && !Misc.isNPCEntity(player) && SkillType.TAMING.getPermissions(player)) {
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
TamingManager tamingManager = mcMMOPlayer.getTamingManager();
tamingManager.attackTarget(target);
}
}
}
if (target instanceof Player) {