2022-12-05 03:16:48 -05:00
|
|
|
|
2022-11-30 06:01:46 -05:00
|
|
|
const { chatPacketListener, parsePlayerMessages } = require('../../util/chat')
|
2022-12-10 01:31:01 -05:00
|
|
|
const minecraftVersionToNumber = require('../../util/minecraftVersionToNumber')
|
2022-11-30 06:01:46 -05:00
|
|
|
function inject (bot, client, target) {
|
2022-12-10 01:31:01 -05:00
|
|
|
function listener (packet) {
|
|
|
|
chatPacketListener(packet, target, minecraftVersionToNumber(target.version) >= 1.19)
|
|
|
|
}
|
2023-02-26 04:50:15 -05:00
|
|
|
target.on('systemChat', listener)
|
2022-12-10 01:31:01 -05:00
|
|
|
target.on('chat', listener)
|
2022-11-30 06:01:46 -05:00
|
|
|
|
2022-12-12 03:06:50 -05:00
|
|
|
target.on('message', (message, packet) => {
|
2022-11-30 06:01:46 -05:00
|
|
|
parsePlayerMessages(message, packet, target)
|
|
|
|
})
|
|
|
|
};
|
|
|
|
|
|
|
|
module.exports = { inject }
|