Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inconsistent playerChat event data #1281

Open
1 task done
Dinhero21 opened this issue Jan 10, 2024 · 0 comments · May be fixed by #1303
Open
1 task done

Inconsistent playerChat event data #1281

Dinhero21 opened this issue Jan 10, 2024 · 0 comments · May be fixed by #1303

Comments

@Dinhero21
Copy link

  • 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)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant