mirror of
https://code.chipmunk.land/Parker2991/NitoriBot/
synced 2026-12-03 07:35:39 -05:00
v7.0.3, build: 2120
This commit is contained in:
@@ -16,7 +16,6 @@ function inject (context) {
|
||||
bot.chat.message('Killing bot.....');
|
||||
process.exit(5);
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
|
||||
@@ -5,6 +5,7 @@ const CreayunChatParser = require('../util/ChatParsers/Creayun');
|
||||
const sayConsoleChatParser = require('../util/ChatParsers/sayConsole');
|
||||
const VanillaChatParser = require("../util/ChatParsers/VanillaChat");
|
||||
const yfdCustomChatParser = require('../util/ChatParsers/yfdCustomChat');
|
||||
|
||||
function tryParse (json) {
|
||||
try {
|
||||
return JSON.parse(json)
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
const mcData = require('minecraft-data')('1.20.2');
|
||||
const nbt = require('prismarine-nbt');
|
||||
|
||||
const sleep = require('../util/sleep');
|
||||
function inject (context) {
|
||||
const bot = context.bot;
|
||||
const config = context.config;
|
||||
@@ -24,9 +24,14 @@ function inject (context) {
|
||||
const { start, end } = bot.core.area
|
||||
|
||||
if (!pos) return
|
||||
if (bot.options.mode === "creayun" || bot.options.mode === "savageFriends") return;
|
||||
if (bot.options.mode === "creayun") return;
|
||||
|
||||
if (bot.options.mode === "savageFriends") {
|
||||
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} command_block`
|
||||
} else {
|
||||
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`
|
||||
bot.chat.command(`${command}`)
|
||||
},
|
||||
|
||||
@@ -36,7 +41,6 @@ function inject (context) {
|
||||
const itemPosition = bot.core.itemPosition;
|
||||
|
||||
if (!pos) return;
|
||||
if (bot.options.mode === "creayun" || bot.options.mode === "savageFriends") return;
|
||||
|
||||
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`
|
||||
|
||||
@@ -64,9 +68,9 @@ function inject (context) {
|
||||
hand: 0,
|
||||
location: itemPosition,
|
||||
direction: 0,
|
||||
cursorX: 0.1,
|
||||
cursorX: 0,
|
||||
cursorY: 0,
|
||||
cursorZ: 0.1,
|
||||
cursorZ: 0,
|
||||
insideBlock: false
|
||||
});
|
||||
|
||||
@@ -95,7 +99,7 @@ function inject (context) {
|
||||
z: pos.z
|
||||
}
|
||||
|
||||
if (config.core.itemRefill === true) {
|
||||
if (config.core.itemRefill) {
|
||||
bot.core.itemRefill();
|
||||
} else {
|
||||
bot.core.chatRefill();
|
||||
@@ -137,8 +141,17 @@ function inject (context) {
|
||||
const itemPosition = bot.core.itemPosition;
|
||||
|
||||
if (!location) return;
|
||||
if (bot.options.mode === "creayun" || bot.options.mode === "savageFriends") {
|
||||
return
|
||||
if (bot.options.mode === "creayun") {
|
||||
return;
|
||||
} else if (bot.options.mode === "savageFriends") {
|
||||
bot._client.write('update_command_block', {
|
||||
command: command.substring(0, 32767),
|
||||
location: location,
|
||||
mode: 2,
|
||||
flags: 0b101,
|
||||
});
|
||||
|
||||
bot.core.incrementCurrentBlock();
|
||||
} else {
|
||||
if (bot.core.usePlacedCommandBlock) {
|
||||
bot._client.write('update_command_block', {
|
||||
@@ -161,6 +174,73 @@ function inject (context) {
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
async runTracked (command) {
|
||||
const location = bot.core.itemPosition;
|
||||
let transactionId = Math.floor(Math.random() * 10000);
|
||||
|
||||
bot._client.write('set_creative_slot', {
|
||||
slot: 36,
|
||||
item: {
|
||||
present: true,
|
||||
itemId: mcData.itemsByName.repeating_command_block.id,
|
||||
itemCount: 1,
|
||||
nbtData: nbt.comp({
|
||||
BlockEntityTag: nbt.comp({
|
||||
CustomName: nbt.string(JSON.stringify(config.core.itemName))
|
||||
})
|
||||
})
|
||||
}
|
||||
});
|
||||
|
||||
bot._client.write('block_dig', {
|
||||
status: 0,
|
||||
location: {
|
||||
x: location.x,
|
||||
y: location.y - 1,
|
||||
z: location.z
|
||||
},
|
||||
face: 0
|
||||
});
|
||||
|
||||
bot._client.write('block_place', {
|
||||
hand: 0,
|
||||
location,
|
||||
direction: 0,
|
||||
cursorX: 0,
|
||||
cursorY: 0,
|
||||
cursorZ: 0,
|
||||
insideBlock: false
|
||||
});
|
||||
|
||||
bot._client.write('update_command_block', {
|
||||
command: command.substring(0, 32767),
|
||||
location: {
|
||||
x: location.x,
|
||||
y: location.y,
|
||||
z: location.z
|
||||
},
|
||||
flags: 0b101,
|
||||
mode: 1
|
||||
});
|
||||
|
||||
await sleep(100);
|
||||
|
||||
bot._client.write('query_block_nbt', { location, transactionId });
|
||||
|
||||
bot.on('packet.nbt_query_response', (data) => {
|
||||
try {
|
||||
if (data.transactionId == transactionId) {
|
||||
|
||||
if (data?.nbt?.value?.LastOutput) {
|
||||
bot.tellraw("@a", JSON.parse(data.nbt.value.LastOutput.value));
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
console.log(e.stack)
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
require('../util/core_util')(bot, config, options);
|
||||
|
||||
@@ -19,7 +19,7 @@ function inject (context) {
|
||||
ratelimit--
|
||||
}, 1000)
|
||||
if (ratelimit > 2) {
|
||||
bot.tellraw(`@a[name="${source?.player?.profile?.name}"]`, { text: 'You are using commands too fast!', color: 'dark_red'})
|
||||
bot.tellraw('@a', { text: 'You are using commands too fast!', color: 'dark_red'})
|
||||
} else if (command.split(" ")[0].length === 0) {
|
||||
} else {
|
||||
bot.commandManager.executeString(source, command)
|
||||
|
||||
@@ -5,6 +5,7 @@ const CommandSource = require('../util/command_source');
|
||||
const { EmbedBuilder } = require('discord.js');
|
||||
const fixansi = require('../util/ansi');
|
||||
const cmdMgrUtil = require('../util/command_manager_util');
|
||||
const sleep = require('../util/sleep.js');
|
||||
|
||||
async function inject (context) {
|
||||
const bot = context.bot;
|
||||
@@ -52,7 +53,7 @@ async function inject (context) {
|
||||
|
||||
if (error instanceof CommandError) {
|
||||
if (options.mode !== "kaboom") {
|
||||
bot.chat.message(`&4${error._message}`);
|
||||
bot.chat.message(`&4${bot.getMessageAsPrismarine(error._message)?.toMotd().replaceAll('§','&')}`);
|
||||
} else {
|
||||
if (error.toString().length > 256) {
|
||||
bot.tellraw("@a", error._message);
|
||||
@@ -70,7 +71,7 @@ async function inject (context) {
|
||||
const [commandName, ...args] = command.split(' ');
|
||||
if (source?.sources?.discord) {
|
||||
return this.discordExecute(source, commandName, args);
|
||||
} else {
|
||||
} else if (!source?.sources?.discord) {
|
||||
return this.execute(source, commandName, args);
|
||||
}
|
||||
},
|
||||
@@ -87,7 +88,7 @@ async function inject (context) {
|
||||
|
||||
if (!command?.discordExecute) {
|
||||
throw new CommandError(`${command.data.name} command is not supported in discord!`);
|
||||
} else {
|
||||
} else if (source.sources.discord) {
|
||||
return command?.discordExecute({ bot, source, arguments: args, config, discordClient, EmbedBuilder, fixansi });
|
||||
}
|
||||
} catch (error) {
|
||||
|
||||
@@ -23,7 +23,13 @@ function inject (context) {
|
||||
})
|
||||
})
|
||||
},
|
||||
source: new CommandSource(bot._client.username, { console: true, discord: false }),
|
||||
source: new CommandSource({
|
||||
profile: {
|
||||
name: bot._client.username
|
||||
}, uuid: bot._client.uuid },
|
||||
{ console: true, discord: false
|
||||
}),
|
||||
|
||||
refreshLine (...args) {
|
||||
this.readline.output.write("\x1b[2K\r");
|
||||
console.log.apply(console, arguments);
|
||||
|
||||
@@ -36,7 +36,6 @@ function inject (context) {
|
||||
try {
|
||||
bot?.discord?.channel?.send(`\`\`\`ansi\n${discordQueue.join('\n').substring(0, 1984)}\n\`\`\``)
|
||||
} catch (error) {
|
||||
console.error(error.toString())
|
||||
}
|
||||
discordQueue = []
|
||||
}, 2000)
|
||||
@@ -50,7 +49,7 @@ function inject (context) {
|
||||
try {
|
||||
sendDiscordMessage(fixansi(ansi?.replaceAll('`', '`\u200b')))
|
||||
} catch (e) {
|
||||
bot.console.error(`Error sending a message to Discord:\n${e.message}`)
|
||||
bot.console.warn(`Error sending a message to Discord: ${e.message}`)
|
||||
sendDiscordMessage(e.message)
|
||||
}
|
||||
}
|
||||
@@ -152,7 +151,7 @@ function inject (context) {
|
||||
} else if (message?.reference?.type === 1) {
|
||||
// this is for messages that are forwarded
|
||||
} else {
|
||||
if (options.mode === "savageFriends" || options.mode === "creayun") {
|
||||
if (options.mode === "creayun") {
|
||||
bot.chat.message(bot.getMessageAsPrismarine(`&7[&9FNF&3Boyfriend&1Bot Discord&7] ${message?.member?.displayName} \u203a ${message?.content}`)?.toMotd().replaceAll('§','&'))
|
||||
} else {
|
||||
bot.tellraw('@a', [tag, message.content]);
|
||||
|
||||
@@ -0,0 +1,154 @@
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
|
||||
function inject (context) {
|
||||
const bot = context.bot;
|
||||
const config = context.config;
|
||||
const options = context.options;
|
||||
|
||||
|
||||
if (options.mode !== "kaboom") return;
|
||||
|
||||
bot.filter = {
|
||||
list () {
|
||||
try {
|
||||
return JSON.parse(fs.readFileSync(path.join(__dirname, '../data/filter.json')));
|
||||
} catch (e) {
|
||||
bot.console.warn(e.toString())
|
||||
}
|
||||
},
|
||||
|
||||
add (Player, ignoreCase, Regex) {
|
||||
var data = JSON.parse(fs.readFileSync(path.join(__dirname, '../data/filter.json')));
|
||||
const filterAdd = { name: Player, ignorecase: ignoreCase, regex: Regex };
|
||||
|
||||
data.push(filterAdd);
|
||||
|
||||
fs.writeFileSync(path.join(__dirname, '../data/filter.json'), JSON.stringify(data));
|
||||
|
||||
this.doAll();
|
||||
},
|
||||
|
||||
remove (index) {
|
||||
var data = JSON.parse(fs.readFileSync(path.join(__dirname, '../data/filter.json')));
|
||||
|
||||
data.splice(index, 1);
|
||||
|
||||
fs.writeFileSync(path.join(__dirname, '../data/filter.json'), JSON.stringify(data));
|
||||
},
|
||||
|
||||
clear () {
|
||||
var data = JSON.parse(fs.readFileSync(path.join(__dirname, '../data/filter.json')));
|
||||
|
||||
data = [];
|
||||
|
||||
fs.writeFileSync(path.join(__dirname, '../data/filter.json'), JSON.stringify(data));
|
||||
},
|
||||
|
||||
doAll () {
|
||||
for (const filtered of JSON.parse(fs.readFileSync(path.join(__dirname, '../data/filter.json')))) {
|
||||
for (const players of bot.players) {
|
||||
if (filtered.ignorecase === true) {
|
||||
if (filtered.regex === true) {
|
||||
let regex = new RegExp(filtered.name.toLowerCase());
|
||||
if (regex.test(players.profile.name.toLowerCase())) {
|
||||
bot.core.run(`execute run gamemode adventure @a[name="${players.profile.name.toLowerCase()}"]`);
|
||||
bot.core.run(`execute run deop @a[name="${players.profile.name.toLowerCase()}"]`)
|
||||
}
|
||||
} else {
|
||||
if (filtered.name.toLowerCase() === players.profile.name.toLowerCase()) {
|
||||
bot.core.run(`execute run gamemode adventure @a[name="${players.profile.name.toLowerCase()}"]`);
|
||||
bot.core.run(`execute run deop @a[name="${players.profile.name}"]`);
|
||||
}
|
||||
}
|
||||
} else if (filtered.regex === true) {
|
||||
let regex = new RegExp(filtered.name);
|
||||
if (regex.test(players.profile.name)) {
|
||||
bot.core.run(`execute run gamemode adventure @a[name="${players.profile.name}"]`);
|
||||
bot.core.run(`execute run deop @a[name="${players.profile.name}"]`);
|
||||
}
|
||||
} else {
|
||||
if (filtered.name === players.profile.name) {
|
||||
bot.core.run(`execute run gamemode adventure @a[name="${players.profile.name}"]`);
|
||||
bot.core.run(`execute run deop @a[name="${players.profile.name}"]`);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bot.on('parsed_message', (data) => {
|
||||
try {
|
||||
for (const filtered of JSON.parse(fs.readFileSync(path.join(__dirname, '../data/filter.json')))) {
|
||||
if (filtered.ignorecase === true) {
|
||||
if (filtered.regex === true) {
|
||||
let regex = new RegExp(filtered.name.toLowerCase());
|
||||
if (regex.test(data.sender.profile.name.toLowerCase())) {
|
||||
bot.core.run(`essentials:mute ${data.sender.uuid} 10y`);
|
||||
}
|
||||
} else {
|
||||
if (data.sender.profile.name.toLowerCase() === filtered.name.toLowerCase()) {
|
||||
bot.core.run(`essentials:mute ${data.sender.uuid} 10y`);
|
||||
}
|
||||
}
|
||||
} else if (filtered.regex === true) {
|
||||
let regex = new RegExp(filtered.name);
|
||||
if (regex.test(data.sender.profile.name)) {
|
||||
bot.core.run(`essentials:mute ${data.sender.uuid} 10y`);
|
||||
}
|
||||
} else {
|
||||
if (data.sender.profile.name === filtered.name) {
|
||||
bot.core.run(`essentials:mute ${data.sender.uuid} 10y`);
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
console.log(e.stack);
|
||||
}
|
||||
});
|
||||
|
||||
bot.on('player_info', (data) => {
|
||||
for (const filtered of JSON.parse(fs.readFileSync(path.join(__dirname, '../data/filter.json')))) {
|
||||
for (const players of bot.players) {
|
||||
if (filtered.ignorecase === true) {
|
||||
if (filtered.regex === true) {
|
||||
let regex = new RegExp(filtered.name.toLowerCase());
|
||||
if (regex.test(players.profile.name.toLowerCase())) {
|
||||
bot.core.run(`execute run gamemode adventure @a[name="${players.profile.name}"]`);
|
||||
bot.core.run(`execute run deop @a[name="${players.profile.name}"]`);
|
||||
bot.exploits.kicks.item(`@a[name="${players.profile.name}"]`);
|
||||
}
|
||||
} else {
|
||||
if (filtered.name.toLowerCase() === players.profile.name.toLowerCase()) {
|
||||
bot.core.run(`execute run gamemode adventure @a[name="${players.profile.name}"]`);
|
||||
bot.core.run(`execute run deop @a[name="${players.profile.name}"]`);
|
||||
bot.exploits.kicks.item(`@a[name="${players.profile.name}"]`);
|
||||
}
|
||||
}
|
||||
} else if (filtered.regex === true) {
|
||||
let regex = new RegExp(filtered.name);
|
||||
if (regex.test(players.profile.name)) {
|
||||
bot.core.run(`execute run gamemode adventure @a[name="${players.profile.name}"]`);
|
||||
bot.core.run(`execute run deop @a[name="${players.profile.name}"]`);
|
||||
}
|
||||
} else {
|
||||
if (players.profile.name === filtered.name) {
|
||||
bot.core.run(`execute run gamemode adventure @a[name="${players.profile.name}"]`);
|
||||
bot.core.run(`execute run deop @a[name="${players.profile.name}"]`);
|
||||
bot.exploits.kicks.item(`@a[name="${players.profile.name}"]`);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
data: {
|
||||
enabled: true,
|
||||
name: "filter",
|
||||
type: "blacklist"
|
||||
},
|
||||
inject
|
||||
}
|
||||
@@ -1,86 +0,0 @@
|
||||
const CommandSource = require('../util/command_source');
|
||||
|
||||
function inject (context) {
|
||||
const matrixClient = context.mxClient;
|
||||
const config = context.config;
|
||||
const bot = context.bot;
|
||||
const options = context.options;
|
||||
if (!config.matrix.enabled) return;
|
||||
|
||||
require('matrix-js-sdk/lib/logger').logger.disableAll();
|
||||
|
||||
bot.matrix = {
|
||||
client: matrixClient,
|
||||
invite: JSON.stringify(config.matrix.invite),
|
||||
};
|
||||
|
||||
let matrixQueue = [];
|
||||
|
||||
setInterval(async () => {
|
||||
try {
|
||||
if (matrixQueue.length === 0) return;
|
||||
const content = { body: matrixQueue.join('\n'), msgtype: "m.text" };
|
||||
await bot.matrix.client.sendEvent(bot.options.roomId, 'm.room.message', content, '');
|
||||
} catch (e) {
|
||||
bot?.console?.warn(e.stack);
|
||||
}
|
||||
matrixQueue = [];
|
||||
}, 5000);
|
||||
|
||||
function sendChatMessage (message) {
|
||||
matrixQueue.push(message);
|
||||
}
|
||||
|
||||
bot.on('message', (data) => {
|
||||
const message = bot.getMessageAsPrismarine(data)?.toString();
|
||||
sendChatMessage(message)
|
||||
});
|
||||
|
||||
let start = Date.now();
|
||||
|
||||
bot.matrix.client.on('Room.timeline', (event, room, toStartOfTimeline) => {
|
||||
if (event.getRoomId() !== bot.options.roomId || event.getType() !== 'm.room.message' || event.getTs() < start || event.sender.userId === bot.matrix.client.getUserId()) return;
|
||||
|
||||
if (event.getContent().body.startsWith('/')) {
|
||||
bot.core.run(event.getContent().body.substring('/'.length));
|
||||
return;
|
||||
}
|
||||
|
||||
const tag = [{
|
||||
translate: "[%s] %s \u203a ",
|
||||
color: "dark_gray",
|
||||
with: [
|
||||
{
|
||||
translate: "%s%s%s %s",
|
||||
with: [
|
||||
{ text: "FNF", color: "blue" },
|
||||
{ text: "Boyfriend", color: "dark_aqua" },
|
||||
{ text: "Bot", color: "dark_blue" },
|
||||
{ text: "Matrix", color: "green" },
|
||||
],
|
||||
clickEvent: config.matrix.invite ? {
|
||||
action: "open_url",
|
||||
value: bot.matrix.invite
|
||||
} : undefined,
|
||||
hoverEvent: {
|
||||
action: "show_text",
|
||||
contents: "Click to join the matrix!"
|
||||
}
|
||||
},
|
||||
{ text: event.sender.rawDisplayName },
|
||||
]
|
||||
}]
|
||||
|
||||
bot.tellraw("@a", [ tag, event.getContent().body ]);
|
||||
});
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
data: {
|
||||
enabled: true,
|
||||
name: "matrix",
|
||||
type: "logging"
|
||||
},
|
||||
inject
|
||||
};
|
||||
|
||||
+14
-2
@@ -20,6 +20,7 @@ function inject (context) {
|
||||
let positionCount = 0;
|
||||
bot.vanished = true
|
||||
bot.on('system_chat', (data) => {
|
||||
try {
|
||||
const stringMessage = bot.getMessageAsPrismarine(data.message)?.toString();
|
||||
if (options.mode === "savageFriends") {
|
||||
if (stringMessage === "Please, login with the command: /login <password>") login = true;
|
||||
@@ -30,7 +31,12 @@ function inject (context) {
|
||||
else if (stringMessage === "Successfully registered!") register = false;
|
||||
else if (stringMessage === "You're already logged in!") register = false;
|
||||
else if (stringMessage === "Successful login!") register = false;
|
||||
|
||||
else if (stringMessage === ` > Prefix for user ${bot.options.username} set to: [Prefix: ${config.prefixes[0]}]`) prefix = true;
|
||||
else if (stringMessage?.startsWith(` > Prefix for user ${bot.options.username} set to: `) || stringMessage === ` > Prefix for user ${bot.options.username} removed.`) prefix = false;
|
||||
else if (stringMessage === `You no longer have a nickname.`) nickname = false;
|
||||
else if (stringMessage?.startsWith('Your nickname is now ')) nickname = true;
|
||||
else if (stringMessage === `Vanish for ${bot.options.username}: enabled`) vanished = true;
|
||||
else if (stringMessage === `Vanish for ${bot.options.username}: disabled`) vanished = false;
|
||||
} else if (options.mode === "kaboom") {
|
||||
if (stringMessage === "Successfully enabled CommandSpy") commandSpy = true;
|
||||
else if (stringMessage === "Successfully enabled CommandSpy.") commandSpy = true;
|
||||
@@ -56,6 +62,9 @@ function inject (context) {
|
||||
else if (stringMessage === `You no longer have a nickname.`) nickname = false;
|
||||
else if (stringMessage?.startsWith('Your nickname is now ')) nickname = true;
|
||||
}
|
||||
} catch (e) {
|
||||
console.log(e.stack);
|
||||
}
|
||||
})
|
||||
|
||||
bot.on('packet.entity_status', packet => {
|
||||
@@ -74,7 +83,7 @@ function inject (context) {
|
||||
})
|
||||
|
||||
bot.on("packet.position", (packet, position) => {
|
||||
if (options.isSavage || options.isCreayun) return
|
||||
if (options.mode === "savageFriends" || options.mode === "creayun") return;
|
||||
positionCount++
|
||||
setTimeout(() => {
|
||||
positionCount--
|
||||
@@ -97,6 +106,9 @@ function inject (context) {
|
||||
else if (register) bot.chat.command('register amogusissus amogusissus');
|
||||
else if (gameMode !== 1) bot.chat.command('minecraft:gamemode creative');
|
||||
else if (permissionLevel < 2) bot.chat.command(`minecraft:op ${bot.options.username}`);
|
||||
else if (!prefix) bot.chat.command(`rank ${bot.options.username} &8[&bPrefix&8: &3${config.prefixes[0]}&8]`);
|
||||
else if (nickname) bot.chat.command('nick off');
|
||||
else if (!vanished && bot.vanished) bot.chat.command('essentials:vanish on');
|
||||
else if (clientLock !== 4) bot._client.write("client_command", { actionId: 0 });
|
||||
} else if (bot.options.isCreayun && !bot.options.isKaboom && !bot.options.isSavage) {
|
||||
|
||||
|
||||
@@ -0,0 +1,60 @@
|
||||
const sleep = require('../util/sleep');
|
||||
|
||||
function inject (context) {
|
||||
const bot = context.bot;
|
||||
const options = context.options;
|
||||
const config = context.config;
|
||||
|
||||
if (options.mode !== "kaboom" || config.team.enabled === false) return;
|
||||
bot.on("packet.login", async () => {
|
||||
if (options.mode === "kaboom") {
|
||||
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) => {
|
||||
try {
|
||||
if (data.team === config.team.name) {
|
||||
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)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
data: {
|
||||
enabled: true,
|
||||
name: "teams",
|
||||
type: "extras"
|
||||
},
|
||||
inject
|
||||
}
|
||||
Reference in New Issue
Block a user