Skip to content

Commit

Permalink
1.19.40
Browse files Browse the repository at this point in the history
  • Loading branch information
AkmalFairuz committed Oct 26, 2023
1 parent 0d40069 commit 5045157
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/DisconnectPacket.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,19 @@ public function canBeSentBeforeLogin() : bool{
}

protected function decodePayload(PacketSerializer $in) : void{
$this->reason = $in->getVarInt();
if($in->getProtocol() >= ProtocolInfo::PROTOCOL_622){
$this->reason = $in->getVarInt();
}
$hideDisconnectionScreen = $in->getBool();
if(!$hideDisconnectionScreen){
$this->message = $in->getString();
}
}

protected function encodePayload(PacketSerializer $out) : void{
$out->putVarInt($this->reason);
if($out->getProtocol() >= ProtocolInfo::PROTOCOL_622){
$out->putVarInt($this->reason);
}
$out->putBool($this->message === null);
if($this->message !== null){
$out->putString($this->message);
Expand Down
2 changes: 2 additions & 0 deletions src/ProtocolInfo.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ private function __construct(){

public const BASE_VERSION = '1.18.0';

public const PROTOCOL_622 = 622; // 1.20.40
public const PROTOCOL_618 = 618; // 1.20.30
public const PROTOCOL_594 = 594; // 1.20.10
public const PROTOCOL_589 = 589; // 1.20.0
Expand All @@ -59,6 +60,7 @@ private function __construct(){
public const PROTOCOL_475 = 475; // v1.18.0

public const COMPATIBLE_PROTOCOL = [
self::PROTOCOL_622,
self::PROTOCOL_618,
self::PROTOCOL_594,
self::PROTOCOL_589,
Expand Down

0 comments on commit 5045157

Please sign in to comment.