mirror of
https://github.com/TotalFreedomMC/TF-ProjectKorra.git
synced 2025-02-11 19:50:37 +00:00
Fixed Lightning Spread In Water
Fixed lightning not spreading in water
This commit is contained in:
parent
03ee42a6a6
commit
e5954562ae
1 changed files with 9 additions and 5 deletions
|
@ -10,6 +10,8 @@ import org.bukkit.entity.Entity;
|
|||
import org.bukkit.entity.LightningStrike;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.entity.EntityDamageEvent;
|
||||
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
|
||||
|
||||
import com.projectkorra.ProjectKorra.Methods;
|
||||
import com.projectkorra.ProjectKorra.ProjectKorra;
|
||||
|
@ -148,12 +150,14 @@ public class Lightning {
|
|||
|
||||
double damage = maxdamage - (distance / strikeradius) * .5;
|
||||
|
||||
if (Methods.isWater(strike.getLocation().getBlock())) {
|
||||
for (Entity en: Methods.getEntitiesAroundPoint(strike.getLocation(), WaterAreaOfEffect)) {
|
||||
if ((getTargetLocation().getBlock().getType() == Material.WATER) || (getTargetLocation().getBlock().getType() == Material.STATIONARY_WATER)) {
|
||||
for (Entity en: Methods.getEntitiesAroundPoint(getTargetLocation().getBlock().getLocation(), WaterAreaOfEffect)) {
|
||||
if (en instanceof LivingEntity) {
|
||||
if (Methods.isWater(en.getLocation().getBlock())) {
|
||||
Methods.damageEntity(player, entity, (int) damage);
|
||||
Methods.breakBreathbendingHold(entity);
|
||||
LivingEntity le = (LivingEntity) en;
|
||||
if ((le.getLocation().getBlock().getType() == Material.WATER) || (le.getLocation().getBlock().getType() == Material.STATIONARY_WATER)) {
|
||||
le.damage((int) damage);
|
||||
le.setLastDamageCause(new EntityDamageEvent(player, DamageCause.ENTITY_ATTACK, damage));
|
||||
Methods.breakBreathbendingHold(le);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue