- damageEntity function moved out of GeneralMethods into DamageHandler

- All damaging abilities now invoke DamageHandler.damageEntity
This commit is contained in:
savior67 2016-03-02 20:54:15 -05:00
parent 329b01f3aa
commit d8d3c416c1
36 changed files with 88 additions and 92 deletions

View file

@ -60,6 +60,7 @@ import com.projectkorra.projectkorra.firebending.FireShield;
import com.projectkorra.projectkorra.object.Preset; import com.projectkorra.projectkorra.object.Preset;
import com.projectkorra.projectkorra.storage.DBConnection; import com.projectkorra.projectkorra.storage.DBConnection;
import com.projectkorra.projectkorra.util.BlockCacheElement; import com.projectkorra.projectkorra.util.BlockCacheElement;
import com.projectkorra.projectkorra.util.DamageHandler;
import com.projectkorra.projectkorra.util.Flight; import com.projectkorra.projectkorra.util.Flight;
import com.projectkorra.projectkorra.util.ParticleEffect; import com.projectkorra.projectkorra.util.ParticleEffect;
import com.projectkorra.projectkorra.util.TempBlock; import com.projectkorra.projectkorra.util.TempBlock;
@ -359,41 +360,6 @@ public class GeneralMethods {
} }
} }
/**
* Damages an Entity by amount of damage specified. Starts a
* {@link EntityDamageByEntityEvent}.
*
* @param ability The ability that is used to damage the entity
* @param entity The entity that is receiving the damage
* @param damage The amount of damage to deal
*/
public static void damageEntity(Ability ability, Entity entity, double damage) {
if (ability==null)
return;
Player player = ability.getPlayer();
AbilityDamageEntityEvent damageEvent = new AbilityDamageEntityEvent(entity, ability, damage);
Bukkit.getServer().getPluginManager().callEvent(damageEvent);
if (entity instanceof LivingEntity) {
if (entity instanceof Player && Commands.invincible.contains(entity.getName())) {
damageEvent.setCancelled(true);
}
if (!damageEvent.isCancelled()) {
damage = damageEvent.getDamage();
if (Bukkit.getPluginManager().isPluginEnabled("NoCheatPlus")) {
NCPExemptionManager.exemptPermanently(player, CheckType.FIGHT_REACH);
}
if (((LivingEntity) entity).getHealth() - damage <= 0 && !entity.isDead()) {
EntityBendingDeathEvent deathEvent = new EntityBendingDeathEvent(entity, damage, ability);
Bukkit.getServer().getPluginManager().callEvent(deathEvent);
}
((LivingEntity) entity).damage(damage, player);
entity.setLastDamageCause(new EntityDamageByEntityEvent(player, entity, DamageCause.CUSTOM, damage));
if (Bukkit.getPluginManager().isPluginEnabled("NoCheatPlus")) {
NCPExemptionManager.unexempt(player);
}
}
}
}
/** /**
* Deserializes the configuration file "bendingPlayers.yml" of the old * Deserializes the configuration file "bendingPlayers.yml" of the old

View file

@ -78,6 +78,7 @@ import com.projectkorra.projectkorra.object.HorizontalVelocityTracker;
import com.projectkorra.projectkorra.object.Preset; import com.projectkorra.projectkorra.object.Preset;
import com.projectkorra.projectkorra.util.BlockSource; import com.projectkorra.projectkorra.util.BlockSource;
import com.projectkorra.projectkorra.util.ClickType; import com.projectkorra.projectkorra.util.ClickType;
import com.projectkorra.projectkorra.util.DamageHandler;
import com.projectkorra.projectkorra.util.Flight; import com.projectkorra.projectkorra.util.Flight;
import com.projectkorra.projectkorra.util.TempBlock; import com.projectkorra.projectkorra.util.TempBlock;
import com.projectkorra.projectkorra.waterbending.Bloodbending; import com.projectkorra.projectkorra.waterbending.Bloodbending;
@ -699,9 +700,9 @@ public class PKListener implements Listener {
double damage = ((e.getDistanceTraveled() - minimumDistance) < 0 ? 0 : e.getDistanceTraveled() - minimumDistance) / (e.getDifference().length()); double damage = ((e.getDistanceTraveled() - minimumDistance) < 0 ? 0 : e.getDistanceTraveled() - minimumDistance) / (e.getDifference().length());
if (damage > 0) { if (damage > 0) {
if(damage <= maxDamage) { if(damage <= maxDamage) {
GeneralMethods.damageEntity(e.getAbility(), e.getEntity(), damage); DamageHandler.damageEntity((LivingEntity) e.getEntity(), damage, e.getAbility());
} else { } else {
GeneralMethods.damageEntity(e.getAbility(), e.getEntity(), maxDamage); DamageHandler.damageEntity((LivingEntity) e.getEntity(), maxDamage, e.getAbility());
} }
} }
} }
@ -840,7 +841,6 @@ public class PKListener implements Listener {
Player source = Flight.getLaunchedBy(player); Player source = Flight.getLaunchedBy(player);
if (source != null) { if (source != null) {
event.setCancelled(true); event.setCancelled(true);
GeneralMethods.damageEntity(null, player, event.getDamage());
} }
} }

View file

@ -27,6 +27,7 @@ import com.projectkorra.projectkorra.ability.AirAbility;
import com.projectkorra.projectkorra.avatar.AvatarState; import com.projectkorra.projectkorra.avatar.AvatarState;
import com.projectkorra.projectkorra.command.Commands; import com.projectkorra.projectkorra.command.Commands;
import com.projectkorra.projectkorra.object.HorizontalVelocityTracker; import com.projectkorra.projectkorra.object.HorizontalVelocityTracker;
import com.projectkorra.projectkorra.util.DamageHandler;
import com.projectkorra.projectkorra.util.Flight; import com.projectkorra.projectkorra.util.Flight;
public class AirBlast extends AirAbility { public class AirBlast extends AirAbility {
@ -253,10 +254,10 @@ public class AirBlast extends AirAbility {
breakBreathbendingHold(entity); breakBreathbendingHold(entity);
if (source != null && (this.damage > 0 && entity instanceof LivingEntity && !entity.equals(player) && !affectedEntities.contains(entity))) { if (source != null && (this.damage > 0 && entity instanceof LivingEntity && !entity.equals(player) && !affectedEntities.contains(entity))) {
GeneralMethods.damageEntity(this, entity, damage); DamageHandler.damageEntity((LivingEntity) entity, damage, this);
affectedEntities.add(entity); affectedEntities.add(entity);
} else if (source == null && (damage > 0 && entity instanceof LivingEntity && !entity.equals(player) && !affectedEntities.contains(entity))) { } else if (source == null && (damage > 0 && entity instanceof LivingEntity && !entity.equals(player) && !affectedEntities.contains(entity))) {
GeneralMethods.damageEntity(this, entity, damage); DamageHandler.damageEntity((LivingEntity) entity, damage, this);
affectedEntities.add(entity); affectedEntities.add(entity);
} }
} }

View file

@ -10,6 +10,7 @@ import com.projectkorra.projectkorra.avatar.AvatarState;
import com.projectkorra.projectkorra.command.Commands; import com.projectkorra.projectkorra.command.Commands;
import com.projectkorra.projectkorra.firebending.FireCombo; import com.projectkorra.projectkorra.firebending.FireCombo;
import com.projectkorra.projectkorra.firebending.FireCombo.FireComboStream; import com.projectkorra.projectkorra.firebending.FireCombo.FireComboStream;
import com.projectkorra.projectkorra.util.DamageHandler;
import com.projectkorra.projectkorra.util.Flight; import com.projectkorra.projectkorra.util.Flight;
import org.bukkit.Location; import org.bukkit.Location;
@ -331,9 +332,9 @@ public class AirCombo extends AirAbility implements ComboAbility {
if (damage != 0) { if (damage != 0) {
if (entity instanceof LivingEntity) { if (entity instanceof LivingEntity) {
if (fstream.getAbility().equalsIgnoreCase("AirSweep")) { if (fstream.getAbility().equalsIgnoreCase("AirSweep")) {
GeneralMethods.damageEntity(this, entity, damage); DamageHandler.damageEntity(entity, damage, this);
} else { } else {
GeneralMethods.damageEntity(this, entity, damage); DamageHandler.damageEntity(entity, damage, this);
} }
} }
} }

View file

@ -10,6 +10,7 @@ import com.projectkorra.projectkorra.earthbending.EarthBlast;
import com.projectkorra.projectkorra.firebending.Combustion; import com.projectkorra.projectkorra.firebending.Combustion;
import com.projectkorra.projectkorra.firebending.FireBlast; import com.projectkorra.projectkorra.firebending.FireBlast;
import com.projectkorra.projectkorra.firebending.Illumination; import com.projectkorra.projectkorra.firebending.Illumination;
import com.projectkorra.projectkorra.util.DamageHandler;
import com.projectkorra.projectkorra.util.Flight; import com.projectkorra.projectkorra.util.Flight;
import com.projectkorra.projectkorra.waterbending.WaterManipulation; import com.projectkorra.projectkorra.waterbending.WaterManipulation;
@ -196,7 +197,7 @@ public class AirSwipe extends AirAbility {
} }
if (entity instanceof LivingEntity && !affectedEntities.contains(entity)) { if (entity instanceof LivingEntity && !affectedEntities.contains(entity)) {
if (damage != 0) { if (damage != 0) {
GeneralMethods.damageEntity(ability, entity, damage); DamageHandler.damageEntity(entity, damage, ability);
} }
affectedEntities.add(entity); affectedEntities.add(entity);
} }

View file

@ -15,6 +15,7 @@ import com.projectkorra.projectkorra.GeneralMethods;
import com.projectkorra.projectkorra.ProjectKorra; import com.projectkorra.projectkorra.ProjectKorra;
import com.projectkorra.projectkorra.ability.AirAbility; import com.projectkorra.projectkorra.ability.AirAbility;
import com.projectkorra.projectkorra.avatar.AvatarState; import com.projectkorra.projectkorra.avatar.AvatarState;
import com.projectkorra.projectkorra.util.DamageHandler;
/** /**
* Suffocate * Suffocate
@ -196,7 +197,7 @@ public class Suffocate extends AirAbility {
BukkitRunnable br1 = new BukkitRunnable() { BukkitRunnable br1 = new BukkitRunnable() {
@Override @Override
public void run() { public void run() {
GeneralMethods.damageEntity(ability, target, damage); DamageHandler.damageEntity(target, damage, ability);
} }
}; };
BukkitRunnable br2 = new BukkitRunnable() { BukkitRunnable br2 = new BukkitRunnable() {

View file

@ -2,6 +2,7 @@ package com.projectkorra.projectkorra.chiblocking;
import com.projectkorra.projectkorra.GeneralMethods; import com.projectkorra.projectkorra.GeneralMethods;
import com.projectkorra.projectkorra.ability.ChiAbility; import com.projectkorra.projectkorra.ability.ChiAbility;
import com.projectkorra.projectkorra.util.DamageHandler;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.entity.Entity; import org.bukkit.entity.Entity;
@ -35,7 +36,7 @@ public class QuickStrike extends ChiAbility {
return; return;
} }
GeneralMethods.damageEntity(this, target, damage); DamageHandler.damageEntity(target, damage, this);
if (target instanceof Player && ChiPassive.willChiBlock(player, (Player) target)) { if (target instanceof Player && ChiPassive.willChiBlock(player, (Player) target)) {
ChiPassive.blockChi((Player) target); ChiPassive.blockChi((Player) target);
} }

View file

@ -3,6 +3,7 @@ package com.projectkorra.projectkorra.chiblocking;
import com.projectkorra.projectkorra.GeneralMethods; import com.projectkorra.projectkorra.GeneralMethods;
import com.projectkorra.projectkorra.ability.ChiAbility; import com.projectkorra.projectkorra.ability.ChiAbility;
import com.projectkorra.projectkorra.airbending.Suffocate; import com.projectkorra.projectkorra.airbending.Suffocate;
import com.projectkorra.projectkorra.util.DamageHandler;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.entity.Entity; import org.bukkit.entity.Entity;
@ -39,7 +40,7 @@ public class RapidPunch extends ChiAbility {
} }
LivingEntity lt = (LivingEntity) target; LivingEntity lt = (LivingEntity) target;
GeneralMethods.damageEntity(this, target, damage); DamageHandler.damageEntity(target, damage, this);
if (target instanceof Player) { if (target instanceof Player) {
if (ChiPassive.willChiBlock(player, (Player) target)) { if (ChiPassive.willChiBlock(player, (Player) target)) {

View file

@ -2,6 +2,7 @@ package com.projectkorra.projectkorra.chiblocking;
import com.projectkorra.projectkorra.GeneralMethods; import com.projectkorra.projectkorra.GeneralMethods;
import com.projectkorra.projectkorra.ability.ChiAbility; import com.projectkorra.projectkorra.ability.ChiAbility;
import com.projectkorra.projectkorra.util.DamageHandler;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.entity.Entity; import org.bukkit.entity.Entity;
@ -32,7 +33,7 @@ public class SwiftKick extends ChiAbility {
remove(); remove();
return; return;
} }
GeneralMethods.damageEntity(this, target, damage); DamageHandler.damageEntity(target, damage, this);
if (target instanceof Player && ChiPassive.willChiBlock(player, (Player) target)) { if (target instanceof Player && ChiPassive.willChiBlock(player, (Player) target)) {
ChiPassive.blockChi((Player) target); ChiPassive.blockChi((Player) target);
} }

View file

@ -9,6 +9,7 @@ import com.projectkorra.projectkorra.firebending.Combustion;
import com.projectkorra.projectkorra.firebending.FireBlast; import com.projectkorra.projectkorra.firebending.FireBlast;
import com.projectkorra.projectkorra.util.BlockSource; import com.projectkorra.projectkorra.util.BlockSource;
import com.projectkorra.projectkorra.util.ClickType; import com.projectkorra.projectkorra.util.ClickType;
import com.projectkorra.projectkorra.util.DamageHandler;
import com.projectkorra.projectkorra.waterbending.WaterManipulation; import com.projectkorra.projectkorra.waterbending.WaterManipulation;
import org.bukkit.Location; import org.bukkit.Location;
@ -270,7 +271,7 @@ public class EarthBlast extends EarthAbility {
if (isMetal(sourceBlock) && bPlayer.canMetalbend()) { if (isMetal(sourceBlock) && bPlayer.canMetalbend()) {
damage = getMetalAugment(damage); damage = getMetalAugment(damage);
} }
GeneralMethods.damageEntity(this, entity, damage); DamageHandler.damageEntity(entity, damage, this);
isProgressing = false; isProgressing = false;
} }
} }

View file

@ -6,6 +6,7 @@ import com.projectkorra.projectkorra.ability.EarthAbility;
import com.projectkorra.projectkorra.ability.WaterAbility; import com.projectkorra.projectkorra.ability.WaterAbility;
import com.projectkorra.projectkorra.avatar.AvatarState; import com.projectkorra.projectkorra.avatar.AvatarState;
import com.projectkorra.projectkorra.util.ClickType; import com.projectkorra.projectkorra.util.ClickType;
import com.projectkorra.projectkorra.util.DamageHandler;
import com.projectkorra.projectkorra.util.ParticleEffect; import com.projectkorra.projectkorra.util.ParticleEffect;
import com.projectkorra.projectkorra.util.TempBlock; import com.projectkorra.projectkorra.util.TempBlock;
@ -550,7 +551,7 @@ public class EarthSmash extends EarthAbility {
if (entity instanceof LivingEntity && entity != player && !affectedEntities.contains(entity)) { if (entity instanceof LivingEntity && entity != player && !affectedEntities.contains(entity)) {
affectedEntities.add(entity); affectedEntities.add(entity);
double damage = currentBlocks.size() / 13.0 * this.damage; double damage = currentBlocks.size() / 13.0 * this.damage;
GeneralMethods.damageEntity(this, entity, damage); DamageHandler.damageEntity(entity, damage, this);
Vector travelVec = GeneralMethods.getDirection(location, entity.getLocation()); Vector travelVec = GeneralMethods.getDirection(location, entity.getLocation());
entity.setVelocity(travelVec.setY(knockup).normalize().multiply(knockback)); entity.setVelocity(travelVec.setY(knockup).normalize().multiply(knockback));
} }

View file

@ -4,6 +4,7 @@ import com.projectkorra.projectkorra.GeneralMethods;
import com.projectkorra.projectkorra.ability.LavaAbility; import com.projectkorra.projectkorra.ability.LavaAbility;
import com.projectkorra.projectkorra.util.BlockSource; import com.projectkorra.projectkorra.util.BlockSource;
import com.projectkorra.projectkorra.util.ClickType; import com.projectkorra.projectkorra.util.ClickType;
import com.projectkorra.projectkorra.util.DamageHandler;
import com.projectkorra.projectkorra.util.ParticleEffect; import com.projectkorra.projectkorra.util.ParticleEffect;
import com.projectkorra.projectkorra.util.TempBlock; import com.projectkorra.projectkorra.util.TempBlock;
@ -257,7 +258,7 @@ public class LavaSurge extends LavaAbility {
for(Entity e : GeneralMethods.getEntitiesAroundPoint(fb.getLocation(), 2)) { for(Entity e : GeneralMethods.getEntitiesAroundPoint(fb.getLocation(), 2)) {
if(e instanceof LivingEntity) { if(e instanceof LivingEntity) {
if(e.getEntityId() != player.getEntityId()) { if(e.getEntityId() != player.getEntityId()) {
GeneralMethods.damageEntity(this, e, impactDamage); DamageHandler.damageEntity(e, impactDamage, this);
e.setFireTicks(100); e.setFireTicks(100);
GeneralMethods.setVelocity(e, direction.clone()); GeneralMethods.setVelocity(e, direction.clone());
} }

View file

@ -3,6 +3,7 @@ package com.projectkorra.projectkorra.earthbending;
import com.projectkorra.projectkorra.GeneralMethods; import com.projectkorra.projectkorra.GeneralMethods;
import com.projectkorra.projectkorra.ability.MetalAbility; import com.projectkorra.projectkorra.ability.MetalAbility;
import com.projectkorra.projectkorra.avatar.AvatarState; import com.projectkorra.projectkorra.avatar.AvatarState;
import com.projectkorra.projectkorra.util.DamageHandler;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.Material; import org.bukkit.Material;
@ -381,7 +382,7 @@ public class MetalClips extends MetalAbility {
if (System.currentTimeMillis() > time + crushInterval) { if (System.currentTimeMillis() > time + crushInterval) {
time = System.currentTimeMillis(); time = System.currentTimeMillis();
GeneralMethods.damageEntity(this, targetEntity, (crushDamage + (crushDamage * 1.2))); DamageHandler.damageEntity(targetEntity, (crushDamage + (crushDamage * 1.2)), this);
} }
} }
} }
@ -408,7 +409,7 @@ public class MetalClips extends MetalAbility {
TARGET_TO_ABILITY.put(targetEntity, this); TARGET_TO_ABILITY.put(targetEntity, this);
formArmor(); formArmor();
} else { } else {
GeneralMethods.damageEntity(this, e, 5); DamageHandler.damageEntity(e, 5, this);
ii.getWorld().dropItem(ii.getLocation(), ii.getItemStack()); ii.getWorld().dropItem(ii.getLocation(), ii.getItemStack());
remove(); remove();
} }

View file

@ -4,6 +4,7 @@ import com.projectkorra.projectkorra.GeneralMethods;
import com.projectkorra.projectkorra.ability.AirAbility; import com.projectkorra.projectkorra.ability.AirAbility;
import com.projectkorra.projectkorra.ability.EarthAbility; import com.projectkorra.projectkorra.ability.EarthAbility;
import com.projectkorra.projectkorra.avatar.AvatarState; import com.projectkorra.projectkorra.avatar.AvatarState;
import com.projectkorra.projectkorra.util.DamageHandler;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.block.Block; import org.bukkit.block.Block;
@ -265,7 +266,7 @@ public class Ripple extends EarthAbility {
private void affect(Entity entity) { private void affect(Entity entity) {
if (entity instanceof LivingEntity) { if (entity instanceof LivingEntity) {
GeneralMethods.damageEntity(this, entity, damage); DamageHandler.damageEntity(entity, damage, this);
} }
Vector vector = direction.clone(); Vector vector = direction.clone();

View file

@ -2,6 +2,7 @@ package com.projectkorra.projectkorra.earthbending;
import com.projectkorra.projectkorra.GeneralMethods; import com.projectkorra.projectkorra.GeneralMethods;
import com.projectkorra.projectkorra.ability.SandAbility; import com.projectkorra.projectkorra.ability.SandAbility;
import com.projectkorra.projectkorra.util.DamageHandler;
import com.projectkorra.projectkorra.util.Flight; import com.projectkorra.projectkorra.util.Flight;
import org.bukkit.Location; import org.bukkit.Location;
@ -157,7 +158,7 @@ public class SandSpout extends SandAbility {
for (Player sPlayer : players) { for (Player sPlayer : players) {
if (!sPlayer.equals(player)) { if (!sPlayer.equals(player)) {
sPlayer.addPotionEffect(new PotionEffect(PotionEffectType.BLINDNESS, blindnessTime * 20, 1)); sPlayer.addPotionEffect(new PotionEffect(PotionEffectType.BLINDNESS, blindnessTime * 20, 1));
GeneralMethods.damageEntity(this, sPlayer, damage); DamageHandler.damageEntity(sPlayer, damage, this);
} }
} }
} }

View file

@ -22,10 +22,9 @@ public class EntityBendingDeathEvent extends Event {
/** /**
* Creates a new EntityBendingDeathEvent * Creates a new EntityBendingDeathEvent
* *
* @param victim the player who died * @param entity the entity who died
* @param attacker the player who killed the victim
* @param damage the amount of damage done in the attack that killed the victim * @param damage the amount of damage done in the attack that killed the victim
* @param ability the ability used to kill the victim * @param ability the ability used to kill the entity
*/ */
public EntityBendingDeathEvent(Entity entity, double damage, Ability ability) { public EntityBendingDeathEvent(Entity entity, double damage, Ability ability) {
this.entity = entity; this.entity = entity;

View file

@ -5,6 +5,7 @@ import com.projectkorra.projectkorra.ProjectKorra;
import com.projectkorra.projectkorra.ability.AirAbility; import com.projectkorra.projectkorra.ability.AirAbility;
import com.projectkorra.projectkorra.ability.CombustionAbility; import com.projectkorra.projectkorra.ability.CombustionAbility;
import com.projectkorra.projectkorra.avatar.AvatarState; import com.projectkorra.projectkorra.avatar.AvatarState;
import com.projectkorra.projectkorra.util.DamageHandler;
import com.projectkorra.projectkorra.util.ParticleEffect; import com.projectkorra.projectkorra.util.ParticleEffect;
import org.bukkit.Location; import org.bukkit.Location;
@ -101,7 +102,7 @@ public class Combustion extends CombustionAbility {
for (Entity entity : block.getWorld().getEntities()) { for (Entity entity : block.getWorld().getEntities()) {
if (entity instanceof LivingEntity) { if (entity instanceof LivingEntity) {
if (entity.getLocation().distanceSquared(block) < radius * radius) { // They are close enough to the explosion. if (entity.getLocation().distanceSquared(block) < radius * radius) { // They are close enough to the explosion.
GeneralMethods.damageEntity(this, entity, damage); DamageHandler.damageEntity((LivingEntity) entity, damage, this);
AirAbility.breakBreathbendingHold(entity); AirAbility.breakBreathbendingHold(entity);
} }
} }

View file

@ -7,6 +7,7 @@ import com.projectkorra.projectkorra.ability.FireAbility;
import com.projectkorra.projectkorra.ability.WaterAbility; import com.projectkorra.projectkorra.ability.WaterAbility;
import com.projectkorra.projectkorra.avatar.AvatarState; import com.projectkorra.projectkorra.avatar.AvatarState;
import com.projectkorra.projectkorra.earthbending.EarthBlast; import com.projectkorra.projectkorra.earthbending.EarthBlast;
import com.projectkorra.projectkorra.util.DamageHandler;
import com.projectkorra.projectkorra.util.ParticleEffect; import com.projectkorra.projectkorra.util.ParticleEffect;
import com.projectkorra.projectkorra.waterbending.PlantRegrowth; import com.projectkorra.projectkorra.waterbending.PlantRegrowth;
import com.projectkorra.projectkorra.waterbending.WaterManipulation; import com.projectkorra.projectkorra.waterbending.WaterManipulation;
@ -125,7 +126,7 @@ public class FireBlast extends FireAbility {
} }
if (entity instanceof LivingEntity) { if (entity instanceof LivingEntity) {
entity.setFireTicks((int) (fireTicks * 20)); entity.setFireTicks((int) (fireTicks * 20));
GeneralMethods.damageEntity(this, entity, (int) getDayFactor(damage)); DamageHandler.damageEntity(entity, (int) getDayFactor(damage), this);
AirAbility.breakBreathbendingHold(entity); AirAbility.breakBreathbendingHold(entity);
new FireDamageTimer(entity, player); new FireDamageTimer(entity, player);
remove(); remove();

View file

@ -4,6 +4,7 @@ import com.projectkorra.projectkorra.GeneralMethods;
import com.projectkorra.projectkorra.ability.AirAbility; import com.projectkorra.projectkorra.ability.AirAbility;
import com.projectkorra.projectkorra.ability.FireAbility; import com.projectkorra.projectkorra.ability.FireAbility;
import com.projectkorra.projectkorra.avatar.AvatarState; import com.projectkorra.projectkorra.avatar.AvatarState;
import com.projectkorra.projectkorra.util.DamageHandler;
import com.projectkorra.projectkorra.util.ParticleEffect; import com.projectkorra.projectkorra.util.ParticleEffect;
import org.bukkit.Effect; import org.bukkit.Effect;
@ -134,13 +135,13 @@ public class FireBlastCharged extends FireAbility {
if (distance > damageRadius) { if (distance > damageRadius) {
return; return;
} else if (distance < innerRadius) { } else if (distance < innerRadius) {
GeneralMethods.damageEntity(this, entity, maxDamage); DamageHandler.damageEntity(entity, maxDamage, this);
return; return;
} }
double slope = -(maxDamage * .5) / (damageRadius - innerRadius); double slope = -(maxDamage * .5) / (damageRadius - innerRadius);
double damage = slope * (distance - innerRadius) + maxDamage; double damage = slope * (distance - innerRadius) + maxDamage;
GeneralMethods.damageEntity(this, entity, damage); DamageHandler.damageEntity(entity, damage, this);
AirAbility.breakBreathbendingHold(entity); AirAbility.breakBreathbendingHold(entity);
} }
@ -173,7 +174,7 @@ public class FireBlastCharged extends FireAbility {
if (entity instanceof LivingEntity) { if (entity instanceof LivingEntity) {
double slope = -(maxDamage * .5) / (damageRadius - innerRadius); double slope = -(maxDamage * .5) / (damageRadius - innerRadius);
double damage = slope * (entity.getLocation().distance(location) - innerRadius) + maxDamage; double damage = slope * (entity.getLocation().distance(location) - innerRadius) + maxDamage;
GeneralMethods.damageEntity(this, entity, damage); DamageHandler.damageEntity(entity, damage, this);
} }
} }
location.getWorld().playSound(location, Sound.EXPLODE, 5, 1); location.getWorld().playSound(location, Sound.EXPLODE, 5, 1);

View file

@ -25,6 +25,7 @@ import com.projectkorra.projectkorra.ability.util.ComboManager.AbilityInformatio
import com.projectkorra.projectkorra.avatar.AvatarState; import com.projectkorra.projectkorra.avatar.AvatarState;
import com.projectkorra.projectkorra.command.Commands; import com.projectkorra.projectkorra.command.Commands;
import com.projectkorra.projectkorra.util.ClickType; import com.projectkorra.projectkorra.util.ClickType;
import com.projectkorra.projectkorra.util.DamageHandler;
import com.projectkorra.projectkorra.util.ParticleEffect; import com.projectkorra.projectkorra.util.ParticleEffect;
/* /*
@ -179,7 +180,7 @@ public class FireCombo extends FireAbility implements ComboAbility {
if (ability.equalsIgnoreCase("FireKick")) { if (ability.equalsIgnoreCase("FireKick")) {
if (!affectedEntities.contains(entity)) { if (!affectedEntities.contains(entity)) {
affectedEntities.add(entity); affectedEntities.add(entity);
GeneralMethods.damageEntity(this, entity, damage); DamageHandler.damageEntity(entity, damage, this);
fstream.remove(); fstream.remove();
} }
} else if (ability.equalsIgnoreCase("FireSpin")) { } else if (ability.equalsIgnoreCase("FireSpin")) {
@ -191,21 +192,21 @@ public class FireCombo extends FireAbility implements ComboAbility {
if (!affectedEntities.contains(entity)) { if (!affectedEntities.contains(entity)) {
affectedEntities.add(entity); affectedEntities.add(entity);
double newKnockback = bPlayer.isAvatarState() ? knockback + 0.5 : knockback; double newKnockback = bPlayer.isAvatarState() ? knockback + 0.5 : knockback;
GeneralMethods.damageEntity(this, entity, damage); DamageHandler.damageEntity(entity, damage, this);
entity.setVelocity(direction.normalize().multiply(newKnockback)); entity.setVelocity(direction.normalize().multiply(newKnockback));
fstream.remove(); fstream.remove();
} }
} else if (ability.equalsIgnoreCase("JetBlaze")) { } else if (ability.equalsIgnoreCase("JetBlaze")) {
if (!affectedEntities.contains(entity)) { if (!affectedEntities.contains(entity)) {
affectedEntities.add(entity); affectedEntities.add(entity);
GeneralMethods.damageEntity(this, entity, damage); DamageHandler.damageEntity(entity, damage, this);
entity.setFireTicks((int) (fireTicks * 20)); entity.setFireTicks((int) (fireTicks * 20));
new FireDamageTimer(entity, player); new FireDamageTimer(entity, player);
} }
} else if (ability.equalsIgnoreCase("FireWheel")) { } else if (ability.equalsIgnoreCase("FireWheel")) {
if (!affectedEntities.contains(entity)) { if (!affectedEntities.contains(entity)) {
affectedEntities.add(entity); affectedEntities.add(entity);
GeneralMethods.damageEntity(this, entity, damage); DamageHandler.damageEntity(entity, damage, this);
entity.setFireTicks((int) (fireTicks * 20)); entity.setFireTicks((int) (fireTicks * 20));
new FireDamageTimer(entity, player); new FireDamageTimer(entity, player);
this.remove(); this.remove();

View file

@ -8,6 +8,7 @@ import org.bukkit.entity.Player;
import com.projectkorra.projectkorra.Element; import com.projectkorra.projectkorra.Element;
import com.projectkorra.projectkorra.ability.CoreAbility; import com.projectkorra.projectkorra.ability.CoreAbility;
import com.projectkorra.projectkorra.event.EntityBendingDeathEvent; import com.projectkorra.projectkorra.event.EntityBendingDeathEvent;
import com.projectkorra.projectkorra.util.DamageHandler;
import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentHashMap;
@ -54,12 +55,10 @@ public class FireDamageTimer {
} }
LivingEntity Lentity = (LivingEntity) entity; LivingEntity Lentity = (LivingEntity) entity;
Player source = INSTANCES.get(entity); Player source = INSTANCES.get(entity);
if (Lentity.getHealth() - DAMAGE <= 0 && !entity.isDead()) {
EntityBendingDeathEvent event = new EntityBendingDeathEvent(entity, DAMAGE, CoreAbility.getAbilitiesByElement(Element.FIRE).get(0));
Bukkit.getServer().getPluginManager().callEvent(event);
}
Lentity.damage(DAMAGE, source); //damages the entity
DamageHandler.damageEntity(Lentity, source, DAMAGE, CoreAbility.getAbilitiesByElement(Element.FIRE).get(0));
if (entity.getFireTicks() > MAX_TICKS) { if (entity.getFireTicks() > MAX_TICKS) {
entity.setFireTicks(MAX_TICKS); entity.setFireTicks(MAX_TICKS);
} }

View file

@ -4,6 +4,7 @@ import com.projectkorra.projectkorra.GeneralMethods;
import com.projectkorra.projectkorra.ProjectKorra; import com.projectkorra.projectkorra.ProjectKorra;
import com.projectkorra.projectkorra.ability.LightningAbility; import com.projectkorra.projectkorra.ability.LightningAbility;
import com.projectkorra.projectkorra.avatar.AvatarState; import com.projectkorra.projectkorra.avatar.AvatarState;
import com.projectkorra.projectkorra.util.DamageHandler;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.Sound; import org.bukkit.Sound;
@ -123,7 +124,7 @@ public class Lightning extends LightningAbility {
public void electrocute(LivingEntity lent) { public void electrocute(LivingEntity lent) {
lent.getWorld().playSound(lent.getLocation(), Sound.CREEPER_HISS, 1, 0); lent.getWorld().playSound(lent.getLocation(), Sound.CREEPER_HISS, 1, 0);
player.getWorld().playSound(player.getLocation(), Sound.CREEPER_HISS, 1, 0); player.getWorld().playSound(player.getLocation(), Sound.CREEPER_HISS, 1, 0);
GeneralMethods.damageEntity(this, lent, damage); DamageHandler.damageEntity(lent, damage, this);
if (Math.random() < stunChance) { if (Math.random() < stunChance) {
final Location lentLoc = lent.getLocation(); final Location lentLoc = lent.getLocation();

View file

@ -3,6 +3,7 @@ package com.projectkorra.projectkorra.firebending;
import com.projectkorra.projectkorra.GeneralMethods; import com.projectkorra.projectkorra.GeneralMethods;
import com.projectkorra.projectkorra.ability.AirAbility; import com.projectkorra.projectkorra.ability.AirAbility;
import com.projectkorra.projectkorra.ability.FireAbility; import com.projectkorra.projectkorra.ability.FireAbility;
import com.projectkorra.projectkorra.util.DamageHandler;
import com.projectkorra.projectkorra.util.ParticleEffect; import com.projectkorra.projectkorra.util.ParticleEffect;
import com.projectkorra.projectkorra.util.TempBlock; import com.projectkorra.projectkorra.util.TempBlock;
@ -93,7 +94,7 @@ public class WallOfFire extends FireAbility {
if (TempBlock.isTempBlock(block) && isIce(block)) { if (TempBlock.isTempBlock(block) && isIce(block)) {
return; return;
} }
GeneralMethods.damageEntity(this, entity, damage); DamageHandler.damageEntity(entity, damage, this);
AirAbility.breakBreathbendingHold(entity); AirAbility.breakBreathbendingHold(entity);
} }
entity.setFireTicks((int) (fireTicks * 20)); entity.setFireTicks((int) (fireTicks * 20));

View file

@ -19,6 +19,7 @@ import com.projectkorra.projectkorra.ability.AirAbility;
import com.projectkorra.projectkorra.ability.BloodAbility; import com.projectkorra.projectkorra.ability.BloodAbility;
import com.projectkorra.projectkorra.avatar.AvatarState; import com.projectkorra.projectkorra.avatar.AvatarState;
import com.projectkorra.projectkorra.object.HorizontalVelocityTracker; import com.projectkorra.projectkorra.object.HorizontalVelocityTracker;
import com.projectkorra.projectkorra.util.DamageHandler;
import com.projectkorra.projectkorra.util.TempPotionEffect; import com.projectkorra.projectkorra.util.TempPotionEffect;
public class Bloodbending extends BloodAbility { public class Bloodbending extends BloodAbility {
@ -78,7 +79,7 @@ public class Bloodbending extends BloodAbility {
continue; continue;
} }
} }
GeneralMethods.damageEntity(this, entity, 0); DamageHandler.damageEntity(entity, 0, this);
AirAbility.breakBreathbendingHold(entity); AirAbility.breakBreathbendingHold(entity);
TARGETED_ENTITIES.put(entity, entity.getLocation().clone()); TARGETED_ENTITIES.put(entity, entity.getLocation().clone());
} }
@ -118,7 +119,7 @@ public class Bloodbending extends BloodAbility {
return; return;
} }
GeneralMethods.damageEntity(this, target, 0); DamageHandler.damageEntity(target, 0, this);
HorizontalVelocityTracker.remove(target); HorizontalVelocityTracker.remove(target);
AirAbility.breakBreathbendingHold(target); AirAbility.breakBreathbendingHold(target);
TARGETED_ENTITIES.put(target, target.getLocation().clone()); TARGETED_ENTITIES.put(target, target.getLocation().clone());
@ -204,7 +205,7 @@ public class Bloodbending extends BloodAbility {
entities.add(entity); entities.add(entity);
if (!TARGETED_ENTITIES.containsKey(entity) && entity instanceof LivingEntity) { if (!TARGETED_ENTITIES.containsKey(entity) && entity instanceof LivingEntity) {
GeneralMethods.damageEntity(this, entity, 0); DamageHandler.damageEntity(entity, 0, this);
TARGETED_ENTITIES.put(entity, entity.getLocation().clone()); TARGETED_ENTITIES.put(entity, entity.getLocation().clone());
} }

View file

@ -6,6 +6,7 @@ import com.projectkorra.projectkorra.ability.AirAbility;
import com.projectkorra.projectkorra.ability.IceAbility; import com.projectkorra.projectkorra.ability.IceAbility;
import com.projectkorra.projectkorra.util.BlockSource; import com.projectkorra.projectkorra.util.BlockSource;
import com.projectkorra.projectkorra.util.ClickType; import com.projectkorra.projectkorra.util.ClickType;
import com.projectkorra.projectkorra.util.DamageHandler;
import com.projectkorra.projectkorra.util.ParticleEffect; import com.projectkorra.projectkorra.util.ParticleEffect;
import com.projectkorra.projectkorra.util.TempBlock; import com.projectkorra.projectkorra.util.TempBlock;
import com.projectkorra.projectkorra.util.TempPotionEffect; import com.projectkorra.projectkorra.util.TempPotionEffect;
@ -151,12 +152,12 @@ public class IceBlast extends IceAbility {
PotionEffect effect = new PotionEffect(PotionEffectType.SLOW, 70, 2); PotionEffect effect = new PotionEffect(PotionEffectType.SLOW, 70, 2);
new TempPotionEffect(entity, effect); new TempPotionEffect(entity, effect);
bPlayer.slow(10); bPlayer.slow(10);
GeneralMethods.damageEntity(this, entity, damage); DamageHandler.damageEntity(entity, damage, this);
} }
} else { } else {
PotionEffect effect = new PotionEffect(PotionEffectType.SLOW, 70, 2); PotionEffect effect = new PotionEffect(PotionEffectType.SLOW, 70, 2);
new TempPotionEffect(entity, effect); new TempPotionEffect(entity, effect);
GeneralMethods.damageEntity(this, entity, damage); DamageHandler.damageEntity(entity, damage, this);
} }
AirAbility.breakBreathbendingHold(entity); AirAbility.breakBreathbendingHold(entity);

View file

@ -4,6 +4,7 @@ import com.projectkorra.projectkorra.BendingPlayer;
import com.projectkorra.projectkorra.GeneralMethods; import com.projectkorra.projectkorra.GeneralMethods;
import com.projectkorra.projectkorra.ability.AirAbility; import com.projectkorra.projectkorra.ability.AirAbility;
import com.projectkorra.projectkorra.ability.IceAbility; import com.projectkorra.projectkorra.ability.IceAbility;
import com.projectkorra.projectkorra.util.DamageHandler;
import com.projectkorra.projectkorra.util.TempBlock; import com.projectkorra.projectkorra.util.TempBlock;
import com.projectkorra.projectkorra.util.TempPotionEffect; import com.projectkorra.projectkorra.util.TempPotionEffect;
@ -92,12 +93,12 @@ public class IceSpikeBlast extends IceAbility {
PotionEffect effect = new PotionEffect(PotionEffectType.SLOW, slowDuration, slowPower); PotionEffect effect = new PotionEffect(PotionEffectType.SLOW, slowDuration, slowPower);
new TempPotionEffect(entity, effect); new TempPotionEffect(entity, effect);
targetBPlayer.slow(slowCooldown); targetBPlayer.slow(slowCooldown);
GeneralMethods.damageEntity(this, entity, damage); DamageHandler.damageEntity(entity, damage, this);
} }
} else { } else {
PotionEffect effect = new PotionEffect(PotionEffectType.SLOW, slowDuration, slowPower); PotionEffect effect = new PotionEffect(PotionEffectType.SLOW, slowDuration, slowPower);
new TempPotionEffect(entity, effect); new TempPotionEffect(entity, effect);
GeneralMethods.damageEntity(this, entity, damage); DamageHandler.damageEntity(entity, damage, this);
} }
AirAbility.breakBreathbendingHold(entity); AirAbility.breakBreathbendingHold(entity);
} }

View file

@ -3,6 +3,7 @@ package com.projectkorra.projectkorra.waterbending;
import com.projectkorra.projectkorra.GeneralMethods; import com.projectkorra.projectkorra.GeneralMethods;
import com.projectkorra.projectkorra.ability.AirAbility; import com.projectkorra.projectkorra.ability.AirAbility;
import com.projectkorra.projectkorra.ability.IceAbility; import com.projectkorra.projectkorra.ability.IceAbility;
import com.projectkorra.projectkorra.util.DamageHandler;
import com.projectkorra.projectkorra.util.TempPotionEffect; import com.projectkorra.projectkorra.util.TempPotionEffect;
import org.bukkit.Location; import org.bukkit.Location;
@ -220,7 +221,7 @@ public class IceSpikePillar extends IceAbility {
private void affect(LivingEntity entity) { private void affect(LivingEntity entity) {
entity.setVelocity(thrownForce); entity.setVelocity(thrownForce);
GeneralMethods.damageEntity(this, entity, damage); DamageHandler.damageEntity(entity, damage, this);
damaged.add(entity); damaged.add(entity);
if (entity instanceof Player) { if (entity instanceof Player) {

View file

@ -6,6 +6,7 @@ import com.projectkorra.projectkorra.ability.WaterAbility;
import com.projectkorra.projectkorra.avatar.AvatarState; import com.projectkorra.projectkorra.avatar.AvatarState;
import com.projectkorra.projectkorra.util.BlockSource; import com.projectkorra.projectkorra.util.BlockSource;
import com.projectkorra.projectkorra.util.ClickType; import com.projectkorra.projectkorra.util.ClickType;
import com.projectkorra.projectkorra.util.DamageHandler;
import com.projectkorra.projectkorra.util.TempBlock; import com.projectkorra.projectkorra.util.TempBlock;
import org.bukkit.Location; import org.bukkit.Location;
@ -171,7 +172,7 @@ public class OctopusForm extends WaterAbility {
entity.setVelocity(GeneralMethods.getDirection(player.getLocation(), location).normalize().multiply(knock)); entity.setVelocity(GeneralMethods.getDirection(player.getLocation(), location).normalize().multiply(knock));
if (entity instanceof LivingEntity) { if (entity instanceof LivingEntity) {
GeneralMethods.damageEntity(this, entity, damage); DamageHandler.damageEntity(entity, damage, this);
} }
AirAbility.breakBreathbendingHold(entity); AirAbility.breakBreathbendingHold(entity);
} }

View file

@ -7,6 +7,7 @@ import com.projectkorra.projectkorra.ability.WaterAbility;
import com.projectkorra.projectkorra.avatar.AvatarState; import com.projectkorra.projectkorra.avatar.AvatarState;
import com.projectkorra.projectkorra.util.BlockSource; import com.projectkorra.projectkorra.util.BlockSource;
import com.projectkorra.projectkorra.util.ClickType; import com.projectkorra.projectkorra.util.ClickType;
import com.projectkorra.projectkorra.util.DamageHandler;
import com.projectkorra.projectkorra.util.ParticleEffect; import com.projectkorra.projectkorra.util.ParticleEffect;
import com.projectkorra.projectkorra.util.TempBlock; import com.projectkorra.projectkorra.util.TempBlock;
@ -517,7 +518,7 @@ public class Torrent extends WaterAbility {
entity.setFallDistance(0); entity.setFallDistance(0);
if (entity instanceof LivingEntity) { if (entity instanceof LivingEntity) {
double damageDealt = getNightFactor(deflectDamage); double damageDealt = getNightFactor(deflectDamage);
GeneralMethods.damageEntity(this, entity, damageDealt); DamageHandler.damageEntity(entity, damageDealt, this);
AirAbility.breakBreathbendingHold(entity); AirAbility.breakBreathbendingHold(entity);
} }
} }
@ -534,7 +535,7 @@ public class Torrent extends WaterAbility {
} }
if (entity instanceof LivingEntity && !hurtEntities.contains(entity)) { if (entity instanceof LivingEntity && !hurtEntities.contains(entity)) {
double damageDealt = getNightFactor(damage); double damageDealt = getNightFactor(damage);
GeneralMethods.damageEntity(this, entity, damageDealt); DamageHandler.damageEntity(entity, damageDealt, this);
AirAbility.breakBreathbendingHold(entity); AirAbility.breakBreathbendingHold(entity);
hurtEntities.add(entity); hurtEntities.add(entity);
((LivingEntity) entity).setNoDamageTicks(0); ((LivingEntity) entity).setNoDamageTicks(0);

View file

@ -6,6 +6,7 @@ import com.projectkorra.projectkorra.ability.FireAbility;
import com.projectkorra.projectkorra.ability.WaterAbility; import com.projectkorra.projectkorra.ability.WaterAbility;
import com.projectkorra.projectkorra.ability.util.MultiAbilityManager; import com.projectkorra.projectkorra.ability.util.MultiAbilityManager;
import com.projectkorra.projectkorra.firebending.Lightning; import com.projectkorra.projectkorra.firebending.Lightning;
import com.projectkorra.projectkorra.util.DamageHandler;
import com.projectkorra.projectkorra.util.ParticleEffect; import com.projectkorra.projectkorra.util.ParticleEffect;
import com.projectkorra.projectkorra.util.TempBlock; import com.projectkorra.projectkorra.util.TempBlock;
import com.projectkorra.projectkorra.waterbending.WaterArmsWhip.Whip; import com.projectkorra.projectkorra.waterbending.WaterArmsWhip.Whip;
@ -352,9 +353,9 @@ public class WaterArms extends WaterAbility {
FireAbility.playLightningbendingParticle(l1); FireAbility.playLightningbendingParticle(l1);
} }
if (lightningKill) { if (lightningKill) {
GeneralMethods.damageEntity(lightning, player, 60D); DamageHandler.damageEntity(player, 60D, lightning);
} else { } else {
GeneralMethods.damageEntity(lightning, player, lightningDamage); DamageHandler.damageEntity(player, lightningDamage, lightning);
} }
} }
} }

View file

@ -2,6 +2,7 @@ package com.projectkorra.projectkorra.waterbending;
import com.projectkorra.projectkorra.GeneralMethods; import com.projectkorra.projectkorra.GeneralMethods;
import com.projectkorra.projectkorra.ability.IceAbility; import com.projectkorra.projectkorra.ability.IceAbility;
import com.projectkorra.projectkorra.util.DamageHandler;
import com.projectkorra.projectkorra.util.ParticleEffect; import com.projectkorra.projectkorra.util.ParticleEffect;
import com.projectkorra.projectkorra.util.TempBlock; import com.projectkorra.projectkorra.util.TempBlock;
import com.projectkorra.projectkorra.util.TempPotionEffect; import com.projectkorra.projectkorra.util.TempPotionEffect;
@ -126,7 +127,7 @@ public class WaterArmsFreeze extends IceAbility {
for (Entity entity : GeneralMethods.getEntitiesAroundPoint(location, 2.5)) { for (Entity entity : GeneralMethods.getEntitiesAroundPoint(location, 2.5)) {
if (entity instanceof LivingEntity && entity.getEntityId() != player.getEntityId() && !(entity instanceof ArmorStand)) { if (entity instanceof LivingEntity && entity.getEntityId() != player.getEntityId() && !(entity instanceof ArmorStand)) {
GeneralMethods.damageEntity(this, entity, iceDamage); DamageHandler.damageEntity(entity, iceDamage, this);
PotionEffect effect = new PotionEffect(PotionEffectType.SLOW, 40, 2); PotionEffect effect = new PotionEffect(PotionEffectType.SLOW, 40, 2);
new TempPotionEffect((LivingEntity) entity, effect); new TempPotionEffect((LivingEntity) entity, effect);
remove(); remove();

View file

@ -2,6 +2,7 @@ package com.projectkorra.projectkorra.waterbending;
import com.projectkorra.projectkorra.GeneralMethods; import com.projectkorra.projectkorra.GeneralMethods;
import com.projectkorra.projectkorra.ability.WaterAbility; import com.projectkorra.projectkorra.ability.WaterAbility;
import com.projectkorra.projectkorra.util.DamageHandler;
import com.projectkorra.projectkorra.util.TempBlock; import com.projectkorra.projectkorra.util.TempBlock;
import com.projectkorra.projectkorra.waterbending.WaterArms.Arm; import com.projectkorra.projectkorra.waterbending.WaterArms.Arm;
@ -172,7 +173,7 @@ public class WaterArmsSpear extends WaterAbility {
location = entity.getLocation(); location = entity.getLocation();
if (spearDamageEnabled) { if (spearDamageEnabled) {
GeneralMethods.damageEntity(this, entity, spearDamage); DamageHandler.damageEntity(entity, spearDamage, this);
} }
return; return;

View file

@ -4,6 +4,7 @@ import com.projectkorra.projectkorra.GeneralMethods;
import com.projectkorra.projectkorra.ability.WaterAbility; import com.projectkorra.projectkorra.ability.WaterAbility;
import com.projectkorra.projectkorra.ability.util.MultiAbilityManager; import com.projectkorra.projectkorra.ability.util.MultiAbilityManager;
import com.projectkorra.projectkorra.command.Commands; import com.projectkorra.projectkorra.command.Commands;
import com.projectkorra.projectkorra.util.DamageHandler;
import com.projectkorra.projectkorra.util.TempBlock; import com.projectkorra.projectkorra.util.TempBlock;
import com.projectkorra.projectkorra.waterbending.WaterArms.Arm; import com.projectkorra.projectkorra.waterbending.WaterArms.Arm;
@ -304,7 +305,7 @@ public class WaterArmsWhip extends WaterAbility {
if (entity instanceof LivingEntity) { if (entity instanceof LivingEntity) {
if (entity.getEntityId() != player.getEntityId()) { if (entity.getEntityId() != player.getEntityId()) {
hasDamaged = true; hasDamaged = true;
GeneralMethods.damageEntity(this, entity, punchDamage); DamageHandler.damageEntity(entity, punchDamage, this);
} }
} }
} }

View file

@ -10,6 +10,7 @@ import com.projectkorra.projectkorra.firebending.FireCombo;
import com.projectkorra.projectkorra.firebending.FireCombo.FireComboStream; import com.projectkorra.projectkorra.firebending.FireCombo.FireComboStream;
import com.projectkorra.projectkorra.util.BlockSource; import com.projectkorra.projectkorra.util.BlockSource;
import com.projectkorra.projectkorra.util.ClickType; import com.projectkorra.projectkorra.util.ClickType;
import com.projectkorra.projectkorra.util.DamageHandler;
import com.projectkorra.projectkorra.util.ParticleEffect; import com.projectkorra.projectkorra.util.ParticleEffect;
import com.projectkorra.projectkorra.util.TempBlock; import com.projectkorra.projectkorra.util.TempBlock;
@ -184,7 +185,7 @@ public class WaterCombo extends WaterAbility implements ComboAbility {
} }
if (damage != 0) { if (damage != 0) {
if (entity instanceof LivingEntity) { if (entity instanceof LivingEntity) {
GeneralMethods.damageEntity(this, entity, damage); DamageHandler.damageEntity(entity, damage, this);
} }
} }
} }

View file

@ -10,6 +10,7 @@ import com.projectkorra.projectkorra.firebending.Combustion;
import com.projectkorra.projectkorra.firebending.FireBlast; import com.projectkorra.projectkorra.firebending.FireBlast;
import com.projectkorra.projectkorra.util.BlockSource; import com.projectkorra.projectkorra.util.BlockSource;
import com.projectkorra.projectkorra.util.ClickType; import com.projectkorra.projectkorra.util.ClickType;
import com.projectkorra.projectkorra.util.DamageHandler;
import com.projectkorra.projectkorra.util.ParticleEffect; import com.projectkorra.projectkorra.util.ParticleEffect;
import com.projectkorra.projectkorra.util.TempBlock; import com.projectkorra.projectkorra.util.TempBlock;
@ -281,7 +282,7 @@ public class WaterManipulation extends WaterAbility {
damage = AvatarState.getValue(damage); damage = AvatarState.getValue(damage);
} }
damage = getNightFactor(damage); damage = getNightFactor(damage);
GeneralMethods.damageEntity(this, entity, damage); DamageHandler.damageEntity(entity, damage, this);
AirAbility.breakBreathbendingHold(entity); AirAbility.breakBreathbendingHold(entity);
progressing = false; progressing = false;
} }

View file

@ -3,6 +3,7 @@ package com.projectkorra.projectkorra.waterbending;
import com.projectkorra.projectkorra.GeneralMethods; import com.projectkorra.projectkorra.GeneralMethods;
import com.projectkorra.projectkorra.ProjectKorra; import com.projectkorra.projectkorra.ProjectKorra;
import com.projectkorra.projectkorra.ability.WaterAbility; import com.projectkorra.projectkorra.ability.WaterAbility;
import com.projectkorra.projectkorra.util.DamageHandler;
import com.projectkorra.projectkorra.util.TempBlock; import com.projectkorra.projectkorra.util.TempBlock;
import org.bukkit.Location; import org.bukkit.Location;
@ -255,7 +256,7 @@ public class WaterSpoutWave extends WaterAbility {
if (entity != this.player && entity instanceof LivingEntity && !affectedEntities.contains(entity)) { if (entity != this.player && entity instanceof LivingEntity && !affectedEntities.contains(entity)) {
affectedEntities.add(entity); affectedEntities.add(entity);
final double augment = getNightFactor(player.getWorld()); final double augment = getNightFactor(player.getWorld());
GeneralMethods.damageEntity(this, entity, damage); DamageHandler.damageEntity(entity, damage, this);
final Player fplayer = this.player; final Player fplayer = this.player;
final Entity fent = entity; final Entity fent = entity;