mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-07-03 16:49:53 +00:00
Remove GarbageServerboundPacket
it's not the protocol implementation's job to decide what's garbage. It should only indicate that a packet MAY be sent by the client. It should then be up to the handler to decide what to do with it.
This commit is contained in:
parent
6845cbb2b3
commit
66fdf526d4
@ -59,7 +59,6 @@ use pocketmine\network\mcpe\protocol\AvailableCommandsPacket;
|
|||||||
use pocketmine\network\mcpe\protocol\ChunkRadiusUpdatedPacket;
|
use pocketmine\network\mcpe\protocol\ChunkRadiusUpdatedPacket;
|
||||||
use pocketmine\network\mcpe\protocol\ClientboundPacket;
|
use pocketmine\network\mcpe\protocol\ClientboundPacket;
|
||||||
use pocketmine\network\mcpe\protocol\DisconnectPacket;
|
use pocketmine\network\mcpe\protocol\DisconnectPacket;
|
||||||
use pocketmine\network\mcpe\protocol\GarbageServerboundPacket;
|
|
||||||
use pocketmine\network\mcpe\protocol\MobArmorEquipmentPacket;
|
use pocketmine\network\mcpe\protocol\MobArmorEquipmentPacket;
|
||||||
use pocketmine\network\mcpe\protocol\MobEffectPacket;
|
use pocketmine\network\mcpe\protocol\MobEffectPacket;
|
||||||
use pocketmine\network\mcpe\protocol\MobEquipmentPacket;
|
use pocketmine\network\mcpe\protocol\MobEquipmentPacket;
|
||||||
@ -376,10 +375,6 @@ class NetworkSession{
|
|||||||
*/
|
*/
|
||||||
public function handleDataPacket(Packet $packet, string $buffer) : void{
|
public function handleDataPacket(Packet $packet, string $buffer) : void{
|
||||||
if(!($packet instanceof ServerboundPacket)){
|
if(!($packet instanceof ServerboundPacket)){
|
||||||
if($packet instanceof GarbageServerboundPacket){
|
|
||||||
$this->logger->debug("Garbage serverbound " . $packet->getName() . ": " . base64_encode($buffer));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
throw new PacketHandlingException("Unexpected non-serverbound packet");
|
throw new PacketHandlingException("Unexpected non-serverbound packet");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -76,6 +76,7 @@ use pocketmine\network\mcpe\protocol\PlayerInputPacket;
|
|||||||
use pocketmine\network\mcpe\protocol\PlayerSkinPacket;
|
use pocketmine\network\mcpe\protocol\PlayerSkinPacket;
|
||||||
use pocketmine\network\mcpe\protocol\RequestChunkRadiusPacket;
|
use pocketmine\network\mcpe\protocol\RequestChunkRadiusPacket;
|
||||||
use pocketmine\network\mcpe\protocol\ServerSettingsRequestPacket;
|
use pocketmine\network\mcpe\protocol\ServerSettingsRequestPacket;
|
||||||
|
use pocketmine\network\mcpe\protocol\SetActorMotionPacket;
|
||||||
use pocketmine\network\mcpe\protocol\SetPlayerGameTypePacket;
|
use pocketmine\network\mcpe\protocol\SetPlayerGameTypePacket;
|
||||||
use pocketmine\network\mcpe\protocol\ShowCreditsPacket;
|
use pocketmine\network\mcpe\protocol\ShowCreditsPacket;
|
||||||
use pocketmine\network\mcpe\protocol\SpawnExperienceOrbPacket;
|
use pocketmine\network\mcpe\protocol\SpawnExperienceOrbPacket;
|
||||||
@ -581,6 +582,10 @@ class InGamePacketHandler extends PacketHandler{
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function handleSetActorMotion(SetActorMotionPacket $packet) : bool{
|
||||||
|
return true; //Not used: This packet is (erroneously) sent to the server when the client is riding a vehicle.
|
||||||
|
}
|
||||||
|
|
||||||
public function handleAnimate(AnimatePacket $packet) : bool{
|
public function handleAnimate(AnimatePacket $packet) : bool{
|
||||||
return true; //Not used
|
return true; //Not used
|
||||||
}
|
}
|
||||||
|
@ -1,32 +0,0 @@
|
|||||||
<?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{
|
|
||||||
|
|
||||||
}
|
|
@ -28,10 +28,7 @@ namespace pocketmine\network\mcpe\protocol;
|
|||||||
use pocketmine\math\Vector3;
|
use pocketmine\math\Vector3;
|
||||||
use pocketmine\network\mcpe\protocol\serializer\PacketSerializer;
|
use pocketmine\network\mcpe\protocol\serializer\PacketSerializer;
|
||||||
|
|
||||||
/**
|
class SetActorMotionPacket extends DataPacket implements ClientboundPacket, ServerboundPacket{
|
||||||
* TODO: This packet is (erroneously) sent to the server when the client is riding a vehicle.
|
|
||||||
*/
|
|
||||||
class SetActorMotionPacket extends DataPacket implements ClientboundPacket, GarbageServerboundPacket{
|
|
||||||
public const NETWORK_ID = ProtocolInfo::SET_ACTOR_MOTION_PACKET;
|
public const NETWORK_ID = ProtocolInfo::SET_ACTOR_MOTION_PACKET;
|
||||||
|
|
||||||
/** @var int */
|
/** @var int */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user