Search in sources :

Example 1 with DragonFireball

use of org.bukkit.entity.DragonFireball in project SwissKnife by EgirlsNationDev.

the class DraconiteAbilityHandler method handleSwordAbility.

public void handleSwordAbility(Player player, @Nullable EquipmentSlot equipmentSlot, AbilityCooldownHandler cooldownHandler) {
    if (equipmentSlot != null) {
        if (equipmentSlot.equals(EquipmentSlot.HAND)) {
            player.swingMainHand();
        } else if (equipmentSlot.equals(EquipmentSlot.OFF_HAND)) {
            player.swingOffHand();
        }
    }
    if (!cooldownHandler.isOnSwordCooldown(player)) {
        DragonFireball fireball = player.getWorld().spawn(player.getEyeLocation(), DragonFireball.class);
        fireball.setShooter(player);
        fireball.setCustomName("CusFireBallSwissKnife");
        fireball.setVelocity(player.getLocation().getDirection().multiply(3));
        cooldownHandler.setSwordCooldown(player.getUniqueId(), System.currentTimeMillis());
        player.playSound(player.getLocation(), Sound.ENTITY_ENDER_DRAGON_SHOOT, SoundCategory.PLAYERS, 100, 0);
    } else {
        player.spigot().sendMessage(ChatMessageType.ACTION_BAR, TextComponent.fromLegacyText(ChatColor.RED + cooldownHandler.getCooldownMessage(cooldownHandler.getSwordRemainingTime(player))));
    }
}
Also used : DragonFireball(org.bukkit.entity.DragonFireball)

Aggregations

DragonFireball (org.bukkit.entity.DragonFireball)1