mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-09-08 19:02:59 +00:00
Disconnect 1.1 clients properly (HACK!)
This commit is contained in:
@ -72,6 +72,10 @@ class LoginPacket extends DataPacket{
|
||||
$this->protocol = $this->getInt();
|
||||
|
||||
if($this->protocol !== ProtocolInfo::CURRENT_PROTOCOL){
|
||||
if($this->protocol > 0xffff){ //guess MCPE <= 1.1
|
||||
$this->offset -= 6;
|
||||
$this->protocol = $this->getInt();
|
||||
}
|
||||
return; //Do not attempt to continue decoding for non-accepted protocols
|
||||
}
|
||||
|
||||
|
@ -42,6 +42,12 @@ class PlayStatusPacket extends DataPacket{
|
||||
/** @var int */
|
||||
public $status;
|
||||
|
||||
/**
|
||||
* @var int
|
||||
* Used to determine how to write the packet when we disconnect incompatible clients.
|
||||
*/
|
||||
public $protocol;
|
||||
|
||||
protected function decodePayload(){
|
||||
$this->status = $this->getInt();
|
||||
}
|
||||
@ -50,6 +56,14 @@ class PlayStatusPacket extends DataPacket{
|
||||
return true;
|
||||
}
|
||||
|
||||
protected function encodeHeader(){
|
||||
if($this->protocol < 130){ //MCPE <= 1.1
|
||||
$this->putByte(static::NETWORK_ID);
|
||||
}else{
|
||||
parent::encodeHeader();
|
||||
}
|
||||
}
|
||||
|
||||
protected function encodePayload(){
|
||||
$this->putInt($this->status);
|
||||
}
|
||||
|
Reference in New Issue
Block a user