1. The forums will be archived and moved to a read only mode in about 2 weeks (mid march).

EntityDamageEvent

Discussion in 'Development' started by Hipster, Jan 29, 2017.

  1. Hipster

    Hipster Zombie

    Messages:
    214
    How to increase EntityDamageEvent by some value when a players hits a player?
     
  2. gistrec

    gistrec Witch

    Messages:
    68
    GitHub:
    gistrec
    PHP:
    public function onDamage(EntityDamageEvent $event){
        if (
    $event instanceof EntityDamageByEntityEvent && $event->getDamager() instanceof Player){
            
    $event->setDamage($event->getDamage() * 1.2);
        }
    }
     
    corytortoise and Hipster like this.
  3. Hipster

    Hipster Zombie

    Messages:
    214
    Nice, thanks.
     
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.