node-minecraft-protocol
node-minecraft-protocol copied to clipboard
Inconsistent `playerChat` event data
- [x] The FAQ doesn't contain a resolution to my issue
Versions
- minecraft-protocol: 1.26.5
Detailed description of a problem
according to index.d.ts, playerChat event's data looks like this:
interface ServerPlayerMessage {
formattedMessage: string
message: string
type: string
sender: string
senderName: string
senderTeam: string
verified?: boolean | undefined
}
but this is inconsistent according to API.md:
Called when a chat message from another player arrives. The emitted object contains:
* formattedMessage -- (JSON) the chat message preformatted, if done on server side
* plainMessage -- (Plaintext) the chat message without formatting (for example no `<username> message` ; instead `message`), on version 1.19+
* unsignedContent -- (JSON) unsigned formatted chat contents ; should only be present when the message is modified and server has chat previews disabled - only on version 1.19 - 1.19.2
* type -- the message type - on 1.19, which format string to use to render message ; below, the place where the message is displayed (for example chat or action bar)
* sender -- the UUID of the player sending the message
* senderTeam -- scoreboard team of the player (pre 1.19)
* senderName -- Name of the sender
* targetName -- Name of the target (for outgoing commands like /tell). Only in 1.19.2+
* verified -- true if message is signed, false if not signed, undefined on versions prior to 1.19
from testing (on 1.19.4), I found that it looks something more like this:
interface ServerPlayerMessage {
formattedMessage?: string
plainMessage?: string
unsignedContent: string
type: number
sender: UUID
// no senderTeam (since only pre-1.19)
senderName: string
targetName: string | undefined
verified: boolean
}
Expected behavior
index.d.ts = API.md = "real life" (testing)