Skip to content

Commit

Permalink
Merge pull request #40 from supercrafter333/master
Browse files Browse the repository at this point in the history
Try to fix #39
  • Loading branch information
Flavius12 authored Mar 7, 2021
2 parents dae1b09 + 980648b commit b319afa
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions src/MSpawns/MSpawns.php
Original file line number Diff line number Diff line change
Expand Up @@ -321,9 +321,16 @@ public function teleportToHub(Player $player) : int {
if(!Server::getInstance()->loadLevel($hub["world"])){
return self::ERR_HUB_INVALID_WORLD;
}
$level = $this->getServer()->getLevelByName($hub["world"]);
$player->teleport(new Position($hub["X"], $hub["Y"], $hub["Z"], $level), $hub["Yaw"], $hub["Pitch"]);
return self::SUCCESS;
if (Server::getInstance()->isLevelLoaded($hub["world"])) {
$level = $this->getServer()->getLevelByName($hub["world"]);
$player->teleport(new Position($hub["X"], $hub["Y"], $hub["Z"], $level), $hub["Yaw"], $hub["Pitch"]);
return self::SUCCESS;
} else {
Server::getInstance()->loadLevel($hub["world"]);
$level = $this->getServer()->getLevelByName($hub["world"]);
$player->teleport(new Position($hub["X"], $hub["Y"], $hub["Z"], $level), $hub["Yaw"], $hub["Pitch"]);
return self::SUCCESS;
}
}

/**
Expand Down

0 comments on commit b319afa

Please sign in to comment.