Skip to content

Commit

Permalink
修正钩子参数
Browse files Browse the repository at this point in the history
  • Loading branch information
bangbang93 committed Jan 26, 2022
1 parent 01ba639 commit 84f133b
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/backend.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export interface IBackend {
handlePing: boolean
onlineMode: boolean
useProxy: boolean
ping: {
ping?: {
maxPlayer: number
description?: string
favicon?: string
Expand Down
2 changes: 1 addition & 1 deletion src/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ export class Client extends EventEmitter {

public async pipeToBackend(backend: Backend, nextState: number): Promise<Socket> {
this.socket.unpipe()
await this.proxy.plugin.hooks.server.prePipeToBackend.promise(this)
await this.proxy.plugin.hooks.server.prePipeToBackend.promise(this, backend)
if (this.closed) return

const socket = connect(backend.port, backend.host)
Expand Down
4 changes: 2 additions & 2 deletions src/plugin-hook.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {isEmpty} from 'lodash'
import {AsyncParallelHook, AsyncSeriesBailHook} from 'tapable'
import {Service} from 'typedi'
import {VError} from 'verror'
import {IBackend} from './backend'
import {Backend, IBackend} from './backend'
import {Client} from './client'
import {Config} from './config'
import {ProxyServer} from './proxy-server'
Expand All @@ -20,7 +20,7 @@ export class PluginHook {
public readonly hooks = Object.freeze({
server: {
lookupBackend: new AsyncSeriesBailHook<[string], IBackend>(['serverName']),
prePipeToBackend: new AsyncParallelHook<[Client]>(),
prePipeToBackend: new AsyncParallelHook<[Client, Backend]>(),
},
})

Expand Down

0 comments on commit 84f133b

Please sign in to comment.