Lighting fires where the player is looking

Discussion in 'Plugin Development' started by Makerninja, Feb 22, 2016.

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

    Makerninja

    For my plugin, I was hoping to have the ability to light a block on fire if you look at it whilst holding a specific item and right-clicking. I'm having difficulty figuring out how to get the coordinates of where the player is looking, and then also how to light blocks on fire. Any help would be appreciated. Thanks!
     
  2. Offline

    SkyleTyler1337

    @Makerninja you dont need the cordinates where the player is looking at.

    use this
    Code:
     /** get the block where the cross */
           
            Block b = event.getPlayer().getTargetBlock(null, 100);
             
            if(!b.getType().equals(Material.AIR)){
              Location blockLocation = b.getLocation();
               
              event.getPlayer().getWorld().strikeLightning(blockLocation);
            } 
    
     
  3. Offline

    Gerov

    @SkyleTyler1337 If you're going to spoonfeed, at least explain what you are doing here.
     
  4. Offline

    Zombie_Striker

    @SkyleTyler1337
    It seems we really need a "Why we do not spoonfeed here" thread. In short, by giving him code you are just an "Enabler". All you do is make him dependent on us giving him code whenever he gets a problem instead of telling him how we would go about it solving his problem on his own.
     
Thread Status:
Not open for further replies.

Share This Page