Skip to content

Commit

Permalink
fix command arg
Browse files Browse the repository at this point in the history
  • Loading branch information
AkmalFairuz committed Mar 14, 2024
1 parent 26de0fb commit 6199056
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion src/AvailableCommandsPacket.php
Original file line number Diff line number Diff line change
Expand Up @@ -622,10 +622,24 @@ public function handle(PacketHandlerInterface $handler) : bool{
}

public static function convertArg(int $protocolId, int $type) : int{
if($protocolId >= ProtocolInfo::PROTOCOL_568){
if($protocolId >= ProtocolInfo::PROTOCOL_568 && $protocolId < ProtocolInfo::PROTOCOL_662){
return $type;
}

if($protocolId >= ProtocolInfo::PROTOCOL_662){
return match ($type) {
self::ARG_TYPE_EQUIPMENT_SLOT => 47,
self::ARG_TYPE_STRING => 48,
self::ARG_TYPE_INT_POSITION => 64,
self::ARG_TYPE_POSITION => 65,
self::ARG_TYPE_MESSAGE => 67,
self::ARG_TYPE_RAWTEXT => 70,
self::ARG_TYPE_JSON => 74,
self::ARG_TYPE_BLOCK_STATES => 84,
self::ARG_TYPE_COMMAND => 87,
};
}

if($protocolId >= ProtocolInfo::PROTOCOL_527){
return match ($type) {
self::ARG_TYPE_INT_POSITION => 0x2f,
Expand Down

0 comments on commit 6199056

Please sign in to comment.