mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-04-20 16:00:20 +00:00
sync with latest codegen changes
This commit is contained in:
parent
ffb0ed80a2
commit
a3dea09e2a
@ -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);
|
||||
|
Loading…
x
Reference in New Issue
Block a user