mirror of
https://code.chipmunk.land/Parker2991/NitoriBot/
synced 2026-11-29 21:55:38 -05:00
23 lines
604 B
TypeScript
23 lines
604 B
TypeScript
import mc from 'minecraft-protocol';
|
|
|
|
export default class Reconnect {
|
|
constructor (context: any) {
|
|
const bot = context.bot;
|
|
const config = context.config;
|
|
const options = bot.options;
|
|
bot.reconnectDelay = options.reconnectDelay;
|
|
let client;
|
|
|
|
bot.on('end', () => {
|
|
bot.world.dimensions = [];
|
|
bot.world.chunks = [];
|
|
bot.world.currentDimension = undefined;
|
|
setTimeout(() => {
|
|
client = options.client ?? mc.createClient(options);
|
|
bot._client = client;
|
|
bot.emit("init_client", bot._client);
|
|
}, bot.reconnectDelay);
|
|
})
|
|
}
|
|
}
|