mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-26 23:26:45 +01:00
Removed redundancy
This commit is contained in:
parent
bf38fc9819
commit
4b26732f51
@ -40,25 +40,22 @@ import com.gmail.nossr50.skills.Unarmed;
|
|||||||
|
|
||||||
public class Combat
|
public class Combat
|
||||||
{
|
{
|
||||||
public static void combatChecks(EntityDamageEvent event, mcMMO pluginx)
|
public static void combatChecks(EntityDamageByEntityEvent event, mcMMO pluginx)
|
||||||
{
|
{
|
||||||
if(event.isCancelled() || event.getDamage() == 0 || event.getEntity().isDead())
|
if(event.isCancelled() || event.getDamage() == 0 || event.getEntity().isDead())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if(event instanceof EntityDamageByEntityEvent)
|
|
||||||
{
|
|
||||||
//Declare Things
|
//Declare Things
|
||||||
EntityDamageByEntityEvent eEvent = (EntityDamageByEntityEvent) event;
|
Entity damager = event.getDamager();
|
||||||
Entity damager = eEvent.getDamager();
|
LivingEntity target = (LivingEntity) event.getEntity();
|
||||||
LivingEntity target = (LivingEntity) eEvent.getEntity();
|
int damage = event.getDamage();
|
||||||
int damage = eEvent.getDamage();
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* PLAYER VERSUS ENTITIES
|
* PLAYER VERSUS ENTITIES
|
||||||
*/
|
*/
|
||||||
if(damager instanceof Player)
|
if(damager instanceof Player)
|
||||||
{
|
{
|
||||||
Player attacker = (Player) eEvent.getDamager();
|
Player attacker = (Player) event.getDamager();
|
||||||
ItemStack itemInHand = attacker.getItemInHand();
|
ItemStack itemInHand = attacker.getItemInHand();
|
||||||
PlayerProfile PPa = Users.getProfile(attacker);
|
PlayerProfile PPa = Users.getProfile(attacker);
|
||||||
|
|
||||||
@ -72,7 +69,7 @@ public class Combat
|
|||||||
Swords.bleedCheck(attacker, target, pluginx);
|
Swords.bleedCheck(attacker, target, pluginx);
|
||||||
|
|
||||||
if (!(event instanceof FakeEntityDamageByEntityEvent) && PPa.getSerratedStrikesMode())
|
if (!(event instanceof FakeEntityDamageByEntityEvent) && PPa.getSerratedStrikesMode())
|
||||||
Swords.applySerratedStrikes(attacker, eEvent, pluginx);
|
Swords.applySerratedStrikes(attacker, event, pluginx);
|
||||||
|
|
||||||
if(target instanceof Player)
|
if(target instanceof Player)
|
||||||
PvPExperienceGain(attacker, PPa, (Player) target, damage, SkillType.SWORDS);
|
PvPExperienceGain(attacker, PPa, (Player) target, damage, SkillType.SWORDS);
|
||||||
@ -84,28 +81,28 @@ public class Combat
|
|||||||
if(Users.getProfile(attacker).getSkillLevel(SkillType.AXES) >= 500)
|
if(Users.getProfile(attacker).getSkillLevel(SkillType.AXES) >= 500)
|
||||||
event.setDamage(damage + 4);
|
event.setDamage(damage + 4);
|
||||||
|
|
||||||
Axes.axeCriticalCheck(attacker, eEvent, pluginx); //Critical hit
|
Axes.axeCriticalCheck(attacker, event, pluginx); //Critical hit
|
||||||
|
|
||||||
if (!(event instanceof FakeEntityDamageByEntityEvent) && PPa.getSkullSplitterMode())
|
if (!(event instanceof FakeEntityDamageByEntityEvent) && PPa.getSkullSplitterMode())
|
||||||
Axes.applyAoeDamage(attacker, eEvent, pluginx);
|
Axes.applyAoeDamage(attacker, event, pluginx);
|
||||||
|
|
||||||
if(target instanceof Player)
|
if(target instanceof Player)
|
||||||
PvPExperienceGain(attacker, PPa, (Player) target, eEvent.getDamage(), SkillType.AXES);
|
PvPExperienceGain(attacker, PPa, (Player) target, event.getDamage(), SkillType.AXES);
|
||||||
else if(!pluginx.misc.mobSpawnerList.contains(target.getEntityId()))
|
else if(!pluginx.misc.mobSpawnerList.contains(target.getEntityId()))
|
||||||
PvEExperienceGain(attacker, PPa, target, eEvent.getDamage(), SkillType.AXES);
|
PvEExperienceGain(attacker, PPa, target, event.getDamage(), SkillType.AXES);
|
||||||
}
|
}
|
||||||
else if(itemInHand.getTypeId() == 0 && mcPermissions.getInstance().unarmed(attacker)) //Unarmed
|
else if(itemInHand.getTypeId() == 0 && mcPermissions.getInstance().unarmed(attacker)) //Unarmed
|
||||||
{
|
{
|
||||||
Unarmed.unarmedBonus(attacker, eEvent);
|
Unarmed.unarmedBonus(attacker, event);
|
||||||
if(PPa.getBerserkMode())
|
if(PPa.getBerserkMode())
|
||||||
event.setDamage(eEvent.getDamage() + (eEvent.getDamage() / 2));
|
event.setDamage(event.getDamage() + (event.getDamage() / 2));
|
||||||
if(target instanceof Player)
|
if(target instanceof Player)
|
||||||
Unarmed.disarmProcCheck(attacker, (Player) target); //Disarm
|
Unarmed.disarmProcCheck(attacker, (Player) target); //Disarm
|
||||||
|
|
||||||
if(target instanceof Player)
|
if(target instanceof Player)
|
||||||
PvPExperienceGain(attacker, PPa, (Player) target, eEvent.getDamage(), SkillType.UNARMED);
|
PvPExperienceGain(attacker, PPa, (Player) target, event.getDamage(), SkillType.UNARMED);
|
||||||
else if(!pluginx.misc.mobSpawnerList.contains(target.getEntityId()))
|
else if(!pluginx.misc.mobSpawnerList.contains(target.getEntityId()))
|
||||||
PvEExperienceGain(attacker, PPa, target, eEvent.getDamage(), SkillType.UNARMED);
|
PvEExperienceGain(attacker, PPa, target, event.getDamage(), SkillType.UNARMED);
|
||||||
}
|
}
|
||||||
|
|
||||||
//Player use bone on wolf.
|
//Player use bone on wolf.
|
||||||
@ -167,8 +164,8 @@ public class Combat
|
|||||||
*/
|
*/
|
||||||
if(target instanceof Player)
|
if(target instanceof Player)
|
||||||
{
|
{
|
||||||
Swords.counterAttackChecks(eEvent);
|
Swords.counterAttackChecks(event);
|
||||||
Acrobatics.dodgeChecks(eEvent);
|
Acrobatics.dodgeChecks(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -178,8 +175,7 @@ public class Combat
|
|||||||
{
|
{
|
||||||
Wolf wolf = (Wolf) target;
|
Wolf wolf = (Wolf) target;
|
||||||
if(wolf.isTamed() && Taming.ownerOnline(wolf, pluginx))
|
if(wolf.isTamed() && Taming.ownerOnline(wolf, pluginx))
|
||||||
Taming.preventDamage(eEvent, pluginx);
|
Taming.preventDamage(event, pluginx);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -125,7 +125,7 @@ public class mcEntityListener implements Listener
|
|||||||
if(Party.getInstance().inSameParty(defender, attacker))
|
if(Party.getInstance().inSameParty(defender, attacker))
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
}
|
}
|
||||||
Combat.combatChecks(event, plugin);
|
Combat.combatChecks(eventb, plugin);
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
* Check to see if the defender took damage so we can apply recently hurt
|
* Check to see if the defender took damage so we can apply recently hurt
|
||||||
|
Loading…
Reference in New Issue
Block a user