Add m_c_player format

This commit is contained in:
7cc5c4f330d47060 2024-09-02 22:32:35 -04:00
parent 4cf86f31c1
commit 83d2cf4a65
Signed by: 7cc5c4f330d47060
SSH key fingerprint: SHA256:e+4tcZut1nBpe10PqjaO+Rvie0Q7W4qIvFzcUw+7riA

View file

@ -141,6 +141,19 @@ module.exports = {
username: "" username: ""
}) })
} }
} else if(json.extra && json.extra[4] && json.extra[3] && json.extra[5] && json.extra[4].text == ' » '){ // ChipmunkMod format - m_c_player
const username = parsePlain(json.extra[3])
const uuid = b.findUUID(username)
const nickname = b.findDisplayName(uuid)
const message = parsePlain(json.extra[5])
b.emit('chat', {
json,
type: 'system',
uuid,
message,
nickname,
username
})
} else { // Generic system chat format } else { // Generic system chat format
const parsed = parsePlain(json) const parsed = parsePlain(json)
const split = parsed.split(': ') const split = parsed.split(': ')
@ -175,6 +188,11 @@ module.exports = {
nickname = b.findDisplayName(uuid) nickname = b.findDisplayName(uuid)
message = parsePlain(json.with[2].extra) message = parsePlain(json.with[2].extra)
} }
} else if(json.extra && json.extra[4] && json.extra[3] && json.extra[5] && json.extra[4].text == ' » '){ // ChipmunkMod format - m_c_player
username = parsePlain(json.extra[3])
uuid = b.findUUID(username)
nickname = b.findDisplayName(uuid)
message = parsePlain(json.extra[5])
} else if (b.host.options.isVanilla && json.translate === 'chat.type.text') { // Servers without Extras chat } else if (b.host.options.isVanilla && json.translate === 'chat.type.text') { // Servers without Extras chat
if (json.with && json.with.length >= 2) { if (json.with && json.with.length >= 2) {
message = parsePlain(json.with[1]) message = parsePlain(json.with[1])