Fix Server maxPlayers option (#565)

This commit is contained in:
extremeheat 2025-01-18 02:51:08 -05:00 committed by GitHub
commit 38dc5a2561
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 4 additions and 3 deletions

2
index.d.ts vendored
View file

@ -162,7 +162,7 @@ declare module 'bedrock-protocol' {
constructor(options: Options)
listen(host?: string, port?: number): Promise<void>
listen(): Promise<void>
close(disconnectReason?: string): Promise<void>
on(event: 'connect', cb: (client: Player) => void): any

View file

@ -118,8 +118,9 @@ class Server extends EventEmitter {
return this.advertisement
}
async listen (host = this.options.host, port = this.options.port) {
this.raknet = new this.RakServer({ host, port }, this)
async listen () {
const { host, port, maxPlayers } = this.options
this.raknet = new this.RakServer({ host, port, maxPlayers }, this)
try {
await this.raknet.listen()