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

Solved I want to make for when clicking with the item on the ground teleport to the world "LobbyA"

Discussion in 'Development' started by uMeliodas, Jun 10, 2018.

  1. uMeliodas

    uMeliodas Creeper

    Messages:
    3
    GitHub:
    OFF
    public function onInteract(PlayerInteractEvent $event){
    $player = $event->getPlayer();
    $barra = $event->getItem();
    $block = $event->getBlock();
    if($event->getItem()->getID() == 101){
    $player->sendMessage("§eItem clicado");
    $player->teleport($event->getLevel()->getName() == "LobbyA");
    $player->sendMessage("§eTeleportado para o mundo §cLobbyA");
    }
    }
     
  2. Muqsit

    Muqsit Chicken

    Messages:
    1,548
    GitHub:
    muqsit
    Why did you use $event->getLevel()?
     
    uMeliodas likes this.
  3. DanDen

    DanDen Spider

    Messages:
    11
    $player->teleport ($this->getServer ()->getLevelByName ("lobby")->getSpawnLocation ());
     
    uMeliodas likes this.
  4. uMeliodas

    uMeliodas Creeper

    Messages:
    3
    GitHub:
    OFF
    Why to teleport for worlds use Level
     
  5. uMeliodas

    uMeliodas Creeper

    Messages:
    3
    GitHub:
    OFF
    Tank you.
     
  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.