PocketMine-MP
5.21.2 git-b2aa6396c3cc2cafdd815eacc360e1ad89599899
Loading...
Searching...
No Matches
raklib/src/protocol/Packet.php
1
<?php
2
3
/*
4
* This file is part of RakLib.
5
* Copyright (C) 2014-2022 PocketMine Team <https://github.com/pmmp/RakLib>
6
*
7
* RakLib is not affiliated with Jenkins Software LLC nor RakNet.
8
*
9
* RakLib is free software: you can redistribute it and/or modify
10
* it under the terms of the GNU General Public License as published by
11
* the Free Software Foundation, either version 3 of the License, or
12
* (at your option) any later version.
13
*/
14
15
declare(strict_types=1);
16
17
namespace
raklib\protocol;
18
19
use
pocketmine\utils\BinaryDataException
;
20
21
abstract
class
Packet
{
23
public
static
$ID = -1;
24
25
public
function
encode(
PacketSerializer
$out) :
void
{
26
$this->encodeHeader($out);
27
$this->encodePayload($out);
28
}
29
30
protected
function
encodeHeader(
PacketSerializer
$out) :
void
{
31
$out->putByte(static::$ID);
32
}
33
34
abstract
protected
function
encodePayload(
PacketSerializer
$out) : void;
35
39
public
function
decode
(
PacketSerializer
$in) : void{
40
$this->
decodeHeader
($in);
41
$this->
decodePayload
($in);
42
}
43
47
protected
function
decodeHeader
(
PacketSerializer
$in) : void{
48
$in->getByte();
//PID
49
}
50
54
abstract
protected
function
decodePayload
(
PacketSerializer
$in) : void;
55
}
pocketmine\utils\BinaryDataException
Definition
BinaryDataException.php:26
raklib\protocol\Packet
Definition
raklib/src/protocol/Packet.php:21
raklib\protocol\Packet\decodePayload
decodePayload(PacketSerializer $in)
raklib\protocol\Packet\decodeHeader
decodeHeader(PacketSerializer $in)
Definition
raklib/src/protocol/Packet.php:47
raklib\protocol\Packet\decode
decode(PacketSerializer $in)
Definition
raklib/src/protocol/Packet.php:39
raklib\protocol\PacketSerializer
Definition
raklib/src/protocol/PacketSerializer.php:30
vendor
pocketmine
raklib
src
protocol
Packet.php
Generated by
1.12.0