chomens-bot-js/commands/entity.js

22 lines
1.2 KiB
JavaScript
Raw Normal View History

2022-08-14 05:51:45 -04:00
/* eslint-disable max-len */
2022-08-26 06:21:33 -04:00
const mcData = require('minecraft-data')('1.18.2');
2022-08-14 05:51:45 -04:00
module.exports = {
name: 'entity',
alias: [],
description: 'Summon any entity!',
usage: '[specific] <player>',
trusted: 0,
execute: function(bot, username, usernameraw, sender, prefix, args) {
if (!args[0]) return;
2022-08-26 06:28:45 -04:00
const entity = mcData.entitiesByName[args[0]];
if (!entity) throw new SyntaxError('Invalid entity');
if (!args[1]) {
bot.core.run('minecraft:execute unless entity @s[name= run ] run execute as @a at @r[\'limit\'=10] run summon minecraft:' + entity.name);
2022-08-26 06:31:49 -04:00
bot.core.run('minecraft:tellraw @a ' + JSON.stringify(['', {text: 'Entity ', color: 'white'}, {text: entity.displayName, color: 'green'}, {text: ' spawning at everyone...', color: 'white'}]));
} else if (args[1]==='specific' && args[2]) {
2022-08-26 06:31:49 -04:00
bot.core.run('minecraft:execute unless entity @s[name= run ] run execute as @a at ' + args[2] + ' run summon minecraft:' + entity.name);
bot.core.run('minecraft:tellraw @a ' + JSON.stringify(['', {text: `Entity `, color: 'white'}, {text: entity.displayName, color: 'green'}, {text: ' spawning at ', color: 'white'}, {text: `${args[2]}`, color: 'aqua'}]));
2022-08-14 05:51:45 -04:00
}
},
};