Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
module.exports.player = function (player, serv, options) {
const version = options.version
const entitiesByName = require('minecraft-data')(version).entitiesByName
const Item = require('prismarine-item')(version)
player.commands.add({
base: 'summon',
info: 'Summon an entity',
usage: '/summon ',
op: true,
action (name) {
if (Object.keys(serv.entities).length > options['max-entities']) { throw new UserError('Too many mobs !') }
const entity = entitiesByName[name]
if (!entity) {
player.chat('No entity named ' + name)
return
}
if (entity.type === 'mob') {
serv.spawnMob(entity.id, player.world, player.position, {