MCPcopy Create free account
hub / github.com/PrismarineJS/node-minecraft-protocol / isFormatted

Function isFormatted

src/client/chat.js:7–19  ·  view source on GitHub ↗
(message)

Source from the content-addressed store, hash-verified

5const messageExpireTime = 420000 // 7 minutes (ms)
6
7function isFormatted (message) {
8 // This should match the ChatComponent.isDecorated function from Vanilla
9 try {
10 const comp = JSON.parse(message)
11 for (const key in comp) {
12 if (key !== 'text') return true
13 }
14 if (comp.text && comp.text !== message) return true
15 return false
16 } catch {
17 return false
18 }
19}
20
21module.exports = function (client, options) {
22 const mcData = require('minecraft-data')(client.version)

Callers 1

chat.jsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected