Fix some crashy issues when incompatible players get disconnected

This commit is contained in:
Dylan K. Taylor 2017-08-17 10:29:12 +01:00
parent 6efa4343b1
commit 670a9fe44f
2 changed files with 10 additions and 4 deletions

View File

@ -247,9 +247,9 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
protected $ip;
protected $removeFormat = true;
protected $port;
protected $username;
protected $iusername;
protected $displayName;
protected $username = "";
protected $iusername = "";
protected $displayName = "";
protected $startAction = -1;
/** @var Vector3|null */
protected $sleeping = null;
@ -3472,7 +3472,9 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
$this->windows = null;
$this->windowIndex = [];
parent::close();
if($this->constructed){
parent::close();
}
$this->spawned = false;
if($this->loggedIn){

View File

@ -359,8 +359,12 @@ abstract class Entity extends Location implements Metadatable{
/** @var bool */
protected $isPlayer = false;
/** @var bool */
protected $constructed = false;
public function __construct(Level $level, CompoundTag $nbt){
$this->constructed = true;
$this->timings = Timings::getEntityTimings($this);
$this->isPlayer = $this instanceof Player;