mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-07-06 10:01:53 +00:00
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:
parent
6c3fc4af46
commit
71224f51d5
@ -2763,13 +2763,13 @@ class Level implements ChunkManager, Metadatable{
|
|||||||
/**
|
/**
|
||||||
* @param Vector3 $spawn default null
|
* @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){
|
if(!($spawn instanceof Vector3) or $spawn->y < 1){
|
||||||
$spawn = $this->getSpawnLocation();
|
$spawn = $this->getSpawnLocation();
|
||||||
}
|
}
|
||||||
if($spawn instanceof Vector3){
|
|
||||||
$max = $this->worldHeight;
|
$max = $this->worldHeight;
|
||||||
$v = $spawn->floor();
|
$v = $spawn->floor();
|
||||||
$chunk = $this->getChunk($v->x >> 4, $v->z >> 4, false);
|
$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 new Position($spawn->x, $v->y, $spawn->z, $this);
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the current time
|
* Gets the current time
|
||||||
*
|
*
|
||||||
|
Loading…
x
Reference in New Issue
Block a user