mc-beta-server/server/MPClient.ts
2023-04-08 20:52:47 +01:00

21 lines
No EOL
469 B
TypeScript

import { Socket } from "net";
import { IEntity } from "./entities/IEntity";
import { Writer } from "../bufferStuff";
export class MPClient {
private readonly socket:Socket;
private readonly entity:IEntity;
public constructor(socket:Socket, entity:IEntity) {
this.socket = socket;
this.entity = entity;
}
send(buffer:Buffer|Writer) {
if (buffer instanceof Writer) {
this.socket.write(buffer.toBuffer());
} else {
this.socket.write(buffer);
}
}
}