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

getSafeSpawn on null

Discussion in 'Plugin Help' started by DemureTitan, Jan 29, 2019.

  1. DemureTitan

    DemureTitan Creeper

    Messages:
    4
    $g->teleport($this->getServer()->getLevelByName($island->get("World"))->getSafeSpawn(), 0, 0);

    Error: Call to a member function getSafeSpawn on null
     
  2. corytortoise

    corytortoise Skeleton

    Messages:
    825
    GitHub:
    corytortoise
    I don't know what $island is, but my guess is that you're trying to get a world that isn't loaded. Load the level before this code, and you should have no issue.
     
  3. sero583

    sero583 Spider

    Messages:
    8
    GitHub:
    sero583
    Yes you can get your job in an async task done, load world and teleport on finish of loading process.
     
  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.