mirror of
https://github.com/PrismarineJS/node-minecraft-protocol.git
synced 2024-11-14 10:55:05 -05:00
parent
4f9341e654
commit
f2875a5f03
1 changed files with 11 additions and 3 deletions
|
@ -43,9 +43,17 @@ client.on('connect', () => {
|
|||
console.log('Connected to server')
|
||||
rl.prompt()
|
||||
|
||||
client.on('playerChat', function ({ senderName, message, formattedMessage, verified }) {
|
||||
const chat = new ChatMessage(formattedMessage ? JSON.parse(formattedMessage) : message)
|
||||
console.log(senderName, { true: 'Verified:', false: 'UNVERIFIED:' }[verified] || '', chat.toAnsi())
|
||||
client.on('playerChat', function ({ senderName, plainMessage, unsignedContent, formattedMessage, verified }) {
|
||||
let content
|
||||
|
||||
const allowInsecureChat = true
|
||||
|
||||
if (formattedMessage) content = JSON.parse(formattedMessage)
|
||||
else if (allowInsecureChat && unsignedContent) content = JSON.parse(unsignedContent)
|
||||
else content = { text: plainMessage }
|
||||
|
||||
const chat = new ChatMessage(content)
|
||||
console.log(senderName, { trugie: 'Verified:', false: 'UNVERIFIED:' }[verified] || '', chat.toAnsi())
|
||||
})
|
||||
})
|
||||
|
||||
|
|
Loading…
Reference in a new issue