Position world is null

Discussion in 'Development' started by Marie meow, Dec 13, 2020.

  1. Marie meow

    Marie meow Spider

    Messages:
    13
    Hi!
    1. I get set all right and it gives no error but when I run /stop and try to teleport to the world in the coords without set again simply returns "Internal Server"


    config.yml
    PHP:
    ---
    Spawn:
      
    x255.700000
      
    "y"70.000000
      z
    255.700000
      mundo
    worldtw
      yy
    0
    Spawn1
    :
      
    x256.566500
      
    "y"66.000000
      z
    252.873400
    Spawn2
    :
      
    x256.692000
      
    "y"66.000000
      z
    258.605800
    ...

    // code: Main
        
    public function initArena(){
            
    $data $this->config->getAll();
            
    $world false;
            if(
    $data['Spawn']){
                if(!
    $data['Spawn']['mundo']){
                    return 
    $this->getServer()->getDefaultLevel()->getName();
                }else{
                    return 
    $data['Spawn']['mundo'];
                }
            }else{
                return 
    $data['Spawn']['mundo'];
            }
        }

        public function 
    getWorld(){
            return 
    $this->config->getAll()['Spawn']['mundo'];
        }

        public function 
    getY(){
            
    $y $this->config->getAll()['Spawn']['yy'];
            return 
    $y;
        }

        public function 
    getSSpawn($value false){
            
    $data $this->config->getAll()['Spawn'];

            
    $x $data['x'];
            
    $y $data['y'];
            
    $z $data['z'];

            if(
    $value){

                
    $mundo $data['mundo'];

                
    $pos = new Position($x$y$z$this->getServer()->getLevelByName($mundo));

                return 
    $pos;
            }else{
                
    $pos = new Vector3($x$y$z);
                return 
    $pos;
            }
        }

    // error
    [04:59:58] [Server thread/CRITICAL]: pocketmine\utils\AssumptionFailedError"Position world is null" (EXCEPTIONin "src/pocketmine/level/Position" at line 83

    [04:59:58] [Server thread/CRITICAL]: #0 src/pocketmine/entity/Entity(1875): pocketmine\level\Position->getLevelNonNull()

    [04:59:58] [Server thread/CRITICAL]: #1 src/pocketmine/Player(3943): pocketmine\entity\Entity->teleport(object pocketmine\level\Position, NULL , NULL )

    [04:59:58] [Server thread/CRITICAL]: #2 plugins/x/src/x/x/Manager(113): pocketmine\Player->teleport(object pocketmine\level\Position)

    [04:59:58] [Server thread/CRITICAL]: #3 plugins/x/src/xx/Main(741): x\x\x->join(object pocketmine\Player)

    [04:59:58] [Server thread/CRITICAL]: #4 src/pocketmine/command/PluginCommand(54): x\x\Main->onCommand(object pocketmine\Player, object pocketmine\command\PluginCommand, string[6] x, array[1])

    [04:59:58] [Server thread/CRITICAL]: #5 src/pocketmine/command/SimpleCommandMap(248): pocketmine\command\PluginCommand->execute(object pocketmine\Player, string[6] x, array[1])

    [04:59:58] [Server thread/CRITICAL]: #6 src/pocketmine/Server(1811): pocketmine\command\SimpleCommandMap->dispatch(object pocketmine\Player, string[12] x xx)

    [04:59:58] [Server thread/CRITICAL]: #7 src/pocketmine/Player(2322): pocketmine\Server->dispatchCommand(object pocketmine\Player, string[12] x xx)
     
  2. Levi

    Levi Skeleton

    Messages:
    955
    GitHub:
    captainleviftw
    Make sure the world you're teleporting to is loaded.
     
    Primus likes this.
  3. Marie meow

    Marie meow Spider

    Messages:
    13
    When it is loaded it doesn't work (the error stops showing but the plugin doesn't work)
     
  4. gamegam

    gamegam Spider

    Messages:
    11
    GitHub:
    gamegam
    $world = $data['Spawn']['mundo'];
    if ($this->getServer()->getLevelByName($world) == null){
    $p->sendMessage("world load error");
    }
     

Share This Page

  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.