Search in sources :

Example 1 with PacketPlayOutAnimation

use of net.minecraft.server.v1_16_R3.PacketPlayOutAnimation in project Warlords by ebicep.

the class HolyRadianceCrusader method chain.

@Override
public void chain(WarlordsPlayer wp, Player player) {
    for (WarlordsPlayer markTarget : PlayerFilter.entitiesAround(player, markRadius, markRadius, markRadius).aliveTeammatesOfExcludingSelf(wp).lookingAtFirst(wp).limit(1)) {
        if (Utils.isLookingAtMark(player, markTarget.getEntity()) && Utils.hasLineOfSight(player, markTarget.getEntity())) {
            wp.subtractEnergy(energyCost);
            Utils.playGlobalSound(player.getLocation(), "paladin.consecrate.activation", 2, 0.65f);
            PacketPlayOutAnimation playOutAnimation = new PacketPlayOutAnimation(((CraftPlayer) player).getHandle(), 0);
            ((CraftPlayer) player).getHandle().playerConnection.sendPacket(playOutAnimation);
            // chain particles
            EffectUtils.playParticleLinkAnimation(player.getLocation(), markTarget.getLocation(), 255, 170, 0, 1);
            EffectUtils.playChainAnimation(wp, markTarget, new ItemStack(Material.PUMPKIN), 20);
            HolyRadianceCrusader tempMark = new HolyRadianceCrusader(minDamageHeal, maxDamageHeal, cooldown, energyCost, critChance, critMultiplier);
            markTarget.getCooldownManager().addRegularCooldown(name, "CRUS MARK", HolyRadianceCrusader.class, tempMark, wp, CooldownTypes.BUFF, cooldownManager -> {
            }, markDuration * 20);
            markTarget.getSpeed().addSpeedModifier("Crusader Mark Speed", 25, 20 * markDuration, "BASE");
            player.sendMessage(WarlordsPlayer.RECEIVE_ARROW + ChatColor.GRAY + " You have marked " + ChatColor.YELLOW + markTarget.getName() + ChatColor.GRAY + "!");
            markTarget.sendMessage(WarlordsPlayer.RECEIVE_ARROW + ChatColor.GRAY + " You have been granted " + ChatColor.YELLOW + "Crusader's Mark" + ChatColor.GRAY + " by " + wp.getName() + "!");
            new GameRunnable(wp.getGame()) {

                @Override
                public void run() {
                    if (markTarget.getCooldownManager().hasCooldown(tempMark)) {
                        Location playerLoc = markTarget.getLocation();
                        Location particleLoc = playerLoc.clone();
                        for (int i = 0; i < 4; i++) {
                            for (int j = 0; j < 10; j++) {
                                double angle = j / 8D * Math.PI * 2;
                                double width = 1;
                                particleLoc.setX(playerLoc.getX() + Math.sin(angle) * width);
                                particleLoc.setY(playerLoc.getY() + i / 6D);
                                particleLoc.setZ(playerLoc.getZ() + Math.cos(angle) * width);
                                ParticleEffect.REDSTONE.display(new ParticleEffect.OrdinaryColor(255, 170, 0), particleLoc, 500);
                            }
                        }
                    } else {
                        this.cancel();
                    }
                }
            }.runTaskTimer(0, 10);
        } else {
            player.sendMessage("§cYour mark was out of range or you did not target a player!");
        }
    }
}
Also used : WarlordsPlayer(com.ebicep.warlords.player.WarlordsPlayer) GameRunnable(com.ebicep.warlords.util.warlords.GameRunnable) CraftPlayer(org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer) ItemStack(org.bukkit.inventory.ItemStack) PacketPlayOutAnimation(net.minecraft.server.v1_8_R3.PacketPlayOutAnimation) Location(org.bukkit.Location)

Example 2 with PacketPlayOutAnimation

use of net.minecraft.server.v1_16_R3.PacketPlayOutAnimation in project Warlords by ebicep.

the class AbstractStrikeBase method onActivate.

@Override
public boolean onActivate(@Nonnull WarlordsPlayer wp, @Nonnull Player player) {
    PlayerFilter.entitiesAround(wp, 4.8, 4.8, 4.8).aliveEnemiesOf(wp).closestFirst(wp).requireLineOfSight(wp).lookingAtFirst(wp).first((nearPlayer) -> {
        if (Utils.isLookingAt(player, nearPlayer.getEntity()) && Utils.hasLineOfSight(player, nearPlayer.getEntity())) {
            PacketPlayOutAnimation playOutAnimation = new PacketPlayOutAnimation(((CraftPlayer) player).getHandle(), 0);
            ((CraftPlayer) player).getHandle().playerConnection.sendPacket(playOutAnimation);
            Optional<HammerOfLight> optionalHammer = new CooldownFilter<>(wp, RegularCooldown.class).filterCooldownClassAndMapToObjectsOfClass(HammerOfLight.class).findAny();
            if (optionalHammer.isPresent()) {
                wp.subtractEnergy(energyCost - (optionalHammer.get().isCrownOfLight() ? 10 : 0));
            } else {
                wp.subtractEnergy(energyCost);
            }
            if (this instanceof AvengersStrike || this instanceof CrusadersStrike || this instanceof ProtectorsStrike) {
                Utils.playGlobalSound(nearPlayer.getLocation(), "paladin.paladinstrike.activation", 2, 1);
                randomHitEffect(nearPlayer, 5, 255, 0, 0);
                ParticleEffect.SPELL.display((float) ((Math.random() * 2) - 1), (float) ((Math.random() * 2) - 1), (float) ((Math.random() * 2) - 1), 1, 4, nearPlayer.getLocation().clone().add(0, 1, 0), 500);
            } else if (this instanceof WoundingStrikeBerserker || this instanceof WoundingStrikeDefender || this instanceof CripplingStrike) {
                Utils.playGlobalSound(nearPlayer.getLocation(), "warrior.mortalstrike.impact", 2, 1);
                randomHitEffect(nearPlayer, 7, 255, 0, 0);
            } else if (this instanceof JudgementStrike) {
                Utils.playGlobalSound(nearPlayer.getLocation(), "warrior.revenant.orbsoflife", 2, 1.7f);
                Utils.playGlobalSound(nearPlayer.getLocation(), "mage.frostbolt.activation", 2, 2);
                randomHitEffect(nearPlayer, 7, 255, 255, 255);
            } else if (this instanceof RighteousStrike) {
                Utils.playGlobalSound(nearPlayer.getLocation(), "rogue.vindicatorstrike.activation", 2, 0.7f);
                Utils.playGlobalSound(nearPlayer.getLocation(), "shaman.earthenspike.impact", 2, 2);
                randomHitEffect(nearPlayer, 7, 255, 255, 255);
            } else if (this instanceof ImpalingStrike) {
                Utils.playGlobalSound(nearPlayer.getLocation(), "rogue.apothecarystrike.activation", 2, 0.5f);
                Utils.playGlobalSound(nearPlayer.getLocation(), "mage.fireball.activation", 2, 1.8f);
                randomHitEffect(nearPlayer, 7, 100, 255, 100);
            }
            onHit(wp, player, nearPlayer);
        }
    });
    return true;
}
Also used : CooldownFilter(com.ebicep.warlords.player.cooldowns.CooldownFilter) CraftPlayer(org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer) PacketPlayOutAnimation(net.minecraft.server.v1_8_R3.PacketPlayOutAnimation)

Example 3 with PacketPlayOutAnimation

use of net.minecraft.server.v1_16_R3.PacketPlayOutAnimation in project Warlords by ebicep.

the class AbstractPlayerClass method sendRightClickPacket.

private void sendRightClickPacket(Player player) {
    PacketPlayOutAnimation playOutAnimation = new PacketPlayOutAnimation(((CraftPlayer) player).getHandle(), 0);
    ((CraftPlayer) player).getHandle().playerConnection.sendPacket(playOutAnimation);
}
Also used : CraftPlayer(org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer) PacketPlayOutAnimation(net.minecraft.server.v1_8_R3.PacketPlayOutAnimation)

Example 4 with PacketPlayOutAnimation

use of net.minecraft.server.v1_16_R3.PacketPlayOutAnimation in project PublicCrafters by BananaPuncher714.

the class ContainerManager_v1_13_R1 method animate.

@Override
public void animate(Player player) {
    EntityPlayer NMSPlayer = ((CraftPlayer) player).getHandle();
    broadcastPacket(player, new PacketPlayOutAnimation(NMSPlayer, ThreadLocalRandom.current().nextInt(2) == 1 ? 0 : 3));
}
Also used : EntityPlayer(net.minecraft.server.v1_13_R1.EntityPlayer) CraftPlayer(org.bukkit.craftbukkit.v1_13_R1.entity.CraftPlayer) PacketPlayOutAnimation(net.minecraft.server.v1_13_R1.PacketPlayOutAnimation)

Example 5 with PacketPlayOutAnimation

use of net.minecraft.server.v1_16_R3.PacketPlayOutAnimation in project PublicCrafters by BananaPuncher714.

the class ContainerManager_v1_11_R1 method animate.

@Override
public void animate(Player player) {
    EntityPlayer NMSPlayer = ((CraftPlayer) player).getHandle();
    broadcastPacket(player, new PacketPlayOutAnimation(NMSPlayer, ThreadLocalRandom.current().nextInt(2) == 1 ? 0 : 3));
}
Also used : EntityPlayer(net.minecraft.server.v1_11_R1.EntityPlayer) CraftPlayer(org.bukkit.craftbukkit.v1_11_R1.entity.CraftPlayer) PacketPlayOutAnimation(net.minecraft.server.v1_11_R1.PacketPlayOutAnimation)

Aggregations

PacketPlayOutAnimation (net.minecraft.server.v1_8_R3.PacketPlayOutAnimation)9 CraftPlayer (org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer)7 PacketPlayOutAnimation (net.minecraft.server.v1_16_R3.PacketPlayOutAnimation)4 WarlordsPlayer (com.ebicep.warlords.player.WarlordsPlayer)3 GameRunnable (com.ebicep.warlords.util.warlords.GameRunnable)3 PacketPlayOutAnimation (net.minecraft.server.v1_15_R1.PacketPlayOutAnimation)3 Location (org.bukkit.Location)3 Player (org.bukkit.entity.Player)3 ItemStack (org.bukkit.inventory.ItemStack)3 PacketPlayOutAnimation (net.minecraft.server.v1_10_R1.PacketPlayOutAnimation)2 PacketPlayOutAnimation (net.minecraft.server.v1_11_R1.PacketPlayOutAnimation)2 PacketPlayOutAnimation (net.minecraft.server.v1_12_R1.PacketPlayOutAnimation)2 PacketPlayOutAnimation (net.minecraft.server.v1_13_R2.PacketPlayOutAnimation)2 PacketPlayOutAnimation (net.minecraft.server.v1_14_R1.PacketPlayOutAnimation)2 EntityPlayer (net.minecraft.server.v1_15_R1.EntityPlayer)2 EntityPlayer (net.minecraft.server.v1_16_R3.EntityPlayer)2 EntityPlayer (net.minecraft.server.v1_8_R3.EntityPlayer)2 CraftPlayer (org.bukkit.craftbukkit.v1_15_R1.entity.CraftPlayer)2 ArmorStand (org.bukkit.entity.ArmorStand)2 CooldownFilter (com.ebicep.warlords.player.cooldowns.CooldownFilter)1