import { PolusBuffer } from "../../../../util/polusBuffer" ; import { PacketHandler } from "../../../packet" ; export interface SetInfectedPacket { InfectedCount ? : number ; InfectedPlayerIDs : number [ ] ; } export const SetInfected = { parse ( packet ) { const count = packet . readVarInt ( ) ; let returnData = { InfectedCount : count , InfectedPlayerIDs : [ ] , } ; for ( let i = 0 ; i < count ; i ++ ) { returnData . InfectedPlayerIDs [ i ] = packet . readVarInt ( ) ; } return returnData ; } , serialize ( packet ) { let buf = new PolusBuffer ( ) ; buf . writeVarInt ( packet . InfectedPlayerIDs . length ) ; for ( let i = 0 ; i < packet . InfectedPlayerIDs . length ; i ++ ) { buf . writeVarInt ( packet . InfectedPlayerIDs [ i ] ) ; } return buf ; } , } ;