Search in sources :

Example 31 with GameRunnable

use of com.ebicep.warlords.util.warlords.GameRunnable in project Warlords by ebicep.

the class Consecrate method onActivate.

@Override
public boolean onActivate(WarlordsPlayer wp, Player player) {
    wp.subtractEnergy(energyCost);
    Utils.playGlobalSound(player.getLocation(), "paladin.consecrate.activation", 2, 1);
    Location location = player.getLocation().clone();
    ArmorStand consecrate = player.getLocation().getWorld().spawn(player.getLocation().clone().add(0, -2, 0), ArmorStand.class);
    consecrate.setMetadata("Consecrate - " + player.getName(), new FixedMetadataValue(Warlords.getInstance(), true));
    consecrate.setGravity(false);
    consecrate.setVisible(false);
    consecrate.setMarker(true);
    CircleEffect circleEffect = new CircleEffect(wp.getGame(), wp.getTeam(), location, radius, new CircumferenceEffect(ParticleEffect.VILLAGER_HAPPY, ParticleEffect.REDSTONE), new DoubleLineEffect(ParticleEffect.SPELL));
    BukkitTask task = Bukkit.getScheduler().runTaskTimer(Warlords.getInstance(), circleEffect::playEffects, 0, 1);
    new GameRunnable(wp.getGame()) {

        int timeLeft = 5;

        @Override
        public void run() {
            timeLeft--;
            PlayerFilter.entitiesAround(location, radius, 6, radius).aliveEnemiesOf(wp).forEach(warlordsPlayer -> {
                warlordsPlayer.addDamageInstance(wp, name, minDamageHeal, maxDamageHeal, critChance, critMultiplier, false);
            });
            if (timeLeft == 0) {
                consecrate.remove();
                this.cancel();
                task.cancel();
            }
        }
    }.runTaskTimer(0, 20);
    return true;
}
Also used : Utils(com.ebicep.warlords.util.warlords.Utils) GameRunnable(com.ebicep.warlords.util.warlords.GameRunnable) CircumferenceEffect(com.ebicep.warlords.effects.circle.CircumferenceEffect) Warlords(com.ebicep.warlords.Warlords) Player(org.bukkit.entity.Player) FixedMetadataValue(org.bukkit.metadata.FixedMetadataValue) PlayerFilter(com.ebicep.warlords.util.warlords.PlayerFilter) DoubleLineEffect(com.ebicep.warlords.effects.circle.DoubleLineEffect) Location(org.bukkit.Location) WarlordsPlayer(com.ebicep.warlords.player.WarlordsPlayer) ArmorStand(org.bukkit.entity.ArmorStand) BukkitTask(org.bukkit.scheduler.BukkitTask) CircleEffect(com.ebicep.warlords.effects.circle.CircleEffect) AbstractAbility(com.ebicep.warlords.classes.AbstractAbility) ParticleEffect(com.ebicep.warlords.effects.ParticleEffect) Bukkit(org.bukkit.Bukkit) DoubleLineEffect(com.ebicep.warlords.effects.circle.DoubleLineEffect) ArmorStand(org.bukkit.entity.ArmorStand) GameRunnable(com.ebicep.warlords.util.warlords.GameRunnable) BukkitTask(org.bukkit.scheduler.BukkitTask) CircleEffect(com.ebicep.warlords.effects.circle.CircleEffect) FixedMetadataValue(org.bukkit.metadata.FixedMetadataValue) CircumferenceEffect(com.ebicep.warlords.effects.circle.CircumferenceEffect) Location(org.bukkit.Location)

Example 32 with GameRunnable

use of com.ebicep.warlords.util.warlords.GameRunnable in project Warlords by ebicep.

the class DeathsDebt method onActivation.

@Override
protected void onActivation(WarlordsPlayer wp, Player player, ArmorStand totemStand) {
    final int ticksLeft = (4 + (2 * (int) Math.round((double) wp.getHealth() / wp.getMaxHealth()))) * 20;
    DeathsDebt tempDeathsDebt = new DeathsDebt();
    CircleEffect circle = new CircleEffect(wp, totemStand.getLocation().clone().add(0, 1.25, 0), respiteRadius);
    circle.addEffect(new CircumferenceEffect(ParticleEffect.SPELL));
    circle.addEffect(new DoubleLineEffect(ParticleEffect.REDSTONE));
    BukkitTask particles = Bukkit.getScheduler().runTaskTimer(Warlords.getInstance(), circle::playEffects, 0, 1);
    AtomicReference<RegularCooldown<DeathsDebt>> deathsDebtCooldown = new AtomicReference<>();
    RegularCooldown<DeathsDebt> spiritRespiteCooldown = new RegularCooldown<DeathsDebt>("Spirits Respite", "RESP", DeathsDebt.class, tempDeathsDebt, wp, CooldownTypes.ABILITY, cooldownManagerRespite -> {
        tempDeathsDebt.setInDebt(true);
        // beginning debt
        deathsDebtCooldown.set(new RegularCooldown<>(name, "DEBT", DeathsDebt.class, tempDeathsDebt, wp, CooldownTypes.ABILITY, cooldownManagerDebt -> {
            // final damage tick
            wp.getWorld().spigot().strikeLightningEffect(totemStand.getLocation(), false);
            // Enemy damage
            PlayerFilter.entitiesAround(totemStand, debtRadius, debtRadius - 1, debtRadius).aliveEnemiesOf(wp).forEach((nearPlayer) -> {
                nearPlayer.addDamageInstance(wp, name, tempDeathsDebt.getDelayedDamage() * .15f, tempDeathsDebt.getDelayedDamage() * .15f, critChance, critMultiplier, false);
            });
            // 6 damage waves, stop the function
            totemStand.remove();
            particles.cancel();
        }, 6 * 20));
        wp.getCooldownManager().addCooldown(deathsDebtCooldown.get());
        if (!tempDeathsDebt.playerInRadius) {
            wp.sendMessage("§7You walked outside your §dDeath's Debt §7radius");
        } else {
            wp.sendMessage("§c\u00AB §2Spirit's Respite §7delayed §c" + Math.round(tempDeathsDebt.getDelayedDamage()) + " §7damage. §dYour debt must now be paid.");
        }
        circle.replaceEffects(e -> e instanceof DoubleLineEffect, new DoubleLineEffect(ParticleEffect.SPELL_WITCH));
        circle.setRadius(debtRadius);
        // blue to purple totem
        totemStand.setHelmet(new ItemStack(Material.DARK_OAK_FENCE_GATE));
    }, ticksLeft) {

        @Override
        public void onDamageFromSelf(WarlordsDamageHealingEvent event, float currentDamageValue, boolean isCrit) {
            tempDeathsDebt.addDelayedDamage(currentDamageValue);
        }
    };
    wp.getCooldownManager().addCooldown(spiritRespiteCooldown);
    new GameRunnable(wp.getGame()) {

        int counter = 0;

        @Override
        public void run() {
            if (wp.isDead()) {
                totemStand.remove();
                particles.cancel();
                this.cancel();
            } else {
                if (wp.getWorld() != totemStand.getWorld()) {
                    totemStand.remove();
                    particles.cancel();
                    this.cancel();
                    return;
                }
                boolean isPlayerInRadius = wp.getLocation().distanceSquared(totemStand.getLocation()) < respiteRadius * respiteRadius;
                if (!isPlayerInRadius && wp.getCooldownManager().hasCooldown(tempDeathsDebt) && !tempDeathsDebt.isInDebt()) {
                    tempDeathsDebt.setInDebt(true);
                    tempDeathsDebt.setPlayerInRadius(false);
                    spiritRespiteCooldown.setTicksLeft(0);
                }
                // every second
                if (counter % 20 == 0) {
                    if (!tempDeathsDebt.isInDebt()) {
                        // respite
                        Utils.playGlobalSound(totemStand.getLocation(), "shaman.earthlivingweapon.impact", 2, 1.5F);
                        wp.sendMessage(ChatColor.GREEN + "\u00BB §2Spirit's Respite §7delayed §c" + Math.round(tempDeathsDebt.getDelayedDamage()) + " §7damage. §6" + Math.round(spiritRespiteCooldown.getTicksLeft() / 20f) + " §7seconds left.");
                    } else {
                        // during debt
                        onDebtTick(wp, totemStand, tempDeathsDebt);
                    }
                }
                counter++;
                if (deathsDebtCooldown.get() == null) {
                    return;
                }
                if (!wp.getCooldownManager().hasCooldown(deathsDebtCooldown.get())) {
                    totemStand.remove();
                    particles.cancel();
                    this.cancel();
                }
            }
        }
    }.runTaskTimer(2, 0);
}
Also used : Utils(com.ebicep.warlords.util.warlords.Utils) GameRunnable(com.ebicep.warlords.util.warlords.GameRunnable) AbstractTotemBase(com.ebicep.warlords.abilties.internal.AbstractTotemBase) CircumferenceEffect(com.ebicep.warlords.effects.circle.CircumferenceEffect) Warlords(com.ebicep.warlords.Warlords) CooldownTypes(com.ebicep.warlords.player.cooldowns.CooldownTypes) Player(org.bukkit.entity.Player) AtomicReference(java.util.concurrent.atomic.AtomicReference) PlayerFilter(com.ebicep.warlords.util.warlords.PlayerFilter) ItemStack(org.bukkit.inventory.ItemStack) DoubleLineEffect(com.ebicep.warlords.effects.circle.DoubleLineEffect) RegularCooldown(com.ebicep.warlords.player.cooldowns.cooldowns.RegularCooldown) Location(org.bukkit.Location) WarlordsPlayer(com.ebicep.warlords.player.WarlordsPlayer) ArmorStand(org.bukkit.entity.ArmorStand) BukkitTask(org.bukkit.scheduler.BukkitTask) CooldownFilter(com.ebicep.warlords.player.cooldowns.CooldownFilter) ChatColor(org.bukkit.ChatColor) CircleEffect(com.ebicep.warlords.effects.circle.CircleEffect) WarlordsDamageHealingEvent(com.ebicep.warlords.events.WarlordsDamageHealingEvent) ParticleEffect(com.ebicep.warlords.effects.ParticleEffect) Material(org.bukkit.Material) Bukkit(org.bukkit.Bukkit) RegularCooldown(com.ebicep.warlords.player.cooldowns.cooldowns.RegularCooldown) DoubleLineEffect(com.ebicep.warlords.effects.circle.DoubleLineEffect) BukkitTask(org.bukkit.scheduler.BukkitTask) CircumferenceEffect(com.ebicep.warlords.effects.circle.CircumferenceEffect) AtomicReference(java.util.concurrent.atomic.AtomicReference) GameRunnable(com.ebicep.warlords.util.warlords.GameRunnable) CircleEffect(com.ebicep.warlords.effects.circle.CircleEffect) WarlordsDamageHealingEvent(com.ebicep.warlords.events.WarlordsDamageHealingEvent) ItemStack(org.bukkit.inventory.ItemStack)

Example 33 with GameRunnable

use of com.ebicep.warlords.util.warlords.GameRunnable in project Warlords by ebicep.

the class EarthenSpike method onActivate.

@Override
public boolean onActivate(WarlordsPlayer wp, Player player) {
    Location location = player.getLocation();
    for (WarlordsPlayer p : PlayerFilter.entitiesAround(player, radius, radius, radius).aliveEnemiesOf(wp).lookingAtFirst(wp)) {
        if (Utils.isLookingAt(player, p.getEntity()) && Utils.hasLineOfSight(player, p.getEntity())) {
            PacketPlayOutAnimation playOutAnimation = new PacketPlayOutAnimation(((CraftPlayer) player).getHandle(), 0);
            ((CraftPlayer) player).getHandle().playerConnection.sendPacket(playOutAnimation);
            FallingBlock block = spawnFallingBlock(location, location);
            EarthenSpikeBlock earthenSpikeBlock = new EarthenSpikeBlock(new CustomFallingBlock(block, block.getLocation().getY() - .2), p, wp);
            wp.subtractEnergy(energyCost);
            new GameRunnable(wp.getGame()) {

                private final float SPEED = 1;

                private final float SPEED_SQUARED = SPEED * SPEED;

                private final Location spikeLoc = location;

                {
                    spikeLoc.setY(spikeLoc.getBlockY());
                }

                @Override
                public void run() {
                    earthenSpikeBlock.addDuration();
                    List<CustomFallingBlock> customFallingBlocks = earthenSpikeBlock.getFallingBlocks();
                    WarlordsPlayer target = earthenSpikeBlock.getTarget();
                    WarlordsPlayer user = earthenSpikeBlock.getUser();
                    if (earthenSpikeBlock.getDuration() % 5 == 1) {
                        Utils.playGlobalSound(spikeLoc, REPEATING_SOUND[(earthenSpikeBlock.getDuration() / 5) % 4], 2, 1);
                    }
                    if (earthenSpikeBlock.getDuration() > 30) {
                        // out of time
                        earthenSpikeBlock.setDuration(-1);
                        this.cancel();
                        return;
                    }
                    Vector change = target.getLocation().toVector().subtract(spikeLoc.toVector());
                    change.setY(0);
                    double length = change.lengthSquared();
                    if (length > SPEED_SQUARED) {
                        change.multiply(1 / (Math.sqrt(length) / SPEED));
                        spikeLoc.add(change);
                        // moving vertically
                        if (target.getLocation().getY() < spikeLoc.getY()) {
                            for (int j = 0; j < 10; j++) {
                                if (spikeLoc.clone().add(0, -1, 0).getBlock().getType() == Material.AIR) {
                                    spikeLoc.add(0, -1, 0);
                                } else {
                                    break;
                                }
                            }
                        } else {
                            for (int j = 0; j < 10; j++) {
                                if (spikeLoc.getBlock().getType() != Material.AIR) {
                                    spikeLoc.add(0, 1, 0);
                                } else {
                                    break;
                                }
                            }
                        }
                        // temp fix for block glitch
                        for (int i = 0; i < 10; i++) {
                            if (spikeLoc.getBlock().getType() != Material.AIR) {
                                spikeLoc.add(0, 1, 0);
                            } else {
                                break;
                            }
                        }
                        FallingBlock newBlock = spawnFallingBlock(spikeLoc, spikeLoc);
                        customFallingBlocks.add(new CustomFallingBlock(newBlock, newBlock.getLocation().getY() - .20));
                    } else {
                        // impact
                        Location targetLocation = target.getLocation();
                        for (WarlordsPlayer spikeTarget : PlayerFilter.entitiesAround(targetLocation, 2.5, 2.5, 2.5).aliveEnemiesOf(wp)) {
                            spikeTarget.addDamageInstance(user, name, minDamageHeal, maxDamageHeal, critChance, critMultiplier, false);
                            // todo tweak distance to ground where you cant get kbed up (1.81 is max jump blocks, double spike kb might be possible with this)
                            if (Utils.getDistance(spikeTarget.getEntity(), .1) < 1.81) {
                                spikeTarget.setVelocity(new Vector(0, .625, 0));
                            }
                        }
                        Utils.playGlobalSound(wp.getLocation(), "shaman.earthenspike.impact", 2, 1);
                        targetLocation.setYaw(0);
                        for (int i = 0; i < 100; i++) {
                            if (targetLocation.clone().add(0, -1, 0).getBlock().getType() == Material.AIR) {
                                targetLocation.add(0, -1, 0);
                            } else {
                                break;
                            }
                        }
                        ArmorStand stand = (ArmorStand) targetLocation.getWorld().spawnEntity(targetLocation.add(0, -.6, 0), EntityType.ARMOR_STAND);
                        stand.setHelmet(new ItemStack(Material.BROWN_MUSHROOM));
                        stand.setGravity(false);
                        stand.setVisible(false);
                        stand.setMarker(true);
                        new BukkitRunnable() {

                            @Override
                            public void run() {
                                stand.remove();
                                this.cancel();
                            }
                        }.runTaskTimer(Warlords.getInstance(), 10, 0);
                        earthenSpikeBlock.setDuration(-1);
                        this.cancel();
                    }
                    if (target.isDead()) {
                        earthenSpikeBlock.setDuration(-1);
                        this.cancel();
                    }
                }
            }.runTaskTimer(0, 2);
            new GameRunnable(wp.getGame()) {

                @Override
                public void run() {
                    for (CustomFallingBlock fallingBlock : earthenSpikeBlock.getFallingBlocks()) {
                        FallingBlock block = fallingBlock.getBlock();
                        if (block.isValid()) {
                            if (block.getLocation().getY() <= fallingBlock.getyLevelToRemove()) {
                                // || block.getTicksLived() >= 10) {
                                block.remove();
                                earthenSpikeBlock.addRemoved();
                            }
                        }
                    }
                    if (earthenSpikeBlock.getDuration() == -1 && earthenSpikeBlock.getRemoved() == earthenSpikeBlock.getFallingBlocks().size()) {
                        this.cancel();
                    }
                }
            }.runTaskTimer(0, 0);
            break;
        }
    }
    return true;
}
Also used : WarlordsPlayer(com.ebicep.warlords.player.WarlordsPlayer) BukkitRunnable(org.bukkit.scheduler.BukkitRunnable) CraftPlayer(org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer) FallingBlock(org.bukkit.entity.FallingBlock) GameRunnable(com.ebicep.warlords.util.warlords.GameRunnable) ArmorStand(org.bukkit.entity.ArmorStand) ArrayList(java.util.ArrayList) List(java.util.List) ItemStack(org.bukkit.inventory.ItemStack) Vector(org.bukkit.util.Vector) PacketPlayOutAnimation(net.minecraft.server.v1_8_R3.PacketPlayOutAnimation) Location(org.bukkit.Location)

Example 34 with GameRunnable

use of com.ebicep.warlords.util.warlords.GameRunnable in project Warlords by ebicep.

the class Earthliving method onActivate.

@Override
public boolean onActivate(WarlordsPlayer wp, Player player) {
    wp.subtractEnergy(energyCost);
    Earthliving tempEarthliving = new Earthliving();
    final boolean[] firstProc = { true };
    wp.getCooldownManager().addCooldown(new RegularCooldown<Earthliving>(name, "EARTH", Earthliving.class, tempEarthliving, wp, CooldownTypes.ABILITY, cooldownManager -> {
    }, duration * 20) {

        @Override
        public void onEndFromAttacker(WarlordsDamageHealingEvent event, float currentDamageValue, boolean isCrit) {
            if (event.getAbility().isEmpty()) {
                WarlordsPlayer victim = event.getPlayer();
                WarlordsPlayer attacker = event.getAttacker();
                int earthlivingActivate = (int) (Math.random() * 100);
                if (firstProc[0]) {
                    firstProc[0] = false;
                    earthlivingActivate = 0;
                }
                if (earthlivingActivate < procChance) {
                    attacker.addHealingInstance(attacker, "Earthliving Weapon", 132 * 2.4f, 179 * 2.4f, 25, 200, false, false);
                    victim.getGameState().getGame().forEachOnlinePlayerWithoutSpectators((p, t) -> {
                        p.playSound(victim.getLocation(), "shaman.earthlivingweapon.impact", 2, 1);
                    });
                    for (WarlordsPlayer nearPlayer : PlayerFilter.entitiesAround(attacker, 6, 6, 6).aliveTeammatesOfExcludingSelf(attacker).limit(2)) {
                        nearPlayer.addHealingInstance(attacker, "Earthliving Weapon", 132 * 2.4f, 179 * 2.4f, 25, 200, false, false);
                    }
                }
            }
        }
    });
    Utils.playGlobalSound(player.getLocation(), "shaman.earthlivingweapon.activation", 2, 1);
    new GameRunnable(wp.getGame()) {

        @Override
        public void run() {
            if (wp.getCooldownManager().hasCooldown(tempEarthliving)) {
                Location location = wp.getLocation();
                location.add(0, 1.2, 0);
                ParticleEffect.VILLAGER_HAPPY.display(0.3F, 0.3F, 0.3F, 0.1F, 2, location, 500);
            } else {
                this.cancel();
            }
        }
    }.runTaskTimer(0, 4);
    return true;
}
Also used : Utils(com.ebicep.warlords.util.warlords.Utils) GameRunnable(com.ebicep.warlords.util.warlords.GameRunnable) RegularCooldown(com.ebicep.warlords.player.cooldowns.cooldowns.RegularCooldown) Location(org.bukkit.Location) WarlordsPlayer(com.ebicep.warlords.player.WarlordsPlayer) CooldownTypes(com.ebicep.warlords.player.cooldowns.CooldownTypes) Player(org.bukkit.entity.Player) AbstractAbility(com.ebicep.warlords.classes.AbstractAbility) WarlordsDamageHealingEvent(com.ebicep.warlords.events.WarlordsDamageHealingEvent) ParticleEffect(com.ebicep.warlords.effects.ParticleEffect) PlayerFilter(com.ebicep.warlords.util.warlords.PlayerFilter) WarlordsPlayer(com.ebicep.warlords.player.WarlordsPlayer) GameRunnable(com.ebicep.warlords.util.warlords.GameRunnable) WarlordsDamageHealingEvent(com.ebicep.warlords.events.WarlordsDamageHealingEvent) Location(org.bukkit.Location)

Example 35 with GameRunnable

use of com.ebicep.warlords.util.warlords.GameRunnable in project Warlords by ebicep.

the class FallenSouls method onActivate.

@Override
public boolean onActivate(WarlordsPlayer wp, Player player) {
    Location location = player.getLocation();
    ArmorStand fallenSoulLeft = player.getWorld().spawn(location.clone().subtract(0, .5, 0).add(Utils.getLeftDirection(location).multiply(.5)), ArmorStand.class);
    Location locationLeft = player.getLocation().add(player.getLocation().getDirection().multiply(.2));
    // - (int)(location.getPitch()/-10f * 1.6));
    locationLeft.setYaw(location.getYaw() - 13);
    ArmorStand fallenSoulMiddle = player.getWorld().spawn(location.clone().subtract(0, .5, 0), ArmorStand.class);
    Location locationMiddle = player.getLocation().add(player.getLocation().getDirection().multiply(.2));
    locationMiddle.setYaw(location.getYaw() - 0);
    ArmorStand fallenSoulRight = player.getWorld().spawn(location.clone().subtract(0, .5, 0).add(Utils.getRightDirection(location).multiply(.5)), ArmorStand.class);
    Location locationRight = player.getLocation().add(player.getLocation().getDirection().multiply(.2));
    // + (int)(location.getPitch()/-10f * 1.6));
    locationRight.setYaw(location.getYaw() + 13);
    FallenSoul fallenSoul = new FallenSoul(wp, fallenSoulLeft, fallenSoulMiddle, fallenSoulRight, player.getLocation(), player.getLocation(), player.getLocation(), locationLeft.getDirection(), locationMiddle.getDirection(), locationRight.getDirection(), this);
    wp.subtractEnergy(energyCost);
    Utils.playGlobalSound(player.getLocation(), "shaman.lightningbolt.impact", 2, 1.5f);
    new GameRunnable(wp.getGame()) {

        @Override
        public void run() {
            if ((fallenSoul.isLeftRemoved() && fallenSoul.isMiddleRemoved() && fallenSoul.isRightRemoved())) {
                this.cancel();
            }
            ArmorStand leftSoul = fallenSoul.getFallenSoulLeft();
            ArmorStand middleSoul = fallenSoul.getFallenSoulMiddle();
            ArmorStand rightSoul = fallenSoul.getFallenSoulRight();
            leftSoul.teleport(leftSoul.getLocation().add(fallenSoul.getDirectionLeft().clone().multiply(fallenSoulSpeed)));
            middleSoul.teleport(middleSoul.getLocation().add(fallenSoul.getDirectionMiddle().clone().multiply(fallenSoulSpeed)));
            rightSoul.teleport(rightSoul.getLocation().add(fallenSoul.getDirectionRight().clone().multiply(fallenSoulSpeed)));
            List<Entity> nearLeft = (List<Entity>) leftSoul.getWorld().getNearbyEntities(leftSoul.getLocation().clone().add(0, 2, 0), fallenSoulHitBox, 1, fallenSoulHitBox);
            List<Entity> nearMiddle = (List<Entity>) middleSoul.getWorld().getNearbyEntities(middleSoul.getLocation().clone().add(0, 2, 0), fallenSoulHitBox, 1, fallenSoulHitBox);
            List<Entity> nearRight = (List<Entity>) rightSoul.getWorld().getNearbyEntities(rightSoul.getLocation().clone().add(0, 2, 0), fallenSoulHitBox, 1, fallenSoulHitBox);
            damageNearByPlayers(nearLeft, wp, fallenSoul);
            damageNearByPlayers(nearMiddle, wp, fallenSoul);
            damageNearByPlayers(nearRight, wp, fallenSoul);
            ParticleEffect.SPELL_WITCH.display(0, 0, 0, 0, 1, leftSoul.getLocation().add(0, 1.5, 0), 500);
            ParticleEffect.SPELL_WITCH.display(0, 0, 0, 0, 1, middleSoul.getLocation().add(0, 1.5, 0), 500);
            ParticleEffect.SPELL_WITCH.display(0, 0, 0, 0, 1, rightSoul.getLocation().add(0, 1.5, 0), 500);
            if (!fallenSoul.isLeftRemoved() && leftSoul.getLocation().getWorld().getBlockAt(leftSoul.getLocation().clone().add(0, 2, 0)).getType() != Material.AIR || fallenSoul.getFallenSoulLeft().getTicksLived() > 25 / fallenSoulSpeed * 1.2) {
                ParticleEffect.EXPLOSION_LARGE.display(0, 0, 0, 0.7F, 1, leftSoul.getLocation().add(0, 1, 0), 500);
                fallenSoul.getFallenSoulLeft().remove();
                fallenSoul.setLeftRemoved(true);
            }
            if (!fallenSoul.isMiddleRemoved() && middleSoul.getLocation().getWorld().getBlockAt(middleSoul.getLocation().clone().add(0, 2, 0)).getType() != Material.AIR || fallenSoul.getFallenSoulMiddle().getTicksLived() > 25 / fallenSoulSpeed * 1.2) {
                ParticleEffect.EXPLOSION_LARGE.display(0, 0, 0, 0.7F, 1, middleSoul.getLocation().add(0, 1, 0), 500);
                fallenSoul.getFallenSoulMiddle().remove();
                fallenSoul.setMiddleRemoved(true);
            }
            if (!fallenSoul.isRightRemoved() && rightSoul.getLocation().getWorld().getBlockAt(rightSoul.getLocation().clone().add(0, 2, 0)).getType() != Material.AIR || fallenSoul.getFallenSoulRight().getTicksLived() > 25 / fallenSoulSpeed * 1.2) {
                ParticleEffect.EXPLOSION_LARGE.display(0, 0, 0, 0.7F, 1, rightSoul.getLocation().add(0, 1, 0), 500);
                fallenSoul.getFallenSoulRight().remove();
                fallenSoul.setRightRemoved(true);
            }
        }
    }.runTaskTimer(0, 0);
    return true;
}
Also used : Entity(org.bukkit.entity.Entity) ArmorStand(org.bukkit.entity.ArmorStand) GameRunnable(com.ebicep.warlords.util.warlords.GameRunnable) ArrayList(java.util.ArrayList) List(java.util.List) Location(org.bukkit.Location)

Aggregations

GameRunnable (com.ebicep.warlords.util.warlords.GameRunnable)53 WarlordsPlayer (com.ebicep.warlords.player.WarlordsPlayer)39 Location (org.bukkit.Location)34 Player (org.bukkit.entity.Player)23 Utils (com.ebicep.warlords.util.warlords.Utils)21 CooldownTypes (com.ebicep.warlords.player.cooldowns.CooldownTypes)17 AbstractAbility (com.ebicep.warlords.classes.AbstractAbility)16 ParticleEffect (com.ebicep.warlords.effects.ParticleEffect)16 RegularCooldown (com.ebicep.warlords.player.cooldowns.cooldowns.RegularCooldown)16 PlayerFilter (com.ebicep.warlords.util.warlords.PlayerFilter)16 WarlordsDamageHealingEvent (com.ebicep.warlords.events.WarlordsDamageHealingEvent)13 ItemStack (org.bukkit.inventory.ItemStack)13 ArmorStand (org.bukkit.entity.ArmorStand)12 Vector (org.bukkit.util.Vector)11 ChatColor (org.bukkit.ChatColor)10 Material (org.bukkit.Material)10 Warlords (com.ebicep.warlords.Warlords)9 ArrayList (java.util.ArrayList)9 List (java.util.List)9 Nonnull (javax.annotation.Nonnull)9