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

Client crash on Level change

Discussion in 'Development' started by FunnyBuddys, Sep 7, 2018.

  1. FunnyBuddys

    FunnyBuddys Spider

    Messages:
    14
    GitHub:
    FunnyBuddys
    Hello. I have a problem,

    I have a problem with changing the world.
    I wanted all players to be teleported to another world when the timer expired. The problem is that some players crash more often. Do any of you know how I can fix this?


    PHP:
    if($timeStart<=0)
                                {
                                    
    $timeStart=0;
                                    
    $map $config->get($arena "Map1");
                                    
    $this->plugin->getServer()->loadLevel($map);
                                    
    $spawn $this->plugin->getServer()->getLevelByName($map)->getSafeSpawn();
                                    
    $level->loadChunk($spawn->getFloorX(), $spawn->getFloorZ());

                                    
    $this->plugin->getServer()->getLevelByName($map)->loadChunk($this->plugin->getServer()->getLevelByName($map)->getSafeSpawn()->getFloorX(), $this->plugin->getServer()->getLevelByName($map)->getSafeSpawn()->getFloorZ());
                                    foreach(
    $playersIn as $player)
                                    {
                                        
    $player->addTitle(TextFormat::GREEN $map$this->messages->get("ingame.goodluck"));
                                        
    $player->teleport($this->plugin->getServer()->getLevelByName($map)->getSafeSpawn());
                                    }
                                }
     
    Last edited: Sep 8, 2018
  2. corytortoise

    corytortoise Skeleton

    Messages:
    825
    GitHub:
    corytortoise
    Why teleport the player twice? Just using the second line of code should work. Aside from that, I would guess the issue is relevant to the map itself. Does this ever happen when players teleport to other levels through other means?
     
  3. MalakasPlayzMCPE

    MalakasPlayzMCPE Zombie Pigman

    Messages:
    667
    getSpawnLocation()?
     
  4. FunnyBuddys

    FunnyBuddys Spider

    Messages:
    14
    GitHub:
    FunnyBuddys
    Oh, that was a mistake on my part. In my code it is only teleported once. Corrected the line in question. Still, it doesn't change the current situation.
     
  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.