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

View File

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