mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-05-13 01:09:44 +00:00
Added a hack to allow dropping garbage serverbound packets sent by a buggy client
This commit is contained in:
parent
698193622a
commit
b344427a30
@ -48,6 +48,7 @@ use pocketmine\network\mcpe\protocol\ChunkRadiusUpdatedPacket;
|
|||||||
use pocketmine\network\mcpe\protocol\ClientboundPacket;
|
use pocketmine\network\mcpe\protocol\ClientboundPacket;
|
||||||
use pocketmine\network\mcpe\protocol\ContainerSetDataPacket;
|
use pocketmine\network\mcpe\protocol\ContainerSetDataPacket;
|
||||||
use pocketmine\network\mcpe\protocol\DisconnectPacket;
|
use pocketmine\network\mcpe\protocol\DisconnectPacket;
|
||||||
|
use pocketmine\network\mcpe\protocol\GarbageServerboundPacket;
|
||||||
use pocketmine\network\mcpe\protocol\InventoryContentPacket;
|
use pocketmine\network\mcpe\protocol\InventoryContentPacket;
|
||||||
use pocketmine\network\mcpe\protocol\InventorySlotPacket;
|
use pocketmine\network\mcpe\protocol\InventorySlotPacket;
|
||||||
use pocketmine\network\mcpe\protocol\MobArmorEquipmentPacket;
|
use pocketmine\network\mcpe\protocol\MobArmorEquipmentPacket;
|
||||||
@ -313,6 +314,10 @@ class NetworkSession{
|
|||||||
*/
|
*/
|
||||||
public function handleDataPacket(Packet $packet) : void{
|
public function handleDataPacket(Packet $packet) : void{
|
||||||
if(!($packet instanceof ServerboundPacket)){
|
if(!($packet instanceof ServerboundPacket)){
|
||||||
|
if($packet instanceof GarbageServerboundPacket){
|
||||||
|
$this->logger->debug("Garbage serverbound " . $packet->getName() . ": " . base64_encode($packet->getBuffer()));
|
||||||
|
return;
|
||||||
|
}
|
||||||
throw new BadPacketException("Unexpected non-serverbound packet");
|
throw new BadPacketException("Unexpected non-serverbound packet");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -0,0 +1,32 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/*
|
||||||
|
*
|
||||||
|
* ____ _ _ __ __ _ __ __ ____
|
||||||
|
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
|
||||||
|
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
|
||||||
|
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
|
||||||
|
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Lesser General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* @author PocketMine Team
|
||||||
|
* @link http://www.pocketmine.net/
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace pocketmine\network\mcpe\protocol;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This interface can be implemented by packets which are erroneously sent to the server by a buggy client to filter
|
||||||
|
* them out.
|
||||||
|
*/
|
||||||
|
interface GarbageServerboundPacket extends Packet{
|
||||||
|
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user