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

Player Spawning entity.

Discussion in 'Development' started by DanielYTK, Mar 26, 2017.

  1. DanielYTK

    DanielYTK Zombie

    Messages:
    227
    I want to do that:
    When a player spawn an entity with a spawn egg, I want to send a message to the player, but I need to use EntitySpawnEvent, not PlayerInteractEvent
     
  2. Bluzzi

    Bluzzi Spider Jockey

    Messages:
    46
    I do not think EntitySpawnEvent is suitable for that, but you can do this:
    PHP:
    public function onPlaceEggSpawn(PlayerInteractEvent $event){
        if(
    $event->getItem()->getID() === 383){
            
    $event->getPlayer()->sendMessage("Message...");
            }
        }
     
  3. DanielYTK

    DanielYTK Zombie

    Messages:
    227
    -benzóico. thanks
     
  4. Muqsit

    Muqsit Chicken

    Messages:
    1,548
    GitHub:
    muqsit
    EntitySpawnEvent is heavy. Try to avoid it.
     
    DanielYTK likes this.
  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.