Ground Smash

Discussion in 'Plugin Development' started by snake4212, Jul 4, 2013.

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

    snake4212

    Shouldn't this code create a ground smash so when I jump and sneak and hit the ground there is an explosion like a Ground Pound... that does no damage to your player only terrain
    Show Spoiler

    Code:
     @EventHandler
     public void noDamage(EntityDamageEvent event)
     {
       if ((event.getEntity() instanceof Player)) {
         Entity p = event.getEntity();
         Player player = (Player)event.getEntity();
           if ((event.getCause() == EntityDamageEvent.DamageCause.FALL) && 
                   (player.isSneaking()))
                 {
                   Location l = player.getLocation();
                   player.getWorld().createExplosion(l.getX(), l.getY(), l.getZ(), 3);}
                 }
     }
    
     
  2. Offline

    Trevor1134

    Don't think it would be a Entity damage event.. Try PlayerIntereactEvent?
     
  3. Offline

    snake4212

    Ok
    I will try

    Nope

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 3, 2016
  4. Offline

    Jogy34

    The EntityDamage event will work but only if the player drops from more than three blocks. Unfortunately I think you would be looking for the PlayerMoveEvent.
     
  5. Offline

    SnowGears

    This would only work if the player fell from more than three blocks. To achieve a ground pound from 1-3 blocks, you would need to listen to player move event which unfortunately would put more stress on the server. But it can still be done pretty easily.
     
  6. Offline

    Chinwe

    What about listening to player toggle sneak event, then checking if they are off the ground?
     
  7. Offline

    GodzOfMadness

    chinwe How would that work to check when they hit the ground?
     
  8. Offline

    Chinwe

    GodzOfMadness I'm probably thinking too much of Smash here: on sneak event, check if midair, throw towards ground and use a BukkitRunnable to check if the block under their feet isnt air, then do the pound?

    If this isn't what you mean then I apologise :c
     
  9. Offline

    GodzOfMadness

    chinwe I don't know how he wants it, but that would be way better to do that. +1
     
  10. Offline

    snake4212

    Ok so basically all I need is to know how to make it so when you jump sneak it creates an explosion on land
     
  11. Offline

    snake4212

    bump dear god
     
  12. Offline

    chasechocolate

    snake4212 the way I did it in a smash plugin I made was when they sneak in the air they will be added to a string list. On PlayerMoveEvent, I checked if they were in the list, if they were on the ground, and then added an explosion and removed them from the list.
     
Thread Status:
Not open for further replies.

Share This Page