v6.1.3, build: 1210, 12/06/24
refratured the core. fixed reconnect spam. added coresettings so that the core can be configured via command. added team selfcare.
This commit is contained in:
parent
ad4f35bb4c
commit
572e09989c
23 changed files with 425 additions and 166 deletions
8
package-lock.json
generated
8
package-lock.json
generated
|
@ -3,10 +3,10 @@
|
||||||
"lockfileVersion": 3,
|
"lockfileVersion": 3,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"buildstring": {
|
"buildstring": {
|
||||||
"version": "v6.1.2",
|
"version": "v6.1.3",
|
||||||
"build": "1200",
|
"build": "1210",
|
||||||
"releaseDate": "11/22/24",
|
"releaseDate": "1/06/24",
|
||||||
"codename": "§eHazardous §4Massacre",
|
"codename": "",
|
||||||
"url": "https://code.chipmunk.land/Parker2991/FridayNightFunkinBoyfriendBot"
|
"url": "https://code.chipmunk.land/Parker2991/FridayNightFunkinBoyfriendBot"
|
||||||
},
|
},
|
||||||
"packages": {
|
"packages": {
|
||||||
|
|
29
src/bot.js
29
src/bot.js
|
@ -2,9 +2,9 @@ const mc = require('minecraft-protocol');
|
||||||
const { EventEmitter } = require('events');
|
const { EventEmitter } = require('events');
|
||||||
EventEmitter.defaultMaxListeners = 5e6;
|
EventEmitter.defaultMaxListeners = 5e6;
|
||||||
const util = require('util');
|
const util = require('util');
|
||||||
const createRegistry = require('prismarine-registry');
|
|
||||||
const ChatMessage = require('prismarine-chat');
|
const ChatMessage = require('prismarine-chat');
|
||||||
function createBot(options = {}, config) {
|
function createBot(options = {}, config) {
|
||||||
|
let endCount = 0;
|
||||||
const bot = new EventEmitter();
|
const bot = new EventEmitter();
|
||||||
bot.options = {
|
bot.options = {
|
||||||
// Set some default values in options
|
// Set some default values in options
|
||||||
|
@ -17,15 +17,15 @@ function createBot(options = {}, config) {
|
||||||
bot.on('init_client', client => {
|
bot.on('init_client', client => {
|
||||||
client.on('packet', (data, meta) => {
|
client.on('packet', (data, meta) => {
|
||||||
bot.emit('packet', data, meta)
|
bot.emit('packet', data, meta)
|
||||||
bot.emit('packet.' + meta.name, data)
|
bot.emit('packet.' + meta.name, data);
|
||||||
})
|
})
|
||||||
|
|
||||||
client.on('login', () => {
|
client.on('login', (data) => {
|
||||||
bot.uuid = client.uuid
|
bot.uuid = client.uuid
|
||||||
bot.username = client.username
|
bot.username = client.username
|
||||||
bot.registry = createRegistry(client.version)
|
bot.registry = require('prismarine-registry')(client.version);
|
||||||
bot.registry.language = require('./data/language.json');
|
bot.registry.language = require('./data/language.json');
|
||||||
bot.emit('registry_ready', bot.registry)
|
bot.emit('registry_ready', bot.registry);
|
||||||
})
|
})
|
||||||
|
|
||||||
client.on('disconnect', data => {
|
client.on('disconnect', data => {
|
||||||
|
@ -36,14 +36,21 @@ function createBot(options = {}, config) {
|
||||||
client.on('end', reason => {
|
client.on('end', reason => {
|
||||||
bot.emit('end', reason);
|
bot.emit('end', reason);
|
||||||
if (reason === "socketClosed") return;
|
if (reason === "socketClosed") return;
|
||||||
bot.console.warn(ChatMessage(bot._client.version).fromNotch(`§8[§bClient Reconnect§8]§r ${reason}`)?.toAnsi())
|
bot.console.warn(ChatMessage(bot._client.version).fromNotch(`§8[§bClient Reconnect§8]§r ${reason}`)?.toAnsi());
|
||||||
// bot = undefined;
|
|
||||||
// config = undefined;
|
|
||||||
})
|
})
|
||||||
|
|
||||||
client.on('error', error => {
|
client.on('error', error => {
|
||||||
|
endCount++
|
||||||
|
if (endCount === 10) {
|
||||||
|
bot.console.info('stopped logging disconnect messages for now...');
|
||||||
|
bot?.discord?.channel?.send('stopped logging disconnect messages for now...');
|
||||||
|
return;
|
||||||
|
} else if (endCount > 10) {
|
||||||
|
return;
|
||||||
|
} else {
|
||||||
bot.console.warn(ChatMessage(bot._client.version).fromNotch('§8[§bClient Reconnect§8]§r ')?.toAnsi() + util.inspect(error.toString()))
|
bot.console.warn(ChatMessage(bot._client.version).fromNotch('§8[§bClient Reconnect§8]§r ')?.toAnsi() + util.inspect(error.toString()))
|
||||||
bot?.discord?.channel?.send(error.toString())
|
bot?.discord?.channel?.send(error.toString());
|
||||||
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
client.on("keep_alive", ({ keepAliveId }) => {
|
client.on("keep_alive", ({ keepAliveId }) => {
|
||||||
|
@ -56,6 +63,10 @@ function createBot(options = {}, config) {
|
||||||
bot?.discord?.channel?.send(util.inspect(data.reason))
|
bot?.discord?.channel?.send(util.inspect(data.reason))
|
||||||
})
|
})
|
||||||
|
|
||||||
|
client.on('success', (data) => {
|
||||||
|
endCount = 0;
|
||||||
|
})
|
||||||
|
|
||||||
process.on("uncaughtException", (e) => {
|
process.on("uncaughtException", (e) => {
|
||||||
// console?.warn(e.stack)
|
// console?.warn(e.stack)
|
||||||
});
|
});
|
||||||
|
|
102
src/commands/admin/coreSettings.js
Normal file
102
src/commands/admin/coreSettings.js
Normal file
|
@ -0,0 +1,102 @@
|
||||||
|
const CommandError = require('../../util/command_error');
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
data: {
|
||||||
|
name: 'coresettings',
|
||||||
|
trustLevel: 2,
|
||||||
|
aliases: [
|
||||||
|
"cbsettings"
|
||||||
|
],
|
||||||
|
description: 'change the bots core settings',
|
||||||
|
usages: [
|
||||||
|
"useplacedcommandblock <on/off/true/false/enable/disable>",
|
||||||
|
"area start <positions>",
|
||||||
|
"area end <positions>",
|
||||||
|
"refillmethod/rcmethod <item/chat>"
|
||||||
|
],
|
||||||
|
},
|
||||||
|
execute (context) {
|
||||||
|
const bot = context.bot
|
||||||
|
const args = context.arguments;
|
||||||
|
const config = context.config;
|
||||||
|
if (!args && !args[0] && !args[1] && !args[2] && !args[3] && !args[4] && !args[5]) return;
|
||||||
|
switch (args[1]?.toLowerCase()) {
|
||||||
|
case "useplacedcommandblock":
|
||||||
|
switch (args[2]?.toLowerCase()) {
|
||||||
|
case "on":
|
||||||
|
case "true":
|
||||||
|
case "enable":
|
||||||
|
bot.core.usePlacedCommandBlock = true;
|
||||||
|
bot.chat.message('now using the placed command block');
|
||||||
|
break;
|
||||||
|
case "off":
|
||||||
|
case "false":
|
||||||
|
case "disable":
|
||||||
|
bot.core.usePlacedCommandBlock = false;
|
||||||
|
bot.chat.message('no longer using the placed command block');
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
if (bot.core.usePlacedCommandBlock) {
|
||||||
|
bot.chat.message("the bot is currently using the placed command block to run its commands");
|
||||||
|
} else {
|
||||||
|
bot.chat.message("the bot is currently using its command block core to run its commands");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case "area":
|
||||||
|
switch (args[2]?.toLowerCase()) {
|
||||||
|
case "start":
|
||||||
|
if (isNaN(args[3]) || isNaN(args[4]) || isNaN(args[5])) {
|
||||||
|
bot.core.area.start = config.core.area.start;
|
||||||
|
bot.chat.message("arguments were NaN, defaulting to config core start coords");
|
||||||
|
} else {
|
||||||
|
bot.core.area.start = {
|
||||||
|
x: Number(args[3]),
|
||||||
|
y: Number(args[4]),
|
||||||
|
z: Number(args[5])
|
||||||
|
};
|
||||||
|
bot.chat.message(`setting core start pos to x: ${args[3]}, y: ${args[4]}, z: ${args[5]}`);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case "end":
|
||||||
|
if (isNaN(args[3]) || isNaN(args[4]) || isNaN(args[5])) {
|
||||||
|
bot.core.area.end = config.core.area.end;
|
||||||
|
bot.chat.message("arguments were NaN, defaulting to config core end coords");
|
||||||
|
} else {
|
||||||
|
bot.core.area.end = {
|
||||||
|
x: Number(args[3]),
|
||||||
|
y: Number(args[4]),
|
||||||
|
z: Number(args[5])
|
||||||
|
};
|
||||||
|
|
||||||
|
bot.chat.message(`setting core end pos to x: ${args[3]}, y: ${args[4]}, z: ${args[5]}`);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
bot.chat.message(`core start pos: x: ${bot.core.area.start.x}, y: ${bot.core.area.start.y}, z: ${bot.core.area.start.z}, and end pos: x: ${bot.core.area.end.x}, y: ${bot.core.area.end.y}, z: ${bot.core.area.end.z} `)
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case "refillmethod":
|
||||||
|
case "rcmethod":
|
||||||
|
switch (args[2]?.toLowerCase()) {
|
||||||
|
case "item":
|
||||||
|
config.core.itemRefill = true;
|
||||||
|
bot.chat.message('now refilling via item');
|
||||||
|
break;
|
||||||
|
case "chat":
|
||||||
|
config.core.itemRefill = false;
|
||||||
|
bot.chat.message('now refilling via chat');
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
if (config.core.itemRefill) {
|
||||||
|
bot.chat.message("currently filling core via item");
|
||||||
|
} else {
|
||||||
|
bot.chat.message("currently filling core via chat");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
throw new CommandError('invalid argument');
|
||||||
|
}
|
||||||
|
},
|
||||||
|
}
|
|
@ -6,6 +6,7 @@ module.exports = {
|
||||||
name: 'servereval',
|
name: 'servereval',
|
||||||
trustLevel: 3,
|
trustLevel: 3,
|
||||||
aliases: [
|
aliases: [
|
||||||
|
"se"
|
||||||
],
|
],
|
||||||
description: 'run code unisolated',
|
description: 'run code unisolated',
|
||||||
usages: [
|
usages: [
|
||||||
|
@ -25,7 +26,7 @@ module.exports = {
|
||||||
} else if (bot.options.useChat || bot.options.isSavage) {
|
} else if (bot.options.useChat || bot.options.isSavage) {
|
||||||
bot.chat.message(bot.getMessageAsPrismarine({ text: util.inspect(eval(script), { stylize }).substring(0, 32700) })?.toMotd().replaceAll('§','&'))
|
bot.chat.message(bot.getMessageAsPrismarine({ text: util.inspect(eval(script), { stylize }).substring(0, 32700) })?.toMotd().replaceAll('§','&'))
|
||||||
} else {
|
} else {
|
||||||
bot.tellraw(`@a`, [
|
bot.tellraw(`@a[name="${source.player.profile.name}"]`, [
|
||||||
{
|
{
|
||||||
text: util.inspect(eval(script), { stylize }).substring(0, 32700),
|
text: util.inspect(eval(script), { stylize }).substring(0, 32700),
|
||||||
hoverEvent: {
|
hoverEvent: {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
const CommandError = require('../../util/command_error')
|
const CommandError = require('../../util/command_error')
|
||||||
const sleep = require('../../util/sleep');
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
data: {
|
data: {
|
||||||
name: 'core',
|
name: 'core',
|
||||||
|
@ -17,12 +17,7 @@ module.exports = {
|
||||||
execute (context) {
|
execute (context) {
|
||||||
const bot = context.bot
|
const bot = context.bot
|
||||||
const message = context.arguments.join(' ');
|
const message = context.arguments.join(' ');
|
||||||
bot.core.runTracked(message);
|
bot.core.run(message);
|
||||||
/* bot.on('commandBlockOutput', (packet) => {
|
|
||||||
bot.tellraw("@a", require('util').inspect(packet));
|
|
||||||
console.log(packet);
|
|
||||||
})*/
|
|
||||||
// bot.core.commandBlockOutput()
|
|
||||||
},
|
},
|
||||||
discordExecute (context) {
|
discordExecute (context) {
|
||||||
const bot = context.bot;
|
const bot = context.bot;
|
||||||
|
|
|
@ -348,12 +348,40 @@ module.exports = {
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
bot.chat.message(bot.getMessageAsPrismarine(trusted)?.toMotd().replaceAll("§","&"));
|
bot.chat.message(bot.getMessageAsPrismarine(trusted)?.toMotd().replaceAll("§","&"));
|
||||||
}, 400)
|
}, 400)
|
||||||
setTimeout(() => {
|
setTimexout(() => {
|
||||||
bot.chat.message(bot.getMessageAsPrismarine(admin)?.toMotd()?.replaceAll('§','&'))
|
bot.chat.message(bot.getMessageAsPrismarine(admin)?.toMotd()?.replaceAll('§','&'))
|
||||||
}, 400)
|
}, 400)
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
bot.chat.message(bot.getMessageAsPrismarine(owner).toMotd().replaceAll("§","&"));
|
bot.chat.message(bot.getMessageAsPrismarine(owner).toMotd().replaceAll("§","&"));
|
||||||
}, 400)
|
}, 400)
|
||||||
|
} else if (bot.options.isCreayun) {
|
||||||
|
bot.chat.message(bot.getMessageAsPrismarine([
|
||||||
|
{
|
||||||
|
text: 'Commands (',
|
||||||
|
color: 'gray'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
text: length,
|
||||||
|
color: 'gold'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
text: ') ',
|
||||||
|
color: 'gray'
|
||||||
|
},
|
||||||
|
category,
|
||||||
|
])?.toMotd().replaceAll('§','&'))
|
||||||
|
setTimeout(() => {
|
||||||
|
bot.chat.message(bot.getMessageAsPrismarine(public)?.toMotd().replaceAll("§","&"))
|
||||||
|
}, 2500)
|
||||||
|
setTimeout(() => {
|
||||||
|
bot.chat.message(bot.getMessageAsPrismarine(trusted)?.toMotd().replaceAll("§","&"));
|
||||||
|
}, 2500)
|
||||||
|
setTimeout(() => {
|
||||||
|
bot.chat.message(bot.getMessageAsPrismarine(admin)?.toMotd()?.replaceAll('§','&'))
|
||||||
|
}, 2500)
|
||||||
|
setTimeout(() => {
|
||||||
|
bot.chat.message(bot.getMessageAsPrismarine(owner).toMotd().replaceAll("§","&"));
|
||||||
|
}, 2500)
|
||||||
} else if (admin.length === 0) {
|
} else if (admin.length === 0) {
|
||||||
bot.tellraw(`@a[name="${source?.player?.profile?.name}"]`, [
|
bot.tellraw(`@a[name="${source?.player?.profile?.name}"]`, [
|
||||||
{ text: 'Commands (', color: 'gray' },
|
{ text: 'Commands (', color: 'gray' },
|
||||||
|
|
|
@ -12,13 +12,16 @@ module.exports = {
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
execute (context) {
|
execute (context) {
|
||||||
const bot = context.bot
|
const bot = context.bot;
|
||||||
bot.core.refill()
|
const config = context.config;
|
||||||
|
bot.core.move();
|
||||||
bot.tellraw("@a", "Refilling core,...")
|
bot.tellraw("@a", "Refilling core,...")
|
||||||
},
|
},
|
||||||
|
|
||||||
discordExecute (context) {
|
discordExecute (context) {
|
||||||
const bot = context.bot;
|
const bot = context.bot;
|
||||||
bot.core.refill();
|
const config = context.config;
|
||||||
|
bot.core.move();
|
||||||
bot.tellraw("@a", "Refilling core,...");
|
bot.tellraw("@a", "Refilling core,...");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,7 +8,7 @@ module.exports = {
|
||||||
],
|
],
|
||||||
description: 'check the weather of cities',
|
description: 'check the weather of cities',
|
||||||
usages: [
|
usages: [
|
||||||
"<message>"
|
"<city/zipcode>"
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
async execute (context) {
|
async execute (context) {
|
||||||
|
@ -18,7 +18,7 @@ module.exports = {
|
||||||
const source = context.source;
|
const source = context.source;
|
||||||
try {
|
try {
|
||||||
let component = [];
|
let component = [];
|
||||||
const weather = await request(`https://api.weatherapi.com/v1/current.json?key=${config.weatherApiKey}&q=${args.join(' ')}`);
|
const weather = await request(`https://api.weatherapi.com/v1/current.json?key=${config.weatherApiKey}&q=${args.join(' ')?.replaceAll(' ', ',')}`);
|
||||||
const info = await weather.body.json();
|
const info = await weather.body.json();
|
||||||
component.push({
|
component.push({
|
||||||
translate: "%s: %s\n%s: %s\n%s: %s\n%s: %s\n%s: %s\n%s: %s%s (%s%s)\n%s: %s %s %s (%s %s %s)\n%s: %s\n%s: %s",
|
translate: "%s: %s\n%s: %s\n%s: %s\n%s: %s\n%s: %s\n%s: %s%s (%s%s)\n%s: %s %s %s (%s %s %s)\n%s: %s\n%s: %s",
|
||||||
|
|
|
@ -33,7 +33,7 @@ module.exports = {
|
||||||
if (roles?.some(role => role.name === `${config.discord.roles.trusted}`)) {
|
if (roles?.some(role => role.name === `${config.discord.roles.trusted}`)) {
|
||||||
bot.discord.message.reply('Valid trusted user')
|
bot.discord.message.reply('Valid trusted user')
|
||||||
bot.chat.message(`Valid trusted user [${bot.discord.message.member.user.username}]`)
|
bot.chat.message(`Valid trusted user [${bot.discord.message.member.user.username}]`)
|
||||||
} else if (roles?.some(role => role.name === `${config.discord.roles.owner}`)) {
|
} else if (roles?.some(role => role.name === `${config.discord.roles.owner}` || role.name === `${config.discord.roles.fullAccess}`)) {
|
||||||
bot.discord.message.reply('Valid Owner user')
|
bot.discord.message.reply('Valid Owner user')
|
||||||
bot.chat.message(`Valid Owner User [${bot.discord.message.member.user.username}]`);
|
bot.chat.message(`Valid Owner User [${bot.discord.message.member.user.username}]`);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,21 +1,22 @@
|
||||||
prefixes:
|
prefixes:
|
||||||
- "!"
|
- "!"
|
||||||
|
|
||||||
discord:
|
discord:
|
||||||
token: "discord token here"
|
token: "discord token here"
|
||||||
prefix: "!"
|
prefix: "!"
|
||||||
invite: "discord invite here"
|
invite: "discord invite here"
|
||||||
enabled: true
|
enabled: false
|
||||||
roles:
|
roles:
|
||||||
trusted: "trusted"
|
trusted: "trusted"
|
||||||
admin: "admin"
|
admin: "admin"
|
||||||
|
fullAccess: "full access"
|
||||||
owner: "FNFBoyfriendBot Owner"
|
owner: "FNFBoyfriendBot Owner"
|
||||||
|
|
||||||
core:
|
core:
|
||||||
# core refill methods:
|
name: { text: "FNFBoyfriendBot Core", color: "#00FFFF" }
|
||||||
# chat: refill core in chat
|
itemName: { text: "FNFBoyfriendBot core item", color: "#00FFFF" }
|
||||||
# item refill core in a command block placed by the bot
|
itemRefill: true
|
||||||
name: {"translate":"outOfMemory.message"}
|
# refilling core via item is buggy rn i recommend setting itemRefill to false for now
|
||||||
method: 'item'
|
|
||||||
area:
|
area:
|
||||||
start:
|
start:
|
||||||
x: 0
|
x: 0
|
||||||
|
@ -26,7 +27,36 @@ core:
|
||||||
y: 0
|
y: 0
|
||||||
z: 15
|
z: 15
|
||||||
|
|
||||||
|
team:
|
||||||
|
name: "FNFBoyfriendBot"
|
||||||
|
suffix: {
|
||||||
|
color: "dark_gray",
|
||||||
|
translate: " [ %s ]",
|
||||||
|
with: [
|
||||||
|
{ color: "dark_red", text: "https://sus.red" }
|
||||||
|
]
|
||||||
|
}
|
||||||
|
# make sure if nothing is set as the suffix it is set as { text: "" } as the packet reads "" as { text: "" }
|
||||||
|
prefix: {
|
||||||
|
color: "dark_gray",
|
||||||
|
translate: "[%s: %s] ",
|
||||||
|
with: [
|
||||||
|
{ color: "aqua", text: "Prefix" },
|
||||||
|
{ color: "dark_aqua", text: "!" }
|
||||||
|
]
|
||||||
|
}
|
||||||
|
displayName: {
|
||||||
|
translate: "%s%s%s",
|
||||||
|
with: [
|
||||||
|
{ color: "dark_blue", text: "FNF" },
|
||||||
|
{ color: "dark_aqua", text: "Boyfriend" },
|
||||||
|
{ color: "blue", text: "Bot" }
|
||||||
|
]
|
||||||
|
}
|
||||||
|
# color HAS to come first before any components or it will break! dont ask why, its because of how nmp parses it
|
||||||
|
|
||||||
commandSetMessage: false
|
commandSetMessage: false
|
||||||
|
# ^^ this is for when commands are ran in core
|
||||||
|
|
||||||
keys:
|
keys:
|
||||||
trusted: "trusted key here"
|
trusted: "trusted key here"
|
||||||
|
@ -47,7 +77,6 @@ colors:
|
||||||
|
|
||||||
console:
|
console:
|
||||||
prefix: "c."
|
prefix: "c."
|
||||||
filelogger: false
|
|
||||||
|
|
||||||
bots:
|
bots:
|
||||||
- host: "localhost"
|
- host: "localhost"
|
||||||
|
|
12
src/index.js
12
src/index.js
|
@ -9,23 +9,25 @@ const { Client, GatewayIntentBits } = require('discord.js');
|
||||||
const { MessageContent, GuildMessages, Guilds } = GatewayIntentBits;
|
const { MessageContent, GuildMessages, Guilds } = GatewayIntentBits;
|
||||||
const discordClient = new Client({ intents: [Guilds, GuildMessages, MessageContent] });
|
const discordClient = new Client({ intents: [Guilds, GuildMessages, MessageContent] });
|
||||||
console.log('Starting FNFBoyfriendBot');
|
console.log('Starting FNFBoyfriendBot');
|
||||||
process.stdout.write('\x1b]2;Starting FNFBoyfriendBot please wait,.....\x1b\x5c')
|
process.stdout.write('\x1b]2;Starting FNFBoyfriendBot please wait,.....\x1b\x5c');
|
||||||
checks();
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
config = js_yaml.load(fs.readFileSync(path.join(__dirname, '../', 'config.yml')))
|
config = js_yaml.load(fs.readFileSync(path.join(__dirname, '../', 'config.yml')))
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.log(e.stack);
|
console.log(e.stack);
|
||||||
}
|
}
|
||||||
if (config.core.method !== 'item' && config.core.method !== 'chat') {
|
|
||||||
|
checks(config);
|
||||||
|
|
||||||
|
/*if (config.core.method !== 'item' && config.core.method !== 'chat') {
|
||||||
config.core.method = 'item';
|
config.core.method = 'item';
|
||||||
console.warn('invalid core method type defaulting to item');
|
console.warn('invalid core method type defaulting to item');
|
||||||
}
|
}*/
|
||||||
const rl = readline.createInterface({
|
const rl = readline.createInterface({
|
||||||
input: process.stdin,
|
input: process.stdin,
|
||||||
output: process.stdout,
|
output: process.stdout,
|
||||||
})
|
})
|
||||||
//console.log(completion);
|
|
||||||
if (config.discord.enabled) discordClient.login(config.discord.token);
|
if (config.discord.enabled) discordClient.login(config.discord.token);
|
||||||
const bots = [];
|
const bots = [];
|
||||||
for (const options of config.bots) {
|
for (const options of config.bots) {
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
const mcData = require('minecraft-data')('1.20.2');
|
const mcData = require('minecraft-data')('1.20.2');
|
||||||
|
const nbt = require('prismarine-nbt');
|
||||||
|
|
||||||
function core (context) {
|
function core (context) {
|
||||||
const bot = context.bot;
|
const bot = context.bot;
|
||||||
|
@ -12,9 +13,13 @@ function core (context) {
|
||||||
|
|
||||||
position: null,
|
position: null,
|
||||||
|
|
||||||
|
itemPosition: null,
|
||||||
|
|
||||||
currentBlockRelative: { x: 0, y: 0, z: 0 },
|
currentBlockRelative: { x: 0, y: 0, z: 0 },
|
||||||
|
|
||||||
refill () {
|
usePlacedCommandBlock: false,
|
||||||
|
|
||||||
|
chatRefill () {
|
||||||
const pos = bot.core.position
|
const pos = bot.core.position
|
||||||
const { start, end } = bot.core.area
|
const { start, end } = bot.core.area
|
||||||
|
|
||||||
|
@ -30,36 +35,50 @@ function core (context) {
|
||||||
instead of tping to a set cords cuz fuck you im not doing that
|
instead of tping to a set cords cuz fuck you im not doing that
|
||||||
*/
|
*/
|
||||||
const command = `minecraft:fill ${pos.x + start.x} ${pos.y + start.y} ${pos.z + start.z} ${pos.x + end.x} ${pos.y + end.y} ${pos.z + end.z} repeating_command_block{CustomName:'${JSON.stringify(config.core.name)}'} destroy`
|
const command = `minecraft:fill ${pos.x + start.x} ${pos.y + start.y} ${pos.z + start.z} ${pos.x + end.x} ${pos.y + end.y} ${pos.z + end.z} repeating_command_block{CustomName:'${JSON.stringify(config.core.name)}'} destroy`
|
||||||
if (config.core.method === 'chat') {
|
|
||||||
bot.chat.command(`${command}`)
|
bot.chat.command(`${command}`)
|
||||||
} else if (config.core.method === 'item') {
|
},
|
||||||
|
|
||||||
|
itemRefill () {
|
||||||
|
const pos = bot.core.position;
|
||||||
|
const { start, end } = bot.core.area;
|
||||||
|
const itemPosition = bot.core.itemPosition;
|
||||||
|
|
||||||
|
if (!pos) return;
|
||||||
|
if (bot.options.useChat || bot.options.isCreayun || bot.options.isSavage) return;
|
||||||
|
if (isNaN(pos.x + pos.x)) {
|
||||||
|
bot.chat.command('spawn');
|
||||||
|
return
|
||||||
|
}
|
||||||
|
/*^^^
|
||||||
|
for checking is the core pos is null and if so
|
||||||
|
it will not refill core until the pos is not NaN
|
||||||
|
instead of tping to a set cords cuz fuck you im not doing that
|
||||||
|
*/
|
||||||
|
const command = `minecraft:fill ${pos.x + start.x} ${pos.y + start.y} ${pos.z + start.z} ${pos.x + end.x} ${pos.y + end.y} ${pos.z + end.z} repeating_command_block{CustomName:'${JSON.stringify(config.core.name)}'} destroy`
|
||||||
|
|
||||||
bot._client.write('set_creative_slot', {
|
bot._client.write('set_creative_slot', {
|
||||||
slot: 36,
|
slot: 36,
|
||||||
item: {
|
item: {
|
||||||
present: true,
|
present: true,
|
||||||
itemId: mcData.itemsByName.command_block.id,
|
itemId: mcData.itemsByName.repeating_command_block.id,
|
||||||
itemCount: 1,
|
itemCount: 1,
|
||||||
nbtData: { }
|
nbtData: nbt.comp({
|
||||||
|
BlockEntityTag: nbt.comp({
|
||||||
|
CustomName: nbt.string(JSON.stringify(config.core.itemName))
|
||||||
|
})
|
||||||
|
})
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
bot._client.write('block_dig', {
|
bot._client.write('block_dig', {
|
||||||
status: 0,
|
status: 0,
|
||||||
location: {
|
location: itemPosition,
|
||||||
x: bot.position.x,
|
|
||||||
y: bot.position.y,
|
|
||||||
z: bot.position.z
|
|
||||||
},
|
|
||||||
face: 0
|
face: 0
|
||||||
});
|
});
|
||||||
|
|
||||||
bot._client.write('block_place', {
|
bot._client.write('block_place', {
|
||||||
hand: 0,
|
hand: 0,
|
||||||
location: {
|
location: itemPosition,
|
||||||
x: bot.position.x,
|
|
||||||
y: bot.position.y,
|
|
||||||
z: bot.position.z
|
|
||||||
},
|
|
||||||
direction: 0,
|
direction: 0,
|
||||||
cursorX: 0.1,
|
cursorX: 0.1,
|
||||||
cursorY: 0,
|
cursorY: 0,
|
||||||
|
@ -67,8 +86,11 @@ function core (context) {
|
||||||
insideBlock: false
|
insideBlock: false
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (bot.core.usePlacedCommandBlock) {
|
||||||
|
return
|
||||||
|
} else {
|
||||||
bot._client.write('update_command_block', {
|
bot._client.write('update_command_block', {
|
||||||
location: bot.position,
|
location: itemPosition,
|
||||||
command,
|
command,
|
||||||
flags: 5,
|
flags: 5,
|
||||||
mode: 1
|
mode: 1
|
||||||
|
@ -81,8 +103,19 @@ function core (context) {
|
||||||
x: Math.floor(pos.x / 16) * 16,
|
x: Math.floor(pos.x / 16) * 16,
|
||||||
y: 0,
|
y: 0,
|
||||||
z: Math.floor(pos.z / 16) * 16
|
z: Math.floor(pos.z / 16) * 16
|
||||||
|
};
|
||||||
|
|
||||||
|
bot.core.itemPosition = {
|
||||||
|
x: pos.x,
|
||||||
|
y: pos.y -1,
|
||||||
|
z: pos.z
|
||||||
|
}
|
||||||
|
|
||||||
|
if (config.core.itemRefill === true) {
|
||||||
|
bot.core.itemRefill();
|
||||||
|
} else {
|
||||||
|
bot.core.chatRefill();
|
||||||
}
|
}
|
||||||
bot.core.refill()
|
|
||||||
},
|
},
|
||||||
|
|
||||||
currentBlock () {
|
currentBlock () {
|
||||||
|
@ -116,54 +149,34 @@ function core (context) {
|
||||||
},
|
},
|
||||||
|
|
||||||
run (command) {
|
run (command) {
|
||||||
const eee = Math.floor(Math.random() * 10000)
|
const location = bot.core.currentBlock();
|
||||||
const location = bot.core.currentBlock()
|
const itemPosition = bot.core.itemPosition;
|
||||||
if (!location) return
|
|
||||||
|
if (!location) return;
|
||||||
if (bot.options.isSavage || bot.options.isCreayun || bot.options.useChat) {
|
if (bot.options.isSavage || bot.options.isCreayun || bot.options.useChat) {
|
||||||
return
|
return
|
||||||
} else {
|
} else {
|
||||||
bot._client.write('update_command_block', { command: command.substring(0, 32767), location, mode: 1, flags: 0b100 });
|
if (bot.core.usePlacedCommandBlock) {
|
||||||
bot._client.write('query_block_nbt', ({ location: location, transactionId: eee}));
|
bot._client.write('update_command_block', {
|
||||||
|
command: command.substring(0, 32767),
|
||||||
|
location: itemPosition,
|
||||||
|
mode: 1,
|
||||||
|
flags: 5,
|
||||||
|
});
|
||||||
|
|
||||||
bot.core.incrementCurrentBlock();
|
bot.core.incrementCurrentBlock();
|
||||||
}
|
} else {
|
||||||
},
|
|
||||||
|
|
||||||
runTracked (command) {
|
|
||||||
const transactionId = Math.floor(Math.random() * 1000);
|
|
||||||
const location = bot.core.currentBlock();
|
|
||||||
if (!location) return;
|
|
||||||
|
|
||||||
if (bot.position.y !== bot.core.position.y) {
|
|
||||||
bot.chat.command(`minecraft:tp ${bot.core.position.x} ${bot.core.position.y} ${bot.core.position.z}`)
|
|
||||||
}
|
|
||||||
|
|
||||||
bot._client.write('update_command_block', {
|
bot._client.write('update_command_block', {
|
||||||
command: command.substring(0, 32767),
|
command: command.substring(0, 32767),
|
||||||
location,
|
location,
|
||||||
flags: 5,
|
|
||||||
mode: 1,
|
mode: 1,
|
||||||
// LastOutput: true,
|
flags: 5
|
||||||
});
|
});
|
||||||
|
|
||||||
bot.core.incrementCurrentBlock();
|
bot.core.incrementCurrentBlock();
|
||||||
|
|
||||||
bot._client.write('query_block_nbt', {
|
|
||||||
location,
|
|
||||||
transactionId
|
|
||||||
});
|
|
||||||
|
|
||||||
bot.on('packet.nbt_query_response', (data) => {
|
|
||||||
// transactionId,
|
|
||||||
try {
|
|
||||||
if (data.transactionId === transactionId) {
|
|
||||||
bot.tellraw("@a", require('util').inspect(data.value))
|
|
||||||
bot.tellraw("@a", JSON.stringify(data.value))
|
|
||||||
}
|
}
|
||||||
} catch (e) {
|
|
||||||
bot.tellraw("@a", require("util").inspect(e.stack));
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
if (bot.options.isSavage || bot.options.isCreayun) return
|
if (bot.options.isSavage || bot.options.isCreayun) return
|
||||||
|
@ -174,11 +187,11 @@ function core (context) {
|
||||||
bot.on('packet.block_change', (data) => {
|
bot.on('packet.block_change', (data) => {
|
||||||
// console.log('data pos ' + JSON.stringify(data.location))
|
// console.log('data pos ' + JSON.stringify(data.location))
|
||||||
// console.log('core pos ' +JSON.stringify(bot.core.position));
|
// console.log('core pos ' +JSON.stringify(bot.core.position));
|
||||||
if (data.type === 0) {
|
// if (data.type === 0) {
|
||||||
// console.log('data pos ' + JSON.stringify(data.location));
|
// console.log('data pos ' + JSON.stringify(data.location));
|
||||||
// console.log('core position ' + JSON.stringify(bot.core.position));
|
// console.log('core position ' + JSON.stringify(bot.core.position));
|
||||||
// bot.core.refill();
|
// bot.core.refill();
|
||||||
}
|
//}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
module.exports = core;
|
module.exports = core;
|
||||||
|
|
|
@ -57,7 +57,7 @@ async function command_manager (context) {
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
if (source?.sources?.discord) {
|
if (source?.sources?.discord) {
|
||||||
const hasRole = roles?.some(role => role.name === `${config.discord.roles.trusted}` || role.name === `${config.discord.roles.admin}` || role.name === `${config.discord.roles.owner}`)
|
const hasRole = roles?.some(role => role.name === `${config.discord.roles.trusted}` || role.name === `${config.discord.roles.admin}` || role.name === `${config.discord.roles.fullAccess}` || role.name === `${config.discord.roles.owner}`)
|
||||||
if (!hasRole) throw new CommandError({ translate: 'You are not trusted or the owner!', color: "dark_red" })
|
if (!hasRole) throw new CommandError({ translate: 'You are not trusted or the owner!', color: "dark_red" })
|
||||||
} else if (!source?.sources.console) {
|
} else if (!source?.sources.console) {
|
||||||
if (args.length === 0) throw new CommandError({ text: "Please provide a trusted, admin or owner hash", color: "dark_red" });
|
if (args.length === 0) throw new CommandError({ text: "Please provide a trusted, admin or owner hash", color: "dark_red" });
|
||||||
|
@ -66,7 +66,7 @@ async function command_manager (context) {
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
if (source?.sources?.discord) {
|
if (source?.sources?.discord) {
|
||||||
const hasRole = roles?.some(role => role.name === `${config.discord.roles.admin}` || role.name === `${config.discord.roles.owner}`)
|
const hasRole = roles?.some(role => role.name === `${config.discord.roles.admin}` || role.name === `${config.discord.roles.fullAccess}` ||role.name === `${config.discord.roles.owner}`)
|
||||||
if (!hasRole) throw new CommandError({ translate: 'You are not trusted or the owner!', color: "dark_red" })
|
if (!hasRole) throw new CommandError({ translate: 'You are not trusted or the owner!', color: "dark_red" })
|
||||||
} else if (!source?.sources?.console) {
|
} else if (!source?.sources?.console) {
|
||||||
if (args.length === 0) throw new CommandError({ text: "Please provide an admin or owner hash", color: 'dark_red' })
|
if (args.length === 0) throw new CommandError({ text: "Please provide an admin or owner hash", color: 'dark_red' })
|
||||||
|
@ -75,7 +75,7 @@ async function command_manager (context) {
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
if (source?.sources?.discord) {
|
if (source?.sources?.discord) {
|
||||||
const hasRole = roles?.some(role => role.name === `${config.discord.roles.owner}`)
|
const hasRole = roles?.some(role => role.name === `${config.discord.roles.owner}` || role.name === `${config.discord.roles.fullAccess}`)
|
||||||
if (!hasRole) throw new CommandError({ translate: 'You are not the owner!', color: "dark_red" })
|
if (!hasRole) throw new CommandError({ translate: 'You are not the owner!', color: "dark_red" })
|
||||||
} else if (!source?.sources?.console) {
|
} else if (!source?.sources?.console) {
|
||||||
if (args.length === 0 && bot.validation.owner) throw new CommandError({ text: "Please provide an owner hash", color: "dark_red" })
|
if (args.length === 0 && bot.validation.owner) throw new CommandError({ text: "Please provide an owner hash", color: "dark_red" })
|
||||||
|
|
|
@ -93,7 +93,7 @@ function Console (context) {
|
||||||
bot.console.fileLogger(`[${new Date().toLocaleTimeString("en-US", { timeZone: "America/CHICAGO", })} ${new Date().toLocaleDateString("en-US", { timeZone: "America/CHICAGO", })} logs] [${options.serverName}] ${bot.getMessageAsPrismarine(message)?.toString()}`);
|
bot.console.fileLogger(`[${new Date().toLocaleTimeString("en-US", { timeZone: "America/CHICAGO", })} ${new Date().toLocaleDateString("en-US", { timeZone: "America/CHICAGO", })} logs] [${options.serverName}] ${bot.getMessageAsPrismarine(message)?.toString()}`);
|
||||||
ratelimit++
|
ratelimit++
|
||||||
})
|
})
|
||||||
// console.log(ratelimit)
|
|
||||||
bot.on('bossBar', (message) => {
|
bot.on('bossBar', (message) => {
|
||||||
if (!options.logging) return;
|
if (!options.logging) return;
|
||||||
if (ratelimit > 10) return;
|
if (ratelimit > 10) return;
|
||||||
|
|
|
@ -42,7 +42,7 @@ function discord (context) {
|
||||||
try {
|
try {
|
||||||
bot?.discord?.channel?.send(`\`\`\`ansi\n${discordQueue.join('\n').substring(0, 1984)}\n\`\`\``)
|
bot?.discord?.channel?.send(`\`\`\`ansi\n${discordQueue.join('\n').substring(0, 1984)}\n\`\`\``)
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
bot.console.warn(error.toString())
|
console.error(error.toString())
|
||||||
}
|
}
|
||||||
discordQueue = []
|
discordQueue = []
|
||||||
}, 2000)
|
}, 2000)
|
||||||
|
|
|
@ -18,19 +18,20 @@ function player_list (context) {
|
||||||
action(entry)
|
action(entry)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
bot.emit("player_info", packet);
|
||||||
})
|
})
|
||||||
|
|
||||||
bot.on('packet.player_remove', async ({players}) => { // players has uuids of the players
|
bot.on('packet.player_remove', async ({players}) => { // players has uuids of the players
|
||||||
let player_completion = (await bot.tab_complete('scoreboard players add ')).filter(_ => _.tooltip == undefined) // exclude @a, @r, @s, @e, @p -aaa
|
let player_completion = (await bot.tab_complete('scoreboard players add ')).filter(_ => _.tooltip == undefined) // exclude @a, @r, @s, @e, @p -aaa
|
||||||
bot.players.forEach(async player => {
|
bot.players.forEach(async player => {
|
||||||
if(!players.includes(player.uuid)) return
|
if (!players.includes(player.uuid)) return
|
||||||
|
|
||||||
const a = player_completion.filter(_ => _.match == player.profile.name)
|
const a = player_completion.filter(_ => _.match == player.profile.name)
|
||||||
if(a.length >= 1) {
|
if (a.length >= 1) {
|
||||||
player.vanished = true
|
player.vanished = true;
|
||||||
} else {
|
} else {
|
||||||
bot.players = bot.players.filter(_ => _.uuid != player.uuid)
|
bot.players = bot.players.filter(_ => _.uuid != player.uuid);
|
||||||
|
bot.emit("player_left", player);
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
@ -47,6 +48,11 @@ function player_list (context) {
|
||||||
displayName: undefined,
|
displayName: undefined,
|
||||||
vanished: false
|
vanished: false
|
||||||
})
|
})
|
||||||
|
if (entry.vanished) {
|
||||||
|
bot.emit("player_vanished", entry);
|
||||||
|
} else {
|
||||||
|
bot.emit("player_joined", entry);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function initializeChat (entry) {
|
function initializeChat (entry) {
|
||||||
|
|
|
@ -1,14 +1,13 @@
|
||||||
|
|
||||||
function position (context) {
|
function position (context) {
|
||||||
const bot = context.bot;
|
const bot = context.bot;
|
||||||
bot.position = null
|
bot.position = null;
|
||||||
|
|
||||||
bot.on('packet.position', packet => {
|
bot.on('packet.position', packet => {
|
||||||
bot.position = {
|
bot.position = {
|
||||||
x: packet.flags & 1 ? (this.x + packet.x) : packet.x,
|
x: packet.flags & 1 ? (this.x + packet.x) : packet.x,
|
||||||
y: packet.flags & 2 ? (this.y + packet.y) : packet.y,
|
y: packet.flags & 2 ? (this.y + packet.y) : packet.y,
|
||||||
z: packet.flags & 4 ? (this.z + packet.z) : packet.z
|
z: packet.flags & 4 ? (this.z + packet.z) : packet.z
|
||||||
}
|
};
|
||||||
|
|
||||||
bot._client.write('teleport_confirm', { teleportId: packet.teleportId })
|
bot._client.write('teleport_confirm', { teleportId: packet.teleportId })
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
const sleep = require('../util/sleep');
|
||||||
|
|
||||||
function selfcare (context) {
|
function selfcare (context) {
|
||||||
const bot = context.bot;
|
const bot = context.bot;
|
||||||
const config = context.config;
|
const config = context.config;
|
||||||
|
@ -17,8 +19,6 @@ function selfcare (context) {
|
||||||
let register = false;
|
let register = false;
|
||||||
let positionCount = 0;
|
let positionCount = 0;
|
||||||
bot.vanished = true
|
bot.vanished = true
|
||||||
// You now have the tag: &8[&bPrefix&8: &3~&8]
|
|
||||||
// You no longer have a tag
|
|
||||||
bot.on('systemChat', (message) => {
|
bot.on('systemChat', (message) => {
|
||||||
const stringMessage = bot.getMessageAsPrismarine(message)?.toString();
|
const stringMessage = bot.getMessageAsPrismarine(message)?.toString();
|
||||||
if (options.isSavage) {
|
if (options.isSavage) {
|
||||||
|
@ -32,17 +32,8 @@ function selfcare (context) {
|
||||||
|
|
||||||
else if (stringMessage === "You're already logged in!") register = false;
|
else if (stringMessage === "You're already logged in!") register = false;
|
||||||
else if (stringMessage === "Successful login!") register = false;
|
else if (stringMessage === "Successful login!") register = false;
|
||||||
/*
|
|
||||||
You're already logged in!
|
|
||||||
Please, register to the server with the command: /register <password> <ConfirmPassword>
|
|
||||||
Please, login with the command: /login <password>
|
|
||||||
Successfully registered!
|
|
||||||
Successful login!
|
|
||||||
You already have registered this username!
|
|
||||||
*/
|
|
||||||
|
|
||||||
} else if (options.isKaboom) {
|
} else if (options.isKaboom) {
|
||||||
// const stringMessage = bot.getMessageAsPrismarine(message)?.toString();
|
|
||||||
if (stringMessage === "Successfully enabled CommandSpy") commandSpy = true;
|
if (stringMessage === "Successfully enabled CommandSpy") commandSpy = true;
|
||||||
else if (stringMessage === "Successfully enabled CommandSpy.") commandSpy = true;
|
else if (stringMessage === "Successfully enabled CommandSpy.") commandSpy = true;
|
||||||
else if (stringMessage === "Successfully disabled CommandSpy") commandSpy = false;
|
else if (stringMessage === "Successfully disabled CommandSpy") commandSpy = false;
|
||||||
|
@ -96,31 +87,54 @@ You already have registered this username!
|
||||||
}
|
}
|
||||||
}, 1000)
|
}, 1000)
|
||||||
})
|
})
|
||||||
|
/*
|
||||||
bot.on("packet.teams", (data) => {
|
bot.on("packet.teams", async (data) => {
|
||||||
if (options.isSavage || options.isCreayun) return;
|
if (options.isSavage || options.isCreayun) return;
|
||||||
try {
|
try {
|
||||||
/*
|
// console.log(data);
|
||||||
if (data.team !== "FNFBoyfriendBot") {
|
// bot.chat.command('minecraft:team add FNFBoyfriendBot');
|
||||||
bot.chat.command(`minecraft:team add FNFBoyfriendBot`);
|
// if (data.team === "FNFBoyfriendBot") return;
|
||||||
|
if (data.team === "FNFBoyfriendBot" && data.mode === 1) {
|
||||||
|
bot.core.run("minecraft:team add FNFBoyfriendBot");
|
||||||
}
|
}
|
||||||
if (data.mode > 1 && !data.team === "FNFBoyfriendBot") {
|
|
||||||
bot.chat.command(`minecraft:team add FNFBoyfriendBot`);
|
for (const eachPlayer of data?.players) {
|
||||||
|
if (eachPlayer !== bot.options.username) {
|
||||||
|
bot.core.run("minecraft:team empty FNFBoyfriendBot");
|
||||||
|
await sleep(100);
|
||||||
|
bot.core.run("minecraft:team join FNFBoyfriendBot");
|
||||||
}
|
}
|
||||||
if (data.team === "FNFBoyfriendBot") {
|
|
||||||
console.log(data);
|
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.log(e.stack)
|
console.log(e.stack)
|
||||||
}
|
}
|
||||||
})
|
})*/
|
||||||
|
/*
|
||||||
|
{
|
||||||
|
team: 'FNFBoyfriendBot',
|
||||||
|
mode: 3,
|
||||||
|
name: undefined,
|
||||||
|
friendlyFire: undefined,
|
||||||
|
nameTagVisibility: undefined,
|
||||||
|
collisionRule: undefined,
|
||||||
|
formatting: undefined,
|
||||||
|
prefix: undefined,
|
||||||
|
suffix: undefined,
|
||||||
|
players: [ 'Parker2991' ]
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
let timer;
|
let timer;
|
||||||
bot.on('packet.login', (packet) => {
|
bot.on('packet.login', async (packet) => {
|
||||||
entityId = packet.entityId;
|
entityId = packet.entityId;
|
||||||
gameMode = packet.gameMode;
|
gameMode = packet.gameMode;
|
||||||
clientLock = packet.gameMode;
|
clientLock = packet.gameMode;
|
||||||
|
/* if (bot.options.isKaboom) {
|
||||||
|
bot.core.run('minecraft:team add FNFBoyfriendBot');
|
||||||
|
await sleep(100);
|
||||||
|
bot.core.run('minecraft:team join FNFBoyfriendBot');
|
||||||
|
}*/
|
||||||
timer = setInterval(() => {
|
timer = setInterval(() => {
|
||||||
if (bot.options.isSavage && !bot.options.isKaboom && !bot.options.isCreayun) {
|
if (bot.options.isSavage && !bot.options.isKaboom && !bot.options.isCreayun) {
|
||||||
if (login) bot.chat.command('login amogusissus');
|
if (login) bot.chat.command('login amogusissus');
|
||||||
|
|
52
src/modules/team.js
Normal file
52
src/modules/team.js
Normal file
|
@ -0,0 +1,52 @@
|
||||||
|
const sleep = require('../util/sleep');
|
||||||
|
|
||||||
|
module.exports = (context) => {
|
||||||
|
const bot = context.bot;
|
||||||
|
const options = context.options;
|
||||||
|
const config = context.config;
|
||||||
|
|
||||||
|
bot.on("packet.login", async () => {
|
||||||
|
if (options.isKaboom) {
|
||||||
|
await sleep(100);
|
||||||
|
bot.chat.command(`minecraft:team add ${config.team.name}`);
|
||||||
|
await sleep(100);
|
||||||
|
bot.core.run(`minecraft:team join ${config.team.name} @a[name="${bot.options.username}"]`);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
bot.on("packet.teams", async (data) => {
|
||||||
|
if (options.isSavage || options.isCreayun) return;
|
||||||
|
try {
|
||||||
|
if (data.team === config.team.name) {
|
||||||
|
// console.log(data);
|
||||||
|
data?.players?.map(async (player) => {
|
||||||
|
if (player !== bot.options.username) {
|
||||||
|
await sleep(100);
|
||||||
|
bot.core.run(`minecraft:team empty ${config.team.name}`);
|
||||||
|
await sleep(100);
|
||||||
|
bot.core.run(`minecraft:team join ${config.team.name} @a[name="${bot.options.username}"]`);
|
||||||
|
// this removes players who are not the bot
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
if (data.mode == 1) {
|
||||||
|
// this is checking if the team has been deleted
|
||||||
|
bot.core.run(`minecraft:team add ${config.team.name}`);
|
||||||
|
await sleep(100);
|
||||||
|
bot.core.run(`minecraft:team join ${config.team.name} @a[name="${bot.options.username}"]`);
|
||||||
|
} if (data.name !== JSON.stringify(config.team.displayName)) {
|
||||||
|
// this checks if the team displayName matches the one set in the config
|
||||||
|
bot.core.run(`minecraft:team modify ${config.team.name} displayName ${JSON.stringify(config.team.displayName)}`);
|
||||||
|
} if (data.prefix !== JSON.stringify(config.team.prefix)) {
|
||||||
|
// this checks if the team prefix matches the one set in the config
|
||||||
|
bot.core.run(`minecraft:team modify ${config.team.name} prefix ${JSON.stringify(config.team.prefix)}`);
|
||||||
|
} if (data.suffix !== JSON.stringify(config.team.suffix)) {
|
||||||
|
// this checks if the team suffix matches the one set in the config
|
||||||
|
bot.core.run(`minecraft:team modify ${config.team.name} suffix ${JSON.stringify(config.team.suffix)}`)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
console.log(e.stack)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
|
@ -1,6 +1,7 @@
|
||||||
const ChatMessage = require('prismarine-chat')('1.20.2');
|
const ChatMessage = require('prismarine-chat')('1.20.2');
|
||||||
const util = require('util');
|
const util = require('util');
|
||||||
function creayun (messageobj, data) {
|
function creayun (messageobj, data) {
|
||||||
|
try {
|
||||||
let match;
|
let match;
|
||||||
let sender;
|
let sender;
|
||||||
const stringify = message => new ChatMessage(message).toString()
|
const stringify = message => new ChatMessage(message).toString()
|
||||||
|
@ -21,5 +22,8 @@ function creayun (messageobj, data) {
|
||||||
// console.log(sender)
|
// console.log(sender)
|
||||||
return { sender, contents: match[3], type: 'minecraft:chat'};
|
return { sender, contents: match[3], type: 'minecraft:chat'};
|
||||||
}
|
}
|
||||||
|
} catch (e) {
|
||||||
|
console.log(e.toString())
|
||||||
|
}
|
||||||
}
|
}
|
||||||
module.exports = creayun;
|
module.exports = creayun;
|
||||||
|
|
|
@ -14,10 +14,10 @@ function VanillaChat (message, data, context) {
|
||||||
const stringUsername = data.getMessageAsPrismarine(senderComponent).toString() // TypeError: data.getMessageAsPrismarine is not a function
|
const stringUsername = data.getMessageAsPrismarine(senderComponent).toString() // TypeError: data.getMessageAsPrismarine is not a function
|
||||||
sender = data.players.find(player => player.profile.name === stringUsername)
|
sender = data.players.find(player => player.profile.name === stringUsername)
|
||||||
}
|
}
|
||||||
if (!sender) return stringUsername
|
if (!sender) return //stringUsername
|
||||||
return { sender, contents, type: 'minecraft:chat', senderComponent }
|
return { sender, contents, type: 'minecraft:chat', senderComponent }
|
||||||
} catch(e) {
|
} catch(e) {
|
||||||
console.error(`${e.toString()}`)
|
console.error(`${e.stack}`)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
module.exports = VanillaChat;
|
module.exports = VanillaChat;
|
||||||
|
|
Loading…
Reference in a new issue