19 lines
No EOL
472 B
JavaScript
19 lines
No EOL
472 B
JavaScript
const mc = require('minecraft-protocol')
|
|
|
|
function reconnect (bot, options) {
|
|
bot.reconnectDelay = options.reconnectDelay ?? 5200 // Set from 1000 to 5200 - yfd
|
|
|
|
bot.on('end', (reason) => {
|
|
if (bot.reconnectDelay < 0) return
|
|
|
|
setTimeout(() => {
|
|
|
|
const client = options.client ?? mc.createClient(options)
|
|
bot._client = client
|
|
bot.emit('init_client', client)
|
|
|
|
}, bot.reconnectDelay)
|
|
})
|
|
}
|
|
|
|
module.exports = reconnect
|