sync with latest codegen changes

This commit is contained in:
Dylan K. Taylor 2019-04-25 15:19:15 +01:00
parent ffb0ed80a2
commit a3dea09e2a

View File

@ -27,7 +27,7 @@ use pocketmine\utils\Binary;
use pocketmine\utils\BinaryDataException;
class PacketPool{
/** @var \SplFixedArray<DataPacket> */
/** @var \SplFixedArray<Packet> */
protected static $pool = null;
public static function init() : void{
@ -159,28 +159,28 @@ class PacketPool{
}
/**
* @param DataPacket $packet
* @param Packet $packet
*/
public static function registerPacket(DataPacket $packet) : void{
public static function registerPacket(Packet $packet) : void{
static::$pool[$packet->pid()] = clone $packet;
}
/**
* @param int $pid
*
* @return DataPacket
* @return Packet
*/
public static function getPacketById(int $pid) : DataPacket{
public static function getPacketById(int $pid) : Packet{
return isset(static::$pool[$pid]) ? clone static::$pool[$pid] : new UnknownPacket();
}
/**
* @param string $buffer
*
* @return DataPacket
* @return Packet
* @throws BinaryDataException
*/
public static function getPacket(string $buffer) : DataPacket{
public static function getPacket(string $buffer) : Packet{
$offset = 0;
$pk = static::getPacketById(Binary::readUnsignedVarInt($buffer, $offset));
$pk->setBuffer($buffer, $offset);