Files
NitoriBot/src/modules/reconnect.js
T

23 lines
550 B
JavaScript

const mc = require('minecraft-protocol');
module.exports = {
data: {
description: "reconnects the players to the server",
enabled: true,
name: "reconnect",
type: "client"
},
inject (context) {
const bot = context.bot;
const config = context.config;
if (bot.server.reconnectDelay < 0) return
bot.on('end', () => {
setTimeout(() => {
let client = new mc.createClient(bot.server)
bot._client = client;
bot.emit('init_client', client)
}, bot.server.reconnectDelay);
})
}
}