15 lines
317 B
JavaScript
15 lines
317 B
JavaScript
|
const mc = require('minecraft-protocol')
|
||
|
|
||
|
function reconnect (bot, options) {
|
||
|
bot.reconnectDelay = options.reconnectDelay ?? 5000
|
||
|
|
||
|
bot.on('end', () => {
|
||
|
if (bot.reconnectDelay < 0) return
|
||
|
|
||
|
bot._client = mc.createClient(options)
|
||
|
bot.emit('init_client', bot._client)
|
||
|
})
|
||
|
}
|
||
|
|
||
|
module.exports = reconnect;
|