Advertisement
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

When a player jumps, high enough to get falldamage, how do i cancel the damage?

Comments in 'Plugin Development' started by Jankirby, Apr 15, 2016.

  1. Jankirby
    Offline

    Jankirby Active Member

    Joined:
    Apr 20, 2014
    Posts:
    38
    Minecraft User:
    Natsu_Dragneel
    Title says all, need help
  2. CraftYourBukkit
    Offline

    CraftYourBukkit Notable Member Plugin Developer

    Joined:
    Jan 20, 2015
    Posts:
    1,022
    Plugins:
    2
    Minecraft User:
    CraftYourBukkit
    PHP:
        public function onDamage(EntityDamageEvent $event)
        {
            if (
    $event->getEntity() instanceof Player) {
                if (
    $event->getCause() === EntityDamageEvent::CAUSE_FALL) {
                     
    $event->setCancelled();
                }
            }
        }
    Jankirby, Primus and HotFireyDeath like this.
  3. Tim // robske Büba
    Offline

    Tim // robske Büba Notable Member

    Joined:
    Feb 26, 2014
    Posts:
    606
    Minecraft User:
    robske_110
    I think he meant only when the player actively jumped, that it should be cancelled.
    You could do it with an array where the last jump time is saved
    Primus likes this.

Share This Page

Advertisement