protocol: avoid potential constructor refactoring packet decode bug

if the order of the constructor parameters were changed, it would cause these statements to be reordered, causing packet fields to be decoded in the wrong order.
This commit is contained in:
Dylan K. Taylor 2020-07-17 23:19:33 +01:00
parent 3e2cfd28cc
commit 1ba32c98c7
2 changed files with 12 additions and 14 deletions

View File

@ -91,14 +91,13 @@ class ResourcePackInfoEntry{
}
public static function read(PacketSerializer $in) : self{
return new self(
$uuid = $in->getString(),
$version = $in->getString(),
$sizeBytes = $in->getLLong(),
$encryptionKey = $in->getString(),
$subPackName = $in->getString(),
$contentId = $in->getString(),
$hasScripts = $in->getBool()
);
$uuid = $in->getString();
$version = $in->getString();
$sizeBytes = $in->getLLong();
$encryptionKey = $in->getString();
$subPackName = $in->getString();
$contentId = $in->getString();
$hasScripts = $in->getBool();
return new self($uuid, $version, $sizeBytes, $encryptionKey, $subPackName, $contentId, $hasScripts);
}
}

View File

@ -59,10 +59,9 @@ class ResourcePackStackEntry{
}
public static function read(PacketSerializer $in) : self{
return new self(
$packId = $in->getString(),
$version = $in->getString(),
$subPackName = $in->getString()
);
$packId = $in->getString();
$version = $in->getString();
$subPackName = $in->getString();
return new self($packId, $version, $subPackName);
}
}