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

how do you get spawn

Comments in 'Plugin Development' started by Puzzleo, Nov 20, 2013.

  1. Puzzleo
    Offline

    Puzzleo Banned

    Joined:
    Sep 7, 2013
    Posts:
    88
    Minecraft User:
    puzzleo
    how do you get spawn's x y z cords
  2. JassperBeastHD
    Offline

    JassperBeastHD Banned

    Joined:
    Aug 27, 2013
    Posts:
    436
    Minecraft User:
    JassperBeastHD
  3. Falk
    Offline

    Falk Staff Member Global Moderator

    Joined:
    Sep 2, 2013
    Posts:
    1,710
    Plugins:
    22
    Minecraft User:
    Falkirknh
    I think you want the spawn in a plugin, correct?
    I believe it is $this->api->level->[NAME]->getSpawn();
    Although if you have a level object like $issuer->level you can do $issuer->level->getSpawn();
  4. Puzzleo
    Offline

    Puzzleo Banned

    Joined:
    Sep 7, 2013
    Posts:
    88
    Minecraft User:
    puzzleo
    yes u are right @Falk thanks
  5. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,325
    Plugins:
    11
    Minecraft User:
    PEMapModder
    @Puzzleo do you want the point where the player tps to when typing /spawn?
    If so, @Falk, how can we get the spawn world?(to replace [NAME])
  6. Puzzleo
    Offline

    Puzzleo Banned

    Joined:
    Sep 7, 2013
    Posts:
    88
    Minecraft User:
    puzzleo
    yes i do @PEMapModder i been testing with falks idea so far only crash files :(
  7. Falk
    Offline

    Falk Staff Member Global Moderator

    Joined:
    Sep 2, 2013
    Posts:
    1,710
    Plugins:
    22
    Minecraft User:
    Falkirknh
    Weird, maybe use the level object in the player object to do it then
  8. wies
    Offline

    wies Notable Member

    Joined:
    Aug 23, 2013
    Posts:
    392
    If you want to get the spawn by the level name you can do this:
    PHP:
    $spawn $this->api->level->get($nameOfTheLevel)->getSpawn();
    or like this to get the spawn of the default level:
    PHP:
    $spawn $this->api->level->getDefault()->getSpawn();
    Than you can get the x y z coordinates like this:
    PHP:
    $x $spawn->x;
    $y $spawn->y;
    $z $spawn->z;
    If you want to get the the spawn point of a player:
    PHP:
    $player->getSpawn();
  9. Puzzleo
    Offline

    Puzzleo Banned

    Joined:
    Sep 7, 2013
    Posts:
    88
    Minecraft User:
    puzzleo
    • i already set x y z they are easy i think i the problem was i foreached the code

Share This Page

Advertisement