How to use the flying-squid.Command function in flying-squid

To help you get started, we’ve selected a few flying-squid examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github PrismarineJS / flying-squid / src / lib / plugins / login.js View on Github external
serv._server.on('login', async (client) => {
    if (client.socket.listeners('end').length === 0) return // TODO: should be fixed properly in nmp instead
    try {
      const player = serv.initEntity('player', null, serv.overworld, new Vec3(0, 0, 0))
      player._client = client

      player.profileProperties = player._client.profile ? player._client.profile.properties : []
      player.commands = new Command({})
      Object.keys(plugins)
        .filter(pluginName => plugins[pluginName].player !== undefined)
        .forEach(pluginName => plugins[pluginName].player(player, serv, options))

      serv.emit('newPlayer', player)
      player.emit('asap')
      await player.login()
    } catch (err) {
      setTimeout(() => { throw err }, 0)
    }
  })
}