MCServer/src/packet/Packet.ts
2023-12-10 21:40:40 +03:00

22 lines
568 B
TypeScript

import {PacketEnum} from "../utils/PacketEnum";
import {createWriter, Endian, IReader} from "bufferstuff";
import {Player} from "../Player";
import {Socket} from "node:net";
export class Packet {
constructor(public options: IPacketOption) {
options.name = PacketEnum[options.packetID].toString();
}
readData(reader: IReader, player: Player) {}
writeData() {
return createWriter(Endian.BE).toBuffer();
}
}
export interface IPacketOption {
player?: Player,
packetID: PacketEnum,
name?: string,
kickReason?: string
}