Level: cleaned up some nonsensical code in getSafeSpawn()

it's impossible for this function to return false because $spawn is guaranteed to be a Vector3 when it's checked in instanceof.
This commit is contained in:
Dylan K. Taylor 2018-05-19 13:18:20 +01:00
parent 6c3fc4af46
commit 71224f51d5

View File

@ -2763,13 +2763,13 @@ class Level implements ChunkManager, Metadatable{
/**
* @param Vector3 $spawn default null
*
* @return bool|Position
* @return Position
*/
public function getSafeSpawn($spawn = null){
public function getSafeSpawn(?Vector3 $spawn = null) : Position{
if(!($spawn instanceof Vector3) or $spawn->y < 1){
$spawn = $this->getSpawnLocation();
}
if($spawn instanceof Vector3){
$max = $this->worldHeight;
$v = $spawn->floor();
$chunk = $this->getChunk($v->x >> 4, $v->z >> 4, false);
@ -2805,9 +2805,6 @@ class Level implements ChunkManager, Metadatable{
return new Position($spawn->x, $v->y, $spawn->z, $this);
}
return false;
}
/**
* Gets the current time
*