mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-09-08 02:42:58 +00:00
Made some changes for 0.12
This commit is contained in:
committed by
Shoghi Cervantes
parent
0380e9009a
commit
4258e22c02
@ -74,6 +74,7 @@ use pocketmine\network\protocol\UpdateBlockPacket;
|
||||
use pocketmine\network\protocol\UseItemPacket;
|
||||
use pocketmine\Player;
|
||||
use pocketmine\Server;
|
||||
use pocketmine\utils\Binary;
|
||||
use pocketmine\utils\MainLogger;
|
||||
|
||||
class Network{
|
||||
@ -219,14 +220,22 @@ class Network{
|
||||
$offset = 0;
|
||||
try{
|
||||
while($offset < $len){
|
||||
if(($pk = $this->getPacket(ord($str{$offset++}))) !== null){
|
||||
$pkLen = Binary::readInt(substr($str, $offset, 4));
|
||||
$offset += 4;
|
||||
|
||||
$buf = substr($str, $offset, $pkLen);
|
||||
$offset += $pkLen;
|
||||
|
||||
if(($pk = $this->getPacket(ord($buf{0}))) !== null){
|
||||
if($pk::NETWORK_ID === Info::BATCH_PACKET){
|
||||
throw new \InvalidStateException("Invalid BatchPacket inside BatchPacket");
|
||||
}
|
||||
$pk->setBuffer($str, $offset);
|
||||
|
||||
$pk->setBuffer($buf, 1);
|
||||
|
||||
$pk->decode();
|
||||
$p->handleDataPacket($pk);
|
||||
$offset += $pk->getOffset();
|
||||
|
||||
if($pk->getOffset() <= 0){
|
||||
return;
|
||||
}
|
||||
|
Reference in New Issue
Block a user