mirror of
https://github.com/PrismarineJS/node-minecraft-protocol.git
synced 2025-02-15 23:39:45 -05:00
Use consistent parameter naming for systemChat event (#1076)
* Use consistent parameter naming for systemChat event * Update docs * Update types
This commit is contained in:
parent
84bd97c3cb
commit
e3e20757ef
3 changed files with 4 additions and 3 deletions
|
@ -279,7 +279,7 @@ Called when a chat message from another player arrives. The emitted object conta
|
|||
|
||||
Called when a system chat message arrives. A system chat message is any message not sent by a player. The emitted object contains:
|
||||
* formattedMessage -- the chat message preformatted
|
||||
* positionid -- the chat type of the message. 1 for system chat and 2 for actionbar
|
||||
* positionId -- the chat type of the message. 1 for system chat and 2 for actionbar
|
||||
|
||||
See the [chat example](https://github.com/PrismarineJS/node-minecraft-protocol/blob/master/examples/client_chat/client_chat.js#L1) for usage.
|
||||
|
||||
|
|
|
@ -158,7 +158,7 @@ module.exports = function (client, options) {
|
|||
|
||||
client.on('system_chat', (packet) => {
|
||||
client.emit('systemChat', {
|
||||
positionid: packet.isActionBar ? 2 : 1,
|
||||
positionId: packet.isActionBar ? 2 : 1,
|
||||
formattedMessage: packet.content
|
||||
})
|
||||
|
||||
|
|
3
src/index.d.ts
vendored
3
src/index.d.ts
vendored
|
@ -48,7 +48,8 @@ declare module 'minecraft-protocol' {
|
|||
on(event: 'connect', handler: () => PromiseLike): this
|
||||
on(event: string, handler: (data: any, packetMeta: PacketMeta) => PromiseLike): this
|
||||
on(event: `raw.${string}`, handler: (buffer: Buffer, packetMeta: PacketMeta) => PromiseLike): this
|
||||
on(event: 'playerChat', handler: ({ formattedMessage: string, message: string, type: string, sender: string, senderName: string, senderTeam: string, verified?: boolean })): this
|
||||
on(event: 'playerChat', handler: (data: { formattedMessage: string, message: string, type: string, sender: string, senderName: string, senderTeam: string, verified?: boolean }) => PromiseLike): this
|
||||
on(event: 'systemChat', handler: (data: { positionId: number, formattedMessage: string }) => PromiseLike): this
|
||||
once(event: 'error', listener: (error: Error) => PromiseLike): this
|
||||
once(event: 'packet', handler: (data: any, packetMeta: PacketMeta, buffer: Buffer, fullBuffer: Buffer) => PromiseLike): this
|
||||
once(event: 'raw', handler: (buffer: Buffer, packetMeta: PacketMeta) => PromiseLike): this
|
||||
|
|
Loading…
Reference in a new issue