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

I would like that when I hit a player I get the player's name

Discussion in 'Development' started by Matrox, Jun 30, 2019.

  1. Matrox

    Matrox Slime

    Messages:
    92
    GitHub:
    MatroxMC
    I would like that when I hit a player I get the player's name
     
  2. iCirgio

    iCirgio Slime

    Messages:
    92
    GitHub:
    lolnova
    PHP:
    public function onDamage(EntityDamageEvent $event){
      if(
    $event instanceof EntityDamageByEntityEvent){
         if(
    $event->getEntity() instanceof Player){
            
    $name $event->getEntity()->getName();
            
    //whatever you want to do
     
  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.