diff --git a/src/pocketmine/Player.php b/src/pocketmine/Player.php index 5d43318e2..9a866f036 100644 --- a/src/pocketmine/Player.php +++ b/src/pocketmine/Player.php @@ -1378,9 +1378,9 @@ class Player extends Human implements CommandSender, InventoryHolder, IPlayer{ if(($level = $this->server->getLevelByName($nbt["Level"])) === null){ $this->setLevel($this->server->getDefaultLevel(), true); $nbt["Level"] = $this->getLevel()->getName(); - $nbt["Pos"][0] = $this->getLevel()->getSpawn()->x; - $nbt["Pos"][1] = $this->getLevel()->getSpawn()->y; - $nbt["Pos"][2] = $this->getLevel()->getSpawn()->z; + $nbt["Pos"][0] = $this->getLevel()->getSpawnLocation()->x; + $nbt["Pos"][1] = $this->getLevel()->getSpawnLocation()->y; + $nbt["Pos"][2] = $this->getLevel()->getSpawnLocation()->z; }else{ $this->setLevel($level, true); } diff --git a/src/pocketmine/Server.php b/src/pocketmine/Server.php index 6d94be42e..e3d67c43d 100644 --- a/src/pocketmine/Server.php +++ b/src/pocketmine/Server.php @@ -1114,8 +1114,8 @@ class Server{ $radiusSquared = ($this->getViewDistance() + 1) / M_PI; $radius = ceil(sqrt($radiusSquared)); - $centerX = $level->getSpawn()->getX() >> 4; - $centerZ = $level->getSpawn()->getZ() >> 4; + $centerX = $level->getSpawnLocation()->getX() >> 4; + $centerZ = $level->getSpawnLocation()->getZ() >> 4; $order = []; diff --git a/src/pocketmine/command/defaults/SpawnpointCommand.php b/src/pocketmine/command/defaults/SpawnpointCommand.php index 90e976402..2aad6c167 100644 --- a/src/pocketmine/command/defaults/SpawnpointCommand.php +++ b/src/pocketmine/command/defaults/SpawnpointCommand.php @@ -66,7 +66,7 @@ class SpawnpointCommand extends VanillaCommand{ if(count($args) === 4){ if($level !== null){ - $pos = $sender instanceof Player ? $sender->getPosition() : $level->getSpawn(); + $pos = $sender instanceof Player ? $sender->getPosition() : $level->getSpawnLocation(); $x = (int) $this->getRelativeDouble($pos->x, $sender, $args[1]); $y = $this->getRelativeDouble($pos->y, $sender, $args[2], 0, 128); $z = $this->getRelativeDouble($pos->z, $sender, $args[3]); diff --git a/src/pocketmine/level/Level.php b/src/pocketmine/level/Level.php index 7922f91ea..52c1ee07e 100644 --- a/src/pocketmine/level/Level.php +++ b/src/pocketmine/level/Level.php @@ -1025,7 +1025,7 @@ class Level implements ChunkManager, Metadatable{ } if(!$player->isOp() and ($distance = $this->server->getConfigInt("spawn-protection", 16)) > -1){ $t = new Vector2($target->x, $target->z); - $s = new Vector2($this->getSpawn()->x, $this->getSpawn()->z); + $s = new Vector2($this->getSpawnLocation()->x, $this->getSpawnLocation()->z); if($t->distance($s) <= $distance){ //set it to cancelled so plugins can bypass this $ev->setCancelled(); } @@ -1115,7 +1115,7 @@ class Level implements ChunkManager, Metadatable{ $ev = new PlayerInteractEvent($player, $item, $target, $face); if(!$player->isOp() and ($distance = $this->server->getConfigInt("spawn-protection", 16)) > -1){ $t = new Vector2($target->x, $target->z); - $s = new Vector2($this->getSpawn()->x, $this->getSpawn()->z); + $s = new Vector2($this->getSpawnLocation()->x, $this->getSpawnLocation()->z); if($t->distance($s) <= $distance){ //set it to cancelled so plugins can bypass this $ev->setCancelled(); } @@ -1180,7 +1180,7 @@ class Level implements ChunkManager, Metadatable{ $ev = new BlockPlaceEvent($player, $hand, $block, $target, $item); if(!$player->isOp() and ($distance = $this->server->getConfigInt("spawn-protection", 16)) > -1){ $t = new Vector2($target->x, $target->z); - $s = new Vector2($this->getSpawn()->x, $this->getSpawn()->z); + $s = new Vector2($this->getSpawnLocation()->x, $this->getSpawnLocation()->z); if($t->distance($s) <= $distance){ //set it to cancelled so plugins can bypass this $ev->setCancelled(); } @@ -1868,10 +1868,11 @@ class Level implements ChunkManager, Metadatable{ /** * Returns the raw spawnpoint * + * @deprecated * @return Position */ public function getSpawn(){ - return Position::fromObject($this->provider->getSpawn(), $this); + return $this->getSpawnLocation(); } /** @@ -1881,7 +1882,7 @@ class Level implements ChunkManager, Metadatable{ */ public function getSafeSpawn($spawn = null){ if(!($spawn instanceof Vector3)){ - $spawn = $this->getSpawn(); + $spawn = $this->getSpawnLocation(); } if($spawn instanceof Vector3){ $x = Math::floorFloat($spawn->x);