diff --git a/plugins/chatqueue.js b/plugins/chatqueue.js index 88774f1..a5f3a9f 100644 --- a/plugins/chatqueue.js +++ b/plugins/chatqueue.js @@ -1,4 +1,4 @@ -const load = (b) => { +export function load (b) { b._client.on('login', () => { b.interval.chatQueue = setInterval(() => { if (b.chatqueue.length !== 0) { @@ -16,4 +16,3 @@ const load = (b) => { }) } } -export { load } \ No newline at end of file diff --git a/plugins/commandblock.js b/plugins/commandblock.js index 9aae2e9..fecc617 100755 --- a/plugins/commandblock.js +++ b/plugins/commandblock.js @@ -7,7 +7,7 @@ const cs = { z: 4 } -const load = function (b) { +export function load (b) { b.interval.commandFill = setInterval(() => { if (b.sc_tasks.cc) b.sc_tasks.cc.failed = 1 }, 150000) b.ccq = [] b.blocknoX = 0 @@ -135,6 +135,4 @@ const load = function (b) { b.ccq.push(`/${tellrawCommand} ${finalname} ${JSON.stringify(message)}`) } } -} - -export { load } \ No newline at end of file +} \ No newline at end of file diff --git a/plugins/helloworld.js b/plugins/helloworld.js index 7287595..b1c3f84 100644 --- a/plugins/helloworld.js +++ b/plugins/helloworld.js @@ -1,4 +1,3 @@ -const load = (b) => { +export function load (b) { console.log(`Test plugin loaded on bot ${b.id}`) -} -export { load } \ No newline at end of file +} \ No newline at end of file diff --git a/plugins/player.js b/plugins/player.js index ec95e24..b6e0838 100755 --- a/plugins/player.js +++ b/plugins/player.js @@ -1,7 +1,7 @@ import { parse2 as parse } from '../util/chatparse_plain.js' import { parse as parseNBT } from '../util/parseNBT.js' -const load = (b) => { +export function load (b) { b.players = {} b._client.on('player_info', (data) => { const buffer2 = {} @@ -72,5 +72,4 @@ const load = (b) => { return '[[[[ No display name ]]]]' } } -} -export { load } \ No newline at end of file +} \ No newline at end of file diff --git a/plugins/rejoin.js b/plugins/rejoin.js index 8723d2c..ddd8397 100644 --- a/plugins/rejoin.js +++ b/plugins/rejoin.js @@ -1,5 +1,5 @@ import { createBot } from "../index.js" -const load = (b) => { +export function load (b) { b._client.on('end', () => { b.info(`Bot ${b.id} disconnected`) for (const i in b.interval) { @@ -10,5 +10,4 @@ const load = (b) => { createBot(b.host, b.id) }, 5000) }) -} -export { load } \ No newline at end of file +} \ No newline at end of file diff --git a/plugins/selfcare.js b/plugins/selfcare.js index 99e5236..238fc0c 100755 --- a/plugins/selfcare.js +++ b/plugins/selfcare.js @@ -14,7 +14,7 @@ class SCTask { } -const load = (b) => { +export function load (b) { b.sc_tasks = {} b.selfcareRun = 0 b.interval.sc = setInterval(() => { @@ -130,4 +130,3 @@ const load = (b) => { }) } } -export { load } diff --git a/plugins/serverChat.js b/plugins/serverChat.js index db44ff8..4958c34 100755 --- a/plugins/serverChat.js +++ b/plugins/serverChat.js @@ -45,7 +45,7 @@ for (const plugin of bpl) { } -const load = (b) => { +export function load (b) { b.messageCount = 0 b.chatDisabledUntil = 0 b.interval.antiSpam = setInterval(() => { @@ -192,6 +192,4 @@ const load = (b) => { b.emit('plainchat', msgPlain, data.type, data.subtype) b.displayChat(data.type, data.subtype, `${msgConsole}\x1b[0m`) }) -} - -export { load } \ No newline at end of file +} \ No newline at end of file diff --git a/util/chatparse_console.js b/util/chatparse_console.js index e7fca7c..be99ace 100755 --- a/util/chatparse_console.js +++ b/util/chatparse_console.js @@ -119,7 +119,7 @@ const parse = function (_data, l = 0, resetColor = consoleColors.reset) { out += resetColor return out } -const parse2 = function (_data, l, resetColor) { +export function parse2 (_data, l, resetColor) { try { return parse(_data) } catch (e) { @@ -127,4 +127,3 @@ const parse2 = function (_data, l, resetColor) { return `\x1B[0m\x1B[38;2;255;85;85mAn error occured while parsing a message. See console for more information.\nJSON that caused the error: ${JSON.stringify(_data)}` } } -export { parse2 } diff --git a/util/chatparse_mc.js b/util/chatparse_mc.js index 2da6ca7..6dab370 100755 --- a/util/chatparse_mc.js +++ b/util/chatparse_mc.js @@ -85,7 +85,7 @@ const parse = function (_data, l = 0, resetColor = consoleColors.reset) { out += resetColor return out } -const parse2 = function (_data, l, resetColor) { +export function parse2 (_data, l, resetColor) { try { return parse(_data) } catch (e) { @@ -93,4 +93,3 @@ const parse2 = function (_data, l, resetColor) { return `\x1B[0m\x1B[38;2;255;85;85mAn error occured while parsing a message. See console for more information.\nJSON that caused the error: ${JSON.stringify(_data)}` } } -export { parse2 } diff --git a/util/chatparse_mc_withHex.js b/util/chatparse_mc_withHex.js index afc5240..d6aa74d 100755 --- a/util/chatparse_mc_withHex.js +++ b/util/chatparse_mc_withHex.js @@ -87,7 +87,7 @@ const parse = function (_data, l = 0, resetColor = consoleColors.reset) { out += resetColor return out } -const parse2 = function (_data, l, resetColor) { +export function parse2 (_data, l, resetColor) { try { return parse(_data) } catch (e) { @@ -95,4 +95,3 @@ const parse2 = function (_data, l, resetColor) { return `\x1B[0m\x1B[38;2;255;85;85mAn error occured while parsing a message. See console for more information.\nJSON that caused the error: ${JSON.stringify(_data)}` } } -export { parse2 } diff --git a/util/chatparse_plain.js b/util/chatparse_plain.js index 8c1eeb5..ce1fa5e 100755 --- a/util/chatparse_plain.js +++ b/util/chatparse_plain.js @@ -46,7 +46,7 @@ const parse = function (_data, l = 0) { } return out } -const parse2 = function (_data, l) { +export function parse2 (_data, l) { try { return parse(_data) } catch (e) { @@ -54,4 +54,3 @@ const parse2 = function (_data, l) { return `An error occured while parsing a message. See console for more information. JSON that caused the error: ${JSON.stringify(_data)}` } } -export { parse2 } \ No newline at end of file diff --git a/util/parseNBT.js b/util/parseNBT.js index 9e6762e..77fba3f 100755 --- a/util/parseNBT.js +++ b/util/parseNBT.js @@ -1,5 +1,5 @@ import { processNbtMessage } from 'prismarine-chat' -const parse = function (data) { +export function parse (data) { if (typeof data.type === 'string') { return JSON.parse(processNbtMessage(data)) } else if (typeof data === 'string') { @@ -8,4 +8,3 @@ const parse = function (data) { return data } } -export { parse } diff --git a/util/usergen.js b/util/usergen.js index cf05fd7..05c9f79 100644 --- a/util/usergen.js +++ b/util/usergen.js @@ -1,5 +1,4 @@ import { randomBytes } from "crypto"; -const generateUser = function (legal) { +export function generateUser (legal) { return `${parseInt(randomBytes(4).toString("hex"),16).toString(36)}${parseInt(randomBytes(4).toString("hex"),16).toString(36)}` -} -export { generateUser } \ No newline at end of file +} \ No newline at end of file diff --git a/util/uuidtoint.js b/util/uuidtoint.js index f3099c3..93c2f36 100644 --- a/util/uuidtoint.js +++ b/util/uuidtoint.js @@ -1,6 +1,5 @@ -const uuidToInt = function (uuid) { +export 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 -} -export { uuidToInt } \ No newline at end of file +} \ No newline at end of file