mirror of
https://github.com/PrismarineJS/node-minecraft-protocol.git
synced 2024-12-18 19:42:27 -05:00
cf1f67117d
* Add 1.19.3 player_info parsing * player_remove packet parsing * 1.19.3 chat parsing * Outgoing chat for 1.19.3 * Fix lint * Server chat validation * add 1.19.2 and 1.19.3 in version.js * Add 1.19.2 and 1.19.3 in ci.yml * Deprecated client.verifyMessage for server clients * Update docs * Deprecate client.verifyMessage for server clients * Fix tests * Fix lint * Fix packetTest * Fix test * Remove unneeded log statement * Update types/docs * Remove unnecessary feature check * Remove _session from docs Co-authored-by: Romain Beaumont <romain.rom1@gmail.com>
24 lines
666 B
JavaScript
24 lines
666 B
JavaScript
module.exports = client => {
|
|
client.nextMessage = (containing) => {
|
|
return new Promise((resolve) => {
|
|
function onChat (packet) {
|
|
const m = packet.formattedMessage || packet.unsignedChatContent || JSON.stringify({ text: packet.plainMessage })
|
|
if (containing) {
|
|
if (m.includes(containing)) return finish(m)
|
|
else return
|
|
}
|
|
return finish(m)
|
|
}
|
|
client.on('playerChat', onChat)
|
|
client.on('systemChat', onChat) // For 1.7.10
|
|
|
|
function finish (m) {
|
|
client.off('playerChat', onChat)
|
|
client.off('systemChat', onChat)
|
|
resolve(m)
|
|
}
|
|
})
|
|
}
|
|
|
|
return client
|
|
}
|