This commit is contained in:
7cc5c4f330d47060 2024-10-24 00:43:22 -04:00
parent b6fc9d144f
commit a0ade1f5d5
Signed by: 7cc5c4f330d47060
SSH key fingerprint: SHA256:e+4tcZut1nBpe10PqjaO+Rvie0Q7W4qIvFzcUw+7riA

View file

@ -17,13 +17,17 @@ for (const plugin of bpl) {
for(const bot of bots){ for(const bot of bots){
pluginItem.default(bot) pluginItem.default(bot)
} }
plugins.push(pluginItem) // For rejoining plugins.push(pluginItem.default) // For rejoining
}) })
} catch (e) { console.log(e) } } catch (e) { console.log(e) }
} }
const createBot = function createBot (host, oldId) { const createBot = function createBot (host, oldId) {
const bot = new EventEmitter() const bot = new EventEmitter()
bot.host = host
bot.interval = {}
bot._client = createClient({ bot._client = createClient({
host: host.host, host: host.host,
port: host.port ? host.port : 25565, port: host.port ? host.port : 25565,
@ -38,16 +42,13 @@ const createBot = function createBot (host, oldId) {
bot.id = oldId bot.id = oldId
bots[oldId] = bot bots[oldId] = bot
for(const pluginItem of plugins){ for(const pluginItem of plugins){
pluginItem.load(bot) pluginItem(bot)
} }
} else { } else {
bot.id = bots.length bot.id = bots.length
bots.push(bot) bots.push(bot)
} }
bot.host = host
bot.interval = {}
bot.info = (msg) => { bot.info = (msg) => {
console.log(`[${bot.id}] [info] ${msg}`) console.log(`[${bot.id}] [info] ${msg}`)
} }