mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-09-06 09:56:06 +00:00
Merge branch 'remove-weak-position'
This commit is contained in:
@ -87,7 +87,6 @@ use pocketmine\level\format\Chunk;
|
||||
use pocketmine\level\Level;
|
||||
use pocketmine\level\Location;
|
||||
use pocketmine\level\Position;
|
||||
use pocketmine\level\WeakPosition;
|
||||
use pocketmine\math\AxisAlignedBB;
|
||||
use pocketmine\math\Vector3;
|
||||
use pocketmine\metadata\MetadataValue;
|
||||
@ -299,7 +298,7 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
|
||||
|
||||
/** @var Vector3|null */
|
||||
protected $sleeping = null;
|
||||
/** @var WeakPosition|null */
|
||||
/** @var Position|null */
|
||||
private $spawnPosition = null;
|
||||
|
||||
//TODO: Abilities
|
||||
@ -1168,7 +1167,7 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
|
||||
* @return bool
|
||||
*/
|
||||
public function hasValidSpawnPosition() : bool{
|
||||
return $this->spawnPosition instanceof WeakPosition and $this->spawnPosition->isValid();
|
||||
return $this->spawnPosition !== null and $this->spawnPosition->isValid();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1183,7 +1182,7 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
|
||||
}else{
|
||||
$level = $pos->getLevel();
|
||||
}
|
||||
$this->spawnPosition = new WeakPosition($pos->x, $pos->y, $pos->z, $level);
|
||||
$this->spawnPosition = new Position($pos->x, $pos->y, $pos->z, $level);
|
||||
$pk = new SetSpawnPositionPacket();
|
||||
$pk->x = $this->spawnPosition->getFloorX();
|
||||
$pk->y = $this->spawnPosition->getFloorY();
|
||||
@ -2083,9 +2082,9 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
|
||||
|
||||
if(!$this->hasValidSpawnPosition()){
|
||||
if(($level = $this->server->getLevelByName($this->namedtag->getString("SpawnLevel", ""))) instanceof Level){
|
||||
$this->spawnPosition = new WeakPosition($this->namedtag->getInt("SpawnX"), $this->namedtag->getInt("SpawnY"), $this->namedtag->getInt("SpawnZ"), $level);
|
||||
$this->spawnPosition = new Position($this->namedtag->getInt("SpawnX"), $this->namedtag->getInt("SpawnY"), $this->namedtag->getInt("SpawnZ"), $level);
|
||||
}else{
|
||||
$this->spawnPosition = WeakPosition::fromObject($this->level->getSafeSpawn());
|
||||
$this->spawnPosition = $this->level->getSafeSpawn();
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user