mirror of
https://github.com/PrismarineJS/node-minecraft-protocol.git
synced 2024-11-14 19:04:59 -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')
|
console.log('Connected to server')
|
||||||
rl.prompt()
|
rl.prompt()
|
||||||
|
|
||||||
client.on('playerChat', function ({ senderName, message, formattedMessage, verified }) {
|
client.on('playerChat', function ({ senderName, plainMessage, unsignedContent, formattedMessage, verified }) {
|
||||||
const chat = new ChatMessage(formattedMessage ? JSON.parse(formattedMessage) : message)
|
let content
|
||||||
console.log(senderName, { true: 'Verified:', false: 'UNVERIFIED:' }[verified] || '', chat.toAnsi())
|
|
||||||
|
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