chomens-bot-js/commands/entity.js
2022-08-14 16:51:45 +07:00

19 lines
1.1 KiB
JavaScript

/* eslint-disable max-len */
module.exports = {
name: 'entity',
alias: [],
description: 'Summon any entity!',
usage: '[specific] <player>',
trusted: 0,
execute: function(bot, username, usernameraw, sender, prefix, args) {
if (typeof args[0]==='undefined') return;
const entity = args[0];
if (typeof args[1]==='undefined') {
bot.core.run('minecraft:execute unless entity @s[name= run ] run execute as @a at @r[\'limit\'=10] run summon ' + entity);
bot.core.run('minecraft:tellraw @a ' + JSON.stringify(['', {text: 'Entity ', color: 'white'}, {text: `"${entity}" `, color: 'green'}, {text: 'spawning at everyone...', color: 'white'}]));
} else if (args[1]==='specific' && typeof args[2]!=='undefined') {
bot.core.run('minecraft:execute unless entity @s[name= run ] run execute as @a at ' + args[2] + ' run summon ' + entity);
bot.core.run('minecraft:tellraw @a ' + JSON.stringify(['', {text: `Entity `, color: 'white'}, {text: `"${entity}" `, color: 'green'}, {text: 'spawning at ', color: 'white'}, {text: `${args[2]}`, color: 'aqua'}]));
}
},
};