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

Teleporting does not work

Comments in 'Plugin Development' started by MyNameIsTriXz, Nov 30, 2015.

  1. MyNameIsTriXz
    Offline

    MyNameIsTriXz Notable Member

    Joined:
    Aug 17, 2015
    Posts:
    538
    Minecraft User:
    MyNameIsTriXz
    Hey, I want to teleport a command sender in my code, but whyever he is teleporting on his given coordinates, but stays in the same level. Here is the code: $sender->teleport(new Position(128, 5, 128, $this->getServer()->getLevelByName("OITCWaitingQueue"), 0, 0)); The levelname is how I said OITCWaitingQueue. Can you help me?
  2. CraftYourBukkit
    Offline

    CraftYourBukkit Notable Member Plugin Developer

    Joined:
    Jan 20, 2015
    Posts:
    1,022
    Plugins:
    2
    Minecraft User:
    CraftYourBukkit
    Is the Level loaded?
    wolfdale likes this.
  3. MyNameIsTriXz
    Offline

    MyNameIsTriXz Notable Member

    Joined:
    Aug 17, 2015
    Posts:
    538
    Minecraft User:
    MyNameIsTriXz
    Oh no, I didnt get this, because in the console isnt any error message. So how am I doing it?
  4. Hotshot_9930
    Offline

    Hotshot_9930 Notable Member Plugin Developer

    Joined:
    May 26, 2014
    Posts:
    665
    Plugins:
    2
    Minecraft User:
    HotshotHD
    Why do you have 2 extra 0's at the end
  5. wolfdale
    Offline

    wolfdale Active Member Plugin Developer

    Joined:
    Dec 3, 2014
    Posts:
    276
    Plugins:
    1
    Minecraft User:
    ace
    Make sure the level is loaded
    If the level is not loaded, $this->getServer()->getLevelByName("OITCWaitingQueue") will return null, and using null in place of the level parameter is acceptable, so it will not throw any error messages.
    You should load the level ($this->getServer()->loadLevel("OITCWaitingQueue");) before the teleport
    MyNameIsTriXz likes this.
  6. CraftYourBukkit
    Offline

    CraftYourBukkit Notable Member Plugin Developer

    Joined:
    Jan 20, 2015
    Posts:
    1,022
    Plugins:
    2
    Minecraft User:
    CraftYourBukkit
    Yaw and Pitch

Share This Page

Advertisement