Export default

This commit is contained in:
7cc5c4f330d47060 2024-10-23 22:59:54 -04:00
parent e87c85c0c1
commit 382e6ce045
Signed by: 7cc5c4f330d47060
SSH key fingerprint: SHA256:e+4tcZut1nBpe10PqjaO+Rvie0Q7W4qIvFzcUw+7riA
16 changed files with 17 additions and 17 deletions

View file

@ -1,6 +1,6 @@
import { createClient } from "minecraft-protocol"; import { createClient } from "minecraft-protocol";
import { default as settings } from './settings.json' with {type: "json"} import { default as settings } from './settings.json' with {type: "json"}
import { generateUser } from './util/usergen.js' import generateUser from './util/usergen.js'
import EventEmitter from 'node:events' import EventEmitter from 'node:events'
import { readdirSync } from "node:fs"; import { readdirSync } from "node:fs";
@ -15,7 +15,7 @@ for (const plugin of bpl) {
try { try {
import(`./plugins/${plugin}`).then((pluginItem)=>{ import(`./plugins/${plugin}`).then((pluginItem)=>{
for(const bot of bots){ for(const bot of bots){
pluginItem.load(bot) pluginItem.default(bot)
} }
plugins.push(pluginItem) // For rejoining plugins.push(pluginItem) // For rejoining
}) })

View file

@ -1,4 +1,4 @@
export function load (b) { export default function load (b) {
b._client.on('login', () => { b._client.on('login', () => {
b.interval.chatQueue = setInterval(() => { b.interval.chatQueue = setInterval(() => {
if (b.chatqueue.length !== 0) { if (b.chatqueue.length !== 0) {

View file

@ -7,7 +7,7 @@ const cs = {
z: 4 z: 4
} }
export function load (b) { export default function load (b) {
b.interval.commandFill = setInterval(() => { if (b.sc_tasks.cc) b.sc_tasks.cc.failed = 1 }, 150000) b.interval.commandFill = setInterval(() => { if (b.sc_tasks.cc) b.sc_tasks.cc.failed = 1 }, 150000)
b.ccq = [] b.ccq = []
b.blocknoX = 0 b.blocknoX = 0

View file

@ -1,3 +1,3 @@
export function load (b) { export default function load (b) {
console.log(`Test plugin loaded on bot ${b.id}`) console.log(`Test plugin loaded on bot ${b.id}`)
} }

View file

@ -1,7 +1,7 @@
import { parse2 as parse } from '../util/chatparse_plain.js' import { parse2 as parse } from '../util/chatparse_plain.js'
import { parse as parseNBT } from '../util/parseNBT.js' import { parse as parseNBT } from '../util/parseNBT.js'
export function load (b) { export default function load (b) {
b.players = {} b.players = {}
b._client.on('player_info', (data) => { b._client.on('player_info', (data) => {
const buffer2 = {} const buffer2 = {}

View file

@ -1,5 +1,5 @@
import { createBot } from "../index.js" import { createBot } from "../index.js"
export function load (b) { export default function load (b) {
b._client.on('end', () => { b._client.on('end', () => {
b.info(`Bot ${b.id} disconnected`) b.info(`Bot ${b.id} disconnected`)
for (const i in b.interval) { for (const i in b.interval) {

View file

@ -14,7 +14,7 @@ class SCTask {
} }
export function load (b) { export default function load (b) {
b.sc_tasks = {} b.sc_tasks = {}
b.selfcareRun = 0 b.selfcareRun = 0
b.interval.sc = setInterval(() => { b.interval.sc = setInterval(() => {

View file

@ -45,7 +45,7 @@ for (const plugin of bpl) {
} }
export function load (b) { export default function load (b) {
b.messageCount = 0 b.messageCount = 0
b.chatDisabledUntil = 0 b.chatDisabledUntil = 0
b.interval.antiSpam = setInterval(() => { b.interval.antiSpam = setInterval(() => {

View file

@ -119,7 +119,7 @@ const parse = function (_data, l = 0, resetColor = consoleColors.reset) {
out += resetColor out += resetColor
return out return out
} }
export function parse2 (_data, l, resetColor) { export default function parse2 (_data, l, resetColor) {
try { try {
return parse(_data) return parse(_data)
} catch (e) { } catch (e) {

View file

@ -85,7 +85,7 @@ const parse = function (_data, l = 0, resetColor = consoleColors.reset) {
out += resetColor out += resetColor
return out return out
} }
export function parse2 (_data, l, resetColor) { export default function parse2 (_data, l, resetColor) {
try { try {
return parse(_data) return parse(_data)
} catch (e) { } catch (e) {

View file

@ -87,7 +87,7 @@ const parse = function (_data, l = 0, resetColor = consoleColors.reset) {
out += resetColor out += resetColor
return out return out
} }
export function parse2 (_data, l, resetColor) { export default function parse2 (_data, l, resetColor) {
try { try {
return parse(_data) return parse(_data)
} catch (e) { } catch (e) {

View file

@ -46,7 +46,7 @@ const parse = function (_data, l = 0) {
} }
return out return out
} }
export function parse2 (_data, l) { export default function parse2 (_data, l) {
try { try {
return parse(_data) return parse(_data)
} catch (e) { } catch (e) {

View file

@ -4,4 +4,4 @@ const lang = Object.create(null) // Without constructor function
for (const i in _lang) { for (const i in _lang) {
lang[i] = _lang[i] lang[i] = _lang[i]
} }
export { lang } export default lang

View file

@ -1,5 +1,5 @@
import { processNbtMessage } from 'prismarine-chat' import { processNbtMessage } from 'prismarine-chat'
export function parse (data) { export default function parse (data) {
if (typeof data.type === 'string') { if (typeof data.type === 'string') {
return JSON.parse(processNbtMessage(data)) return JSON.parse(processNbtMessage(data))
} else if (typeof data === 'string') { } else if (typeof data === 'string') {

View file

@ -1,4 +1,4 @@
import { randomBytes } from "crypto"; import { randomBytes } from "crypto";
export function generateUser (legal) { export default function generateUser (legal) {
return `${parseInt(randomBytes(4).toString("hex"),16).toString(36)}${parseInt(randomBytes(4).toString("hex"),16).toString(36)}` return `${parseInt(randomBytes(4).toString("hex"),16).toString(36)}${parseInt(randomBytes(4).toString("hex"),16).toString(36)}`
} }

View file

@ -1,4 +1,4 @@
export function uuidToInt (uuid) { export default function uuidToInt (uuid) {
const splitUUID = uuid.replace(/[^0-9a-f]/g, '').replace(/.{1,8}/g, a => { return `0x${a}` }).match(/.{1,10}/g) const splitUUID = uuid.replace(/[^0-9a-f]/g, '').replace(/.{1,8}/g, a => { return `0x${a}` }).match(/.{1,10}/g)
const numUUID = [+splitUUID[0] << 0, +splitUUID[1] << 0, +splitUUID[2] << 0, +splitUUID[3] << 0] const numUUID = [+splitUUID[0] << 0, +splitUUID[1] << 0, +splitUUID[2] << 0, +splitUUID[3] << 0]
return numUUID return numUUID