Skip to content

Commit

Permalink
feat: 'relay.joined' event plugin register
Browse files Browse the repository at this point in the history
  • Loading branch information
Cdm2883 committed Jun 25, 2024
1 parent 4131fc0 commit 8c22c50
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/bridgeo/plugin/register/plugin-register-relay.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { binding } from "@/bridgeo/utils/js/functions";
export interface IPluginRegisterRelay extends PacketsReceiver {
onRelayCreating?(material: RelayCreatingMaterial): void;
onRelayCreated?(relay: CommonRelay, material: Readonly<RelayCreatingMaterial>): void;
onRelayJoined?(context: RelayContext): void;
onClientBound?<T>(this: RelayContext, packet: PacketStub<T>, options: PacketOptionsStub<T>): void;
onServerBound?<T>(this: RelayContext, packet: PacketStub<T>, options: PacketOptionsStub<T>): void;
onUpstream?(this: RelayContext, buffer: Buffer, options: { canceled: boolean }): void;
Expand All @@ -28,6 +29,8 @@ export class PluginRegisterRelay extends PluginRegister<IPluginRegisterRelay> {
}

const handlePackets = (context: RelayContext) => {
handler.onRelayJoined?.(context);

const onClientBound = handler.onClientBound?.bind(context);
const onServerBound = handler.onServerBound?.bind(context);
if (onClientBound || onServerBound) {
Expand Down

0 comments on commit 8c22c50

Please sign in to comment.