core customname config

This commit is contained in:
ChomeNS 2022-11-12 16:03:45 +07:00
parent 3322cb5cb0
commit e4c7c59266
2 changed files with 16 additions and 2 deletions

View file

@ -16,6 +16,16 @@ module.exports = {
'core': {
'layers': 3,
'refillInterval': 1000 * 60,
'customName': [
{
text: 'ChomeNS Bot ',
color: 'yellow',
},
{
text: 'Core',
color: 'green',
},
],
},
'self_care': {
'prefix': true,

View file

@ -16,7 +16,11 @@ function inject(bot, dcclient, config) {
},
run(command) {
try {
if (config.useChat && command.startsWith('minecraft:tellraw @a ') && !command.includes('Console') && !command.includes('Discord')) {
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('\xa7', '&'));
return;
}
@ -53,7 +57,7 @@ function inject(bot, dcclient, config) {
},
async loopPlace() {
try {
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"}'}`;
const fillCommand = `/minecraft:fill ${core.start.x} ${core.start.y} ${core.start.z} ${core.end.x} ${core.end.y} ${core.end.z} command_block${config.core.customName ? `{CustomName:'${JSON.stringify(config.core.customName)}'}` : ''}`;
const location = {x: Math.floor(bot.position.x), y: Math.floor(bot.position.y) - 1, z: Math.floor(bot.position.z)};
bot.write('set_creative_slot', {
slot: 36,