Player: fetch world via location

this code caters for the possibility of the world being null.
This commit is contained in:
Dylan K. Taylor 2020-02-07 22:11:14 +00:00
parent 04a3e71047
commit ec9ece56f5

View File

@ -709,7 +709,7 @@ class Player extends Human implements CommandSender, ChunkLoader, ChunkListener,
} }
protected function switchWorld(World $targetWorld) : bool{ protected function switchWorld(World $targetWorld) : bool{
$oldWorld = $this->getWorld(); $oldWorld = $this->location->getWorld();
if(parent::switchWorld($targetWorld)){ if(parent::switchWorld($targetWorld)){
if($oldWorld !== null){ if($oldWorld !== null){
foreach($this->usedChunks as $index => $d){ foreach($this->usedChunks as $index => $d){