Please Help Me With Throwing an Item.

Discussion in 'Spigot Plugin Development' started by Artur, Jun 15, 2015.

  1. Hello everyone. I have a question.

    I want to make a Lightning orb like in the game Champions on the most popular server.

    So. Here is what I have for now.

    Code (Text):
    public void LightningOrb (PlayerInteractEvent e){
            if (e.getAction() == Action.RIGHT_CLICK_AIR || e.getAction() == Action.RIGHT_CLICK_BLOCK && e.getPlayer().getItemInHand().getType() == Material.DIAMOND_AXE){
               
            }
        }

    So when player right clicks a Diamond Axe, he 'Throws' a diamond block and after some time (3 seconds) it disappears and the lightning strikes.


    I will be so happy if you will help me. Thanks :)
    -Artur_Gamez
     
  2. schedule a delayed task. You might look into BukkitRunnables and Schedulers
     
  3. What have you tried, and what are the issues you ran into? We can't really help you without knowing that.
     
  4. You would want to shoot a Diamond Block using a velocity and have a scheduled task remove that item and strike a lightning bolt after 60 ticks.