mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-05-28 08:07:01 +00:00
Cleaned up batching checks
This commit is contained in:
parent
4d897b824b
commit
bf9b8722c9
@ -57,6 +57,9 @@ class BatchPacket extends DataPacket{
|
||||
*/
|
||||
public function addPacket($packet){
|
||||
if($packet instanceof DataPacket){
|
||||
if(!$packet->canBeBatched()){
|
||||
throw new \InvalidArgumentException(get_class($packet) . " cannot be put inside a BatchPacket");
|
||||
}
|
||||
if(!$packet->isEncoded){
|
||||
$packet->encode();
|
||||
}
|
||||
@ -93,9 +96,10 @@ class BatchPacket extends DataPacket{
|
||||
while(!$this->feof()){
|
||||
$buf = $this->getString();
|
||||
$pk = $network->getPacket(ord($buf{0}));
|
||||
/*if(!$pk->canBeBatched()){
|
||||
|
||||
if(!$pk->canBeBatched()){
|
||||
throw new \InvalidArgumentException("Received invalid " . get_class($pk) . " inside BatchPacket");
|
||||
}*/
|
||||
}
|
||||
|
||||
$pk->setBuffer($buf, 1);
|
||||
$session->handleDataPacket($pk);
|
||||
|
@ -44,10 +44,6 @@ class LoginPacket extends DataPacket{
|
||||
|
||||
public $clientData = [];
|
||||
|
||||
public function canBeBatched() : bool{
|
||||
return false;
|
||||
}
|
||||
|
||||
public function canBeSentBeforeLogin() : bool{
|
||||
return true;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user