config.core.useChat to config.useChat

This commit is contained in:
ChomeNS 2022-08-17 18:47:22 +07:00
parent 05e709bf9e
commit 8bcd8b0db9
2 changed files with 34 additions and 30 deletions

View file

@ -4,8 +4,8 @@
"cbot ",
"/cbot "
],
"useChat": true,
"core": {
"useChat": true,
"layers": 1
},
"discord": {

View file

@ -13,37 +13,41 @@ function inject(bot) {
return position.x >= core.start.x && position.x <= core.end.x && position.y >= core.start.y && position.y <= core.end.y && position.z >= core.start.z && position.z <= core.end.z;
},
run(command) {
if (config.core.useChat && command.startsWith('minecraft:tellraw @a ')) {
bot.chat(chatMessage.fromNotch(command.replace('minecraft:tellraw @a ', '')).toMotd().replaceAll('§', '&'));
try {
if (config.useChat && command.startsWith('minecraft:tellraw @a ') && !command.includes('Console') && !command.includes('Discord')) {
bot.chat(chatMessage.fromNotch(command.replace('minecraft:tellraw @a ', '')).toMotd().replaceAll('§', '&'));
return;
}
relativePosition.x++;
if (relativePosition.x >= 16) {
relativePosition.x = 0;
relativePosition.y++;
}
if (relativePosition.y >= layers) {
relativePosition.y = 0;
relativePosition.z++;
}
if (relativePosition.z >= 16) {
relativePosition.z = 0;
}
bot.write('update_command_block', {
location: {
x: core.start.x + relativePosition.x,
y: core.start.y + relativePosition.y,
z: core.start.z + relativePosition.z,
},
command: command.substring(0, 32767),
mode: 1,
flags: 0b100,
});
} catch (e) {
return;
}
relativePosition.x++;
if (relativePosition.x >= 16) {
relativePosition.x = 0;
relativePosition.y++;
}
if (relativePosition.y >= layers) {
relativePosition.y = 0;
relativePosition.z++;
}
if (relativePosition.z >= 16) {
relativePosition.z = 0;
}
bot.write('update_command_block', {
location: {
x: core.start.x + relativePosition.x,
y: core.start.y + relativePosition.y,
z: core.start.z + relativePosition.z,
},
command: command.substring(0, 32767),
mode: 1,
flags: 0b100,
});
},
fillCore(useCore) {
const fillCommand = `/minecraft:fill ${core.start.x} ${core.start.y} ${core.start.z} ${core.end.x} ${core.end.y} ${core.end.z} command_block{CustomName:'{"text":"ChomeNS Bot Core","color":"yellow"}'}`;