mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-09-06 09:56:06 +00:00
Position: add getLevelNonNull()
this allows assuming that a position has a valid world in places where it's never expected to not be valid. Since this is the vast majority of usages, it eliminates a lot of possible null-pointer warnings given by static analysers. TODO: Consider whether we can make Position->getLevel/World use this behaviour out of the box in the next major version.
This commit is contained in:
@ -75,7 +75,7 @@ class Location extends Position{
|
||||
}
|
||||
|
||||
public function __toString(){
|
||||
return "Location (level=" . ($this->isValid() ? $this->getLevel()->getName() : "null") . ", x=$this->x, y=$this->y, z=$this->z, yaw=$this->yaw, pitch=$this->pitch)";
|
||||
return "Location (level=" . ($this->isValid() ? $this->getLevelNonNull()->getName() : "null") . ", x=$this->x, y=$this->y, z=$this->z, yaw=$this->yaw, pitch=$this->pitch)";
|
||||
}
|
||||
|
||||
public function equals(Vector3 $v) : bool{
|
||||
|
Reference in New Issue
Block a user