Solved Summon fireball in direction player is looking

Discussion in 'Plugin Development' started by CraterHater, Jun 19, 2015.

Thread Status:
Not open for further replies.
  1. Offline

    CraterHater

    So I want to summon a fireball that does no block damage but does set the area on fire and damages players it hits with 4 hearths. How do I do this, here is my code:
    Code:
                 @EventHandler
                    public void onPlayerUse2(PlayerInteractEvent event){
                        Player p = event.getPlayer();         
                        if(event.getAction().equals(Action.RIGHT_CLICK_AIR)){
                            if(p.getItemInHand().getType() == Material.GOLD_SWORD){  
                               int value2 = getConfig().getInt(p.getName() + ".Permission1");
                                if(value2 == 1) {
                                if (Cooldowns.tryCooldown(p, "x2", 18000)) {
    //Here i want the fireball thing
                                    p.sendMessage("§b§2[Spells]:§rYou casted the Smash Spell!");
                                   return;
                                }else{
                                p.sendMessage("§b§2[Spells]:§rYou have " + (Cooldowns.getCooldown(p, "x2") / 1000) + " seconds left!");
     
  2. Offline

    Garnetty

    Use the launchProjectile method in the player instance
     
  3. Offline

    CraterHater

    I've got this but it doesn't work what's wrong:
    Code:
                 @EventHandler
                    public void onPlayerUse2(PlayerInteractEvent event){
                        Player p = event.getPlayer();         
                        if(event.getAction().equals(Action.RIGHT_CLICK_AIR)){
                            if(p.getItemInHand().getType() == Material.GOLD_SWORD){  
                               int value2 = getConfig().getInt(p.getName() + ".Permission1");
                                if(value2 == 1) {
                                if (Cooldowns.tryCooldown(p, "x3", 18000)) {
                                    Snowball snowball = p.getWorld().spawn(p.getLocation(), Snowball.class);
                                     snowball.setVelocity(p.getLocation().getDirection().multiply(3));
                                     p.playSound(p.getLocation(), Sound.NOTE_PLING, 5, 5);
    
    
    
                                    p.sendMessage("§b§2[Spells]:§rYou casted the Fireball Spell!");
                                   return;
                                }else{
                                p.sendMessage("§b§2[Spells]:§rYou have " + (Cooldowns.getCooldown(p, "x3") / 1000) + " seconds left!");
                                return;
     
Thread Status:
Not open for further replies.

Share This Page