Export default
This commit is contained in:
parent
e87c85c0c1
commit
382e6ce045
16 changed files with 17 additions and 17 deletions
4
index.js
4
index.js
|
@ -1,6 +1,6 @@
|
|||
import { createClient } from "minecraft-protocol";
|
||||
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 { readdirSync } from "node:fs";
|
||||
|
||||
|
@ -15,7 +15,7 @@ for (const plugin of bpl) {
|
|||
try {
|
||||
import(`./plugins/${plugin}`).then((pluginItem)=>{
|
||||
for(const bot of bots){
|
||||
pluginItem.load(bot)
|
||||
pluginItem.default(bot)
|
||||
}
|
||||
plugins.push(pluginItem) // For rejoining
|
||||
})
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
export function load (b) {
|
||||
export default function load (b) {
|
||||
b._client.on('login', () => {
|
||||
b.interval.chatQueue = setInterval(() => {
|
||||
if (b.chatqueue.length !== 0) {
|
||||
|
|
|
@ -7,7 +7,7 @@ const cs = {
|
|||
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.ccq = []
|
||||
b.blocknoX = 0
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
export function load (b) {
|
||||
export default function load (b) {
|
||||
console.log(`Test plugin loaded on bot ${b.id}`)
|
||||
}
|
|
@ -1,7 +1,7 @@
|
|||
import { parse2 as parse } from '../util/chatparse_plain.js'
|
||||
import { parse as parseNBT } from '../util/parseNBT.js'
|
||||
|
||||
export function load (b) {
|
||||
export default function load (b) {
|
||||
b.players = {}
|
||||
b._client.on('player_info', (data) => {
|
||||
const buffer2 = {}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import { createBot } from "../index.js"
|
||||
export function load (b) {
|
||||
export default function load (b) {
|
||||
b._client.on('end', () => {
|
||||
b.info(`Bot ${b.id} disconnected`)
|
||||
for (const i in b.interval) {
|
||||
|
|
|
@ -14,7 +14,7 @@ class SCTask {
|
|||
}
|
||||
|
||||
|
||||
export function load (b) {
|
||||
export default function load (b) {
|
||||
b.sc_tasks = {}
|
||||
b.selfcareRun = 0
|
||||
b.interval.sc = setInterval(() => {
|
||||
|
|
|
@ -45,7 +45,7 @@ for (const plugin of bpl) {
|
|||
}
|
||||
|
||||
|
||||
export function load (b) {
|
||||
export default function load (b) {
|
||||
b.messageCount = 0
|
||||
b.chatDisabledUntil = 0
|
||||
b.interval.antiSpam = setInterval(() => {
|
||||
|
|
|
@ -119,7 +119,7 @@ const parse = function (_data, l = 0, resetColor = consoleColors.reset) {
|
|||
out += resetColor
|
||||
return out
|
||||
}
|
||||
export function parse2 (_data, l, resetColor) {
|
||||
export default function parse2 (_data, l, resetColor) {
|
||||
try {
|
||||
return parse(_data)
|
||||
} catch (e) {
|
||||
|
|
|
@ -85,7 +85,7 @@ const parse = function (_data, l = 0, resetColor = consoleColors.reset) {
|
|||
out += resetColor
|
||||
return out
|
||||
}
|
||||
export function parse2 (_data, l, resetColor) {
|
||||
export default function parse2 (_data, l, resetColor) {
|
||||
try {
|
||||
return parse(_data)
|
||||
} catch (e) {
|
||||
|
|
|
@ -87,7 +87,7 @@ const parse = function (_data, l = 0, resetColor = consoleColors.reset) {
|
|||
out += resetColor
|
||||
return out
|
||||
}
|
||||
export function parse2 (_data, l, resetColor) {
|
||||
export default function parse2 (_data, l, resetColor) {
|
||||
try {
|
||||
return parse(_data)
|
||||
} catch (e) {
|
||||
|
|
|
@ -46,7 +46,7 @@ const parse = function (_data, l = 0) {
|
|||
}
|
||||
return out
|
||||
}
|
||||
export function parse2 (_data, l) {
|
||||
export default function parse2 (_data, l) {
|
||||
try {
|
||||
return parse(_data)
|
||||
} catch (e) {
|
||||
|
|
|
@ -4,4 +4,4 @@ const lang = Object.create(null) // Without constructor function
|
|||
for (const i in _lang) {
|
||||
lang[i] = _lang[i]
|
||||
}
|
||||
export { lang }
|
||||
export default lang
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import { processNbtMessage } from 'prismarine-chat'
|
||||
export function parse (data) {
|
||||
export default function parse (data) {
|
||||
if (typeof data.type === 'string') {
|
||||
return JSON.parse(processNbtMessage(data))
|
||||
} else if (typeof data === 'string') {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
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)}`
|
||||
}
|
|
@ -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 numUUID = [+splitUUID[0] << 0, +splitUUID[1] << 0, +splitUUID[2] << 0, +splitUUID[3] << 0]
|
||||
return numUUID
|
||||
|
|
Loading…
Reference in a new issue