mineflayer
Version:
create minecraft bots with a stable, high level API
15 lines (13 loc) • 341 B
JavaScript
module.exports = inject
function inject (bot) {
bot._client.on('kick_disconnect', (packet) => {
bot.emit('kicked', packet.reason, true)
})
bot._client.on('disconnect', (packet) => {
bot.emit('kicked', packet.reason, false)
})
bot.quit = (reason) => {
reason = reason ?? 'disconnect.quitting'
bot.end(reason)
}
}