Add restrictions on packet send directions with interfaces

This prevents plugins sending wrong packets at the compiler level (or would, if we had a compiler). It's more robust than a getter for client/server and throwing an exception since a static analysis tool can detect faults created by sending wrong packets from the server. This is also used to deny service to dodgy clients which send wrong packets to the server to attack it.
This commit is contained in:
Dylan K. Taylor
2019-01-04 03:19:47 +00:00
parent b82e00ffdf
commit 76f1ee1827
130 changed files with 237 additions and 174 deletions

View File

@ -37,7 +37,7 @@ use pocketmine\network\mcpe\protocol\types\UseItemTransactionData;
/**
* This packet effectively crams multiple packets into one.
*/
class InventoryTransactionPacket extends DataPacket{
class InventoryTransactionPacket extends DataPacket implements ClientboundPacket, ServerboundPacket{
public const NETWORK_ID = ProtocolInfo::INVENTORY_TRANSACTION_PACKET;
public const TYPE_NORMAL = 0;