Fall Damage Disable (source)

Discussion in 'Plugin Development' started by mikeaaaa, Feb 11, 2013.

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

    mikeaaaa

    Hello guys, I have a problem:
    When you go on a moshroom block, you jump into the air, and when you touch the ground :
    (player) hit the ground to hard. BUT: I'd like, when just when the player is on the ground, he doesn't take damage, just when he jump with a moshroom block. And in the rest of the world, fall damage must bee enabled. Can you help me:
    Code:
        public void JumpBlockz(PlayerMoveEvent event){
            Player p = event.getPlayer();
            Location loc = (Location) p.getLocation();
            Block down = p.getWorld().getBlockAt(loc).getRelative(BlockFace.DOWN);
            if (down.getTypeId() == 99){
                Vector up = new Vector(0,3,0);
                p.setVelocity(up);
               
            }
           
        }
     
  2. Offline

    TehRainbowGuy

    Ne0nx3r0 likes this.
  3. Offline

    mikeaaaa

    can you give me just the fall damage disable code please?
     
  4. Offline

    TnT

    Moved to Plugin Development.

    You would learn far more if you discover the answer yourself, based on the pointers provided.
     
  5. Offline

    Ne0nx3r0

    He just did.

    (from that url)
    Code:
    @EventHandler
        public void onHurt(EntityDamageEvent event) {
            if (event.getCause().equals(EntityDamageEvent.DamageCause.FALL)) {// <- Determines the damage was from a fall
                Entity e = event.getEntity();
                if (bouncingEntities.contains(e.getEntityId())) {//<- specific to that plugin
                    event.setCancelled(true);//<- cancels the entity damaged event
                    e.setFallDistance(0);
                    bouncingEntities.remove(bouncingEntities.indexOf(e.getEntityId()));//<- specific to that plugin
                }
     
            }
        }
    
     
  6. Offline

    mikeaaaa

    oh sorry, thanks :D

    error: bouncingEntities

    bouncingEntities is underlined in red :(

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: May 31, 2016
  7. Offline

    ZeusAllMighty11

    chasechocolate likes this.
  8. Offline

    mikeaaaa

  9. Offline

    ISHLCMinecraft

    it's in his plugin only, that an a if statment, you can remove it.
     
  10. Offline

    mikeaaaa

    Code:
        @EventHandler
        public void onHurt(EntityDamageEvent event) {
            if (event.getCause().equals(EntityDamageEvent.DamageCause.FALL)) {// <- Determines the damage was from a fall
                Entity e = event.getEntity();
                if (bouncingEntities.contains(e.getEntityId())) {//<- specific to that plugin
                    event.setCancelled(true);//<- cancels the entity damaged event
                    e.setFallDistance(0);
                    bouncingEntities.remove(bouncingEntities.indexOf(e.getEntityId()));//<- specific to that plugin
                }
     
            }
        }
     
    }
    
    bouncingEntities is in error

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: May 31, 2016
  11. Offline

    ZeusAllMighty11

    mikeaaaa Please learn to read.



    ^^^^^
     
    chasechocolate likes this.
  12. Offline

    mikeaaaa

    Code:
        @EventHandler
        public void onHurt(EntityDamageEvent event) {
            if (event.getCause().equals(EntityDamageEvent.DamageCause.FALL)) {// <- Determines the damage was from a fall
                Entity e = event.getEntity();
                if (bouncingEntities.contains(e.getEntityId())) {//<- specific to that plugin
                    event.setCancelled(true);//<- cancels the entity damaged event
                    e.setFallDistance(0);
               
           
     
            }
        }
     
    }
    correct?
     
  13. Offline

    mikeaaaa

  14. Offline

    user_43347

    Please, please, please learn basic Java before you continue.
     
  15. Offline

    teunie75

    I agree with that, why?
    You can better learn something before you continue, this will make you have to wait for answers less.
    You understand more then the things you only would do when asking it to us.
    Youtube or the tutorials on Bukkit are a good way to start.
     
  16. Offline

    user_43347

    You quoted the wrong person :p
     
    teunie75 likes this.
  17. Offline

    teunie75

    steaks4uce Wanted to add something to your post.
    Ill edit it
     
    steaks4uce likes this.
  18. Offline

    mikeaaaa

    I don't find anything for disable falldamage in my pl.
     
  19. Offline

    mikeaaaa

    [tnt] *** CLOSED ***[tnt]
     
  20. Offline

    Burnett1

    why dont u just set the tag to solved and then set it to invisble. Do this by the main section. Not in the forum.
     
Thread Status:
Not open for further replies.

Share This Page