What is wrong

Discussion in 'Plugin Development' started by MordorKing78, Jan 18, 2015.

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

    MordorKing78

    Code:
        @EventHandler
        public void onProjectileThrownEvent(ProjectileLaunchEvent e){
            Projectile proj = e.getEntity();
           
            final Arrow sb = (Arrow)proj;
    
            Bukkit.getScheduler().scheduleSyncRepeatingTask(plugin, new Runnable(){
                public void run(){
                    Location loc = sb.getLocation();
                    loc.getWorld().playEffect(loc, Effect.HEART, 1);
                }
            }, 0, 1);
        } 
    How would I make it like if the arrow is on the ground it stops doing this?
     
  2. What are you trying to do exactly? Are there any stack staces? Have you registered your events under your onEnable method?
     
  3. Offline

    Zombie_Striker

    Either check for if the Velocity is 0, or check is there is a block next to it. I'm assuming you already got it to play they effects, right?
     
  4. Offline

    1Rogue

    Check your casting, and keep a reference of which projectiles are tied to which task (task meaning the object returned from runTaskTimer, which you should be using instead of scheduleSyncRepeatingTask). Then when a projectile hits the ground, obtain that reference again and cancel the task. You'll need a map to accomplish this.
     
  5. Offline

    MordorKing78

    Last edited by a moderator: Jun 13, 2016
  6. Offline

    1Rogue

Thread Status:
Not open for further replies.

Share This Page