DisconnectPacket: fix decoding

This commit is contained in:
Dylan K. Taylor 2018-05-02 16:56:48 +01:00
parent d80c471ae1
commit 295016cbc1

View File

@ -34,7 +34,7 @@ class DisconnectPacket extends DataPacket{
/** @var bool */ /** @var bool */
public $hideDisconnectionScreen = false; public $hideDisconnectionScreen = false;
/** @var string */ /** @var string */
public $message; public $message = "";
public function canBeSentBeforeLogin() : bool{ public function canBeSentBeforeLogin() : bool{
return true; return true;
@ -42,8 +42,10 @@ class DisconnectPacket extends DataPacket{
protected function decodePayload(){ protected function decodePayload(){
$this->hideDisconnectionScreen = $this->getBool(); $this->hideDisconnectionScreen = $this->getBool();
if(!$this->hideDisconnectionScreen){
$this->message = $this->getString(); $this->message = $this->getString();
} }
}
protected function encodePayload(){ protected function encodePayload(){
$this->putBool($this->hideDisconnectionScreen); $this->putBool($this->hideDisconnectionScreen);