mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-09-06 09:56:06 +00:00
Player::getNetworkSession() now explicitly handles disconnected state by throwing an exception
instead of just allowing return of possibly-null networkSession
This commit is contained in:
@ -530,6 +530,9 @@ class Player extends Human implements CommandSender, ChunkListener, IPlayer{
|
|||||||
}
|
}
|
||||||
|
|
||||||
public function getNetworkSession() : NetworkSession{
|
public function getNetworkSession() : NetworkSession{
|
||||||
|
if($this->networkSession === null){
|
||||||
|
throw new \InvalidStateException("Player is not connected");
|
||||||
|
}
|
||||||
return $this->networkSession;
|
return $this->networkSession;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user